SOL - Tag a stake

Stakes can be taggued using the Solana memo feature to enable Kiln to distinguish your stakes on-chain.

Solana memo instruction

A Solana transaction is composed of multiple instructions, executed one after the other. Here is an example of instructions you can define with the standard Solana @solana/web3.js package.

const memoProgram = 'MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr';
const memo = 'hello, world!';

const instructions = [
  // 1 - add memo to transaction
  new TransactionInstruction({
    keys: [
      {
        pubkey: staker,
        isSigner: true,
        isWritable: true,
      },
    ],
    programId: new PublicKey(memoProgram),
    data: Buffer.from(memo),
  }),
  // 2 - create stake account
  SystemProgram.createAccount({
    /** The account that will transfer lamports to the created account */
    fromPubkey: publicKey,
    /** Public key of the created account. Must be pre-calculated with PublicKey.createWithSeed() */
    newAccountPubkey: stakeKey.publicKey,
    /** Amount of lamports to transfer to the created account */
    lamports: solToLamports(parsedStakeAmount),
    /** Amount of space in bytes to allocate to the created account */
    space: 200,
    /** Public key of the program to assign as the owner of the created account */
    programId,
  }),
  // 3 - init stake account
  StakeProgram.initialize({
    stakePubkey: stakeKey.publicKey,
    authorized: {
       /** stake authority */
       staker: publicKey,
       /** withdraw authority */
       withdrawer: publicKey,
     },
     lockup: {
       /** Unix timestamp of lockup expiration */
       unixTimestamp: 0,
       /** Epoch of lockup expiration */
       epoch: 0,
       /** Lockup custodian authority */
        custodian: new PublicKey('11111111111111111111111111111111'),
      },
    }),
    // 4 - delegate stake account
    StakeProgram.delegate({
      stakePubkey: stakeKey.publicKey,
      authorizedPubkey: publicKey,
      votePubkey: new PublicKey(SOL_VOTE_ACCOUNT_ADDRESS),
    }),
];

tx.add(...instructions);

This transaction will be taggued with the hello, world! memo and will create, initialize and delegate a stake account.

What value should we use for the memo?

Kiln gives to each partner a fix value to include as memo in all the transactions they craft with the following format: kiln_{uuidv4}.

Last updated