Staking

To stake your SOL with Stakefish, you must create a new delegation. This process initializes a stake account and delegates the specified amount of SOL to the Stakefish validator.

Send the following request to our API:

curl -X POST   'https://api.stake.fish/v1/solana/delegate' \
-H 'Content-Type: application/json' \
-H 'Authorization: YOUR_PUBLIC_API_KEY' \
-d '{
    "stakeAuthorityPubkey": STAKE_AUTHORITY_PUBKEY,
    "amountToStake": "1000000000",
    "fromPubkey": FUNDING_PUBKEY
  }'
📘

Important

This API requires Public API Key.


Required Fields:

  • stakeAuthorityPubkey: The public key that controls the stake account
  • amountToStake: The amount of SOL (in lamports) to delegate

Optional Fields:

  • fromPubkey: The public key that will fund and sign the transaction
    • Defaults to stakeAuthorityPubkey

Example Request Body:

{
  "stakeAuthorityPubkey": "Aby8zv8WueGgQgqvBSMdifCGr1MXEFUhYXTEhbs2ChyE",
  "amountToStake": "1000000000",
  "fromPubkey": "7VGU4ZwR1e1AFekqbqv2gvjeg47e1PwMPm4BfLt6rxNk"
}

Example Response:

{
  "serializedTransaction": "AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgADBeoOx6fJLnceFv4CZ68u1zUB6f9k2fwkIAsA6ZRZ3KQUR9zlUhDKVJWQw7kjNt7wNP9oGHdZy8toGmBr4pT",
  "stakeAccountPubkey": "5qXJrkNpVvL9xM3sBDd9413rqXuDU2PpJZZ6H5chVJR6",
  "voteAccountPubkey": "7VGU4ZwR1e1AFekqbqv2gvjeg47e1PwMPm4BfLt6rxNk"
}

Sign & Broadcast Transaction

Once the delegation transaction is prepared by our API, the final step is to sign and broadcast it.

Sign the Transaction

Rehydrate the serialized transaction from the Base64 encoded string. Use the account corresponding to the fromPubkey (defaults to stakeAuthorityPubkey) to sign the transaction.

Send the Transaction

Broadcast the signed transaction to a Solana node. Once confirmed, your new stake account will be initialized and the SOL delegated to the Stakefish validator.