> For the complete documentation index, see [llms.txt](https://docs.kiln.fi/v1/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kiln.fi/v1/kiln-products/connect/tutorials/sol-tag-a-stake.md).

# 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.

```tsx
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}`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.kiln.fi/v1/kiln-products/connect/tutorials/sol-tag-a-stake.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
