Merge Delegations

If you have multiple stake accounts, you can merge them into a single target account. This is useful for consolidating smaller stake accounts into one.

Send the following request to our API:

curl -X POST   'https://api.stake.fish/v1/solana/merge' \  
-H 'Content-Type: application/json' \  
-H 'Authorization: YOUR_PUBLIC_API_KEY' \
-d '{
    "stakeAuthorityPubkey": STAKE_AUTHORITY_PUBKEY,
    "sourceStakeAccountPubkeys": [
      "STAKE_ACCOUNT_1",
      "STAKE_ACCOUNT_2"
    ],
    "targetStakeAccountPubkey": TARGET_STAKE_ACCOUNT_PUBKEY,
    "fromPubkey": SIGNER_PUBKEY
  }'
📘

Important

This API requires Public API Key.


Required Fields:

  • stakeAuthorityPubkey: The public key that controls the stake accounts
  • sourceStakeAccountPubkeys: An array of stake accounts to merge into the target
  • targetStakeAccountPubkey: The destination stake account into which the others will be merged

Optional Fields:

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

Example Request Body:

{
  "stakeAuthorityPubkey": "Aby8zv8WueGgQgqvBSMdifCGr1MXEFUhYXTEhbs2ChyE",
  "sourceStakeAccountPubkeys": [
    "5qXJrkNpVvL9xM3sBDd9413rqXuDU2PpJZZ6H5chVJR6",
    "DN5cdpzyZPFug1NvkgKQf64vKA5fTaCDXktpR7tD9Kd7"
  ],
  "targetStakeAccountPubkey": "7VGU4ZwR1e1AFekqbqv2gvjeg47e1PwMPm4BfLt6rxNk",
  "fromPubkey": "7VGU4ZwR1e1AFekqbqv2gvjeg47e1PwMPm4BfLt6rxNk"
}

Example Response:

{
  "serializedTransaction": "AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgADBeoOx6fJLnceFv4CZ68u1zUB6f9k2fwkIAsA6ZRZ3KQUR9zlUhDKVJWQw7kjNt7wNP9oGHdZy8toGmBr4pT"
}

Sign & Broadcast Transaction

Once the merge 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, the source stake accounts will be merged into the target account.