---
updatedAt: 2026-05-07T01:57:09.000Z
agentTools:
  projectIndex: https://docs.mavan.bitminetech.io/llms.txt
---

# Generate a Solana stake transaction payload

Builds a Solana staking transaction message for the caller to sign and submit. Building a payload does not broadcast a transaction or confirm an on-chain change.

Choose **Mainnet** or **Devnet** from the **Base URL** dropdown on the right before using **Try It**. Devnet is the Solana test environment. Use an API key and any required account addresses for your selection. Changing **Base URL** does not change the API key or addresses you have entered.

Supply your API credentials in the `api-key` header and send the request body as JSON. Instructions operating on an existing stake account must provide a top-level `stakePubkey` alongside `feePayer` and `instructions`.

After building, sign the transaction through your wallet or custody integration, submit it to the selected Solana network, and confirm execution.

Select an instruction from the **Examples** dropdown or use the complete JSON requests below. Replace every `<...>` placeholder with your own address on the selected network before using **Try It**; entering an API key does not replace them automatically. Each example contains one instruction. The fee payer must sign, along with the instruction-specific signers described below.

For operations on existing accounts, first call **Get Solana Stake Accounts** (`GET /solana/stakes`) with the same API key and copy the account's `stakePubkey` and relevant authority. Confirm its current balance and state through Solana RPC because the listing can be stale.

### Create and delegate a new stake account

Creates a new stake account and delegates it to the validator configured for the gateway in one transaction. Omit the top-level `stakePubkey` so the gateway generates the new account address.

`fromPubkey` funds the account and must sign. `stakeAuthority` controls delegation and deactivation and must also sign this instruction. `withdrawAuthority` controls withdrawals. The example uses the funding address as `feePayer`.

`lamports` is a decimal string containing the total account funding, including its rent reserve. The example funds 2 SOL; confirm the current rent reserve and minimum delegation before choosing an amount. `reference` and `label` identify the stake within the platform.

```json
{
  "feePayer": "<FEE_PAYER_AND_FUNDING_ADDRESS>",
  "instructions": [
    {
      "type": "createAndDelegate",
      "input": {
        "fromPubkey": "<FEE_PAYER_AND_FUNDING_ADDRESS>",
        "stakeAuthority": "<STAKE_AUTHORITY>",
        "withdrawAuthority": "<WITHDRAW_AUTHORITY>",
        "lamports": "2000000000",
        "reference": "client-create-and-delegate-1",
        "label": "Delegated stake"
      }
    }
  ]
}
```

The response's `data.stakePubkey` identifies the new account. Restore the gateway-supplied account signature before signing and submitting, as described in **Signing and submitting stake transaction payloads** below. The account exists on-chain only after the transaction succeeds.

### Create a new stake account without delegating

Creates and funds an account with the same inputs as `createAndDelegate`, but leaves it undelegated. Omit the top-level `stakePubkey`. The funding address must sign; setting `stakeAuthority` and `withdrawAuthority` does not require those authorities to sign account creation.

The example funds 2 SOL, including the account's rent reserve, and uses the funding address as `feePayer`. Choose an amount that covers the current rent reserve and any later delegation requirements.

```json
{
  "feePayer": "<FEE_PAYER_AND_FUNDING_ADDRESS>",
  "instructions": [
    {
      "type": "create",
      "input": {
        "fromPubkey": "<FEE_PAYER_AND_FUNDING_ADDRESS>",
        "stakeAuthority": "<STAKE_AUTHORITY>",
        "withdrawAuthority": "<WITHDRAW_AUTHORITY>",
        "lamports": "2000000000",
        "reference": "client-create-1",
        "label": "New stake"
      }
    }
  ]
}
```

The response's `data.stakePubkey` identifies the new account. Restore the gateway-supplied account signature before signing and submitting. To delegate later, use that address as the top-level `stakePubkey` in a `delegate` request.

### Delegate an existing stake account

Delegates the top-level `stakePubkey` to the validator configured for the gateway. Select an account eligible for delegation and confirm that its available stake meets the network's current minimum delegation.

`authorizedPubkey` is the account's stake authority and must sign. The example uses the same address as `feePayer`.

```json
{
  "feePayer": "<FEE_PAYER_AND_STAKE_AUTHORITY>",
  "stakePubkey": "<STAKE_ACCOUNT>",
  "instructions": [
    {
      "type": "delegate",
      "input": {
        "authorizedPubkey": "<FEE_PAYER_AND_STAKE_AUTHORITY>"
      }
    }
  ]
}
```

### Undelegate (deactivate) an existing stake account

Starts deactivation of the top-level `stakePubkey`. `authorizedPubkey` is the account's stake authority and must sign. The example uses the same address as `feePayer`.

Deactivation does not immediately make all delegated stake available to withdraw. Wait until the requested amount is inactive and withdrawable on-chain before building a withdrawal.

```json
{
  "feePayer": "<FEE_PAYER_AND_STAKE_AUTHORITY>",
  "stakePubkey": "<STAKE_ACCOUNT>",
  "instructions": [
    {
      "type": "undelegate",
      "input": {
        "authorizedPubkey": "<FEE_PAYER_AND_STAKE_AUTHORITY>"
      }
    }
  ]
}
```

### Withdraw available inactive stake

Withdraws available inactive stake or excess SOL from the top-level `stakePubkey` to `toPubkey`. `authorizedPubkey` is the account's withdraw authority and must sign. The example uses that authority as `feePayer`.

For withdrawal, `lamports` is a JSON **number**. The example withdraws 1 SOL (1,000,000,000 lamports); confirm that the amount is currently available and that any remaining balance satisfies the account's rent and delegation requirements.

```json
{
  "feePayer": "<FEE_PAYER_AND_WITHDRAW_AUTHORITY>",
  "stakePubkey": "<STAKE_ACCOUNT>",
  "instructions": [
    {
      "type": "withdraw",
      "input": {
        "toPubkey": "<WITHDRAWAL_RECIPIENT>",
        "authorizedPubkey": "<FEE_PAYER_AND_WITHDRAW_AUTHORITY>",
        "lamports": 1000000000
      }
    }
  ]
}
```

### Change a stake account authority

Changes an authority of the top-level `stakePubkey` to `newAuthorizedPubkey`. Set `stakeAuthorizationType` to `0` for the stake authority or `1` for the withdraw authority. `authorizedPubkey` is the current authority for the chosen type and must sign.

The example changes the stake authority and uses the current authority as `feePayer`. To change the withdraw authority, use `stakeAuthorizationType: 1` and the account's current withdraw authority.

```json
{
  "feePayer": "<FEE_PAYER_AND_CURRENT_AUTHORITY>",
  "stakePubkey": "<STAKE_ACCOUNT>",
  "instructions": [
    {
      "type": "authorize",
      "input": {
        "authorizedPubkey": "<FEE_PAYER_AND_CURRENT_AUTHORITY>",
        "newAuthorizedPubkey": "<NEW_AUTHORITY>",
        "stakeAuthorizationType": 0
      }
    }
  ]
}
```

### Split an existing stake account

Creates one or more new child stake accounts and moves each requested amount from the source account into the corresponding child. Supply one split instruction per destination account. Split instructions cannot be combined with other instruction types. The child inherits the source account's stake and withdraw authorities and, for delegated stake, its delegation history.

For production integrations, use an active source account. Requests involving undelegated or activating accounts may fail. For a partial split of active stake, both the child's delegated stake and the parent's remaining delegated stake must meet the network's current minimum delegation.

The stake authority (`authorizedPubkey`) funds the new account's rent-exempt reserve separately from the split amount, and `feePayer` pays transaction fees. The examples use the same address for both roles. If feePayer differs from authorizedPubkey, collect both signatures before broadcast. Destination accounts are derived with createWithSeed from authorizedPubkey; no ephemeral secret key is returned for split. Rent and minimum delegation are network parameters; do not hard-code them.

To try a split, first call **Get Solana Stake Accounts** (`GET /solana/stakes`) with the same API key. Choose an eligible `ACTIVE` account and copy its `stakePubkey` into the request. Set `instructions[0].input.authorizedPubkey` to that account's `stakeAuthority`; the example below also uses that authority as `feePayer`, which must have enough SOL for rent and fees. Confirm the current parent balance and delegation state through Solana RPC, then choose a valid split amount; the listing can be stale. Replace every `<...>` placeholder in the example with a real public key; entering an API key does not replace them automatically.

```json
{
  "feePayer": "<FEE_PAYER_AND_STAKE_AUTHORITY>",
  "stakePubkey": "<PARENT_STAKE_ACCOUNT>",
  "instructions": [
    {
      "type": "split",
      "input": {
        "authorizedPubkey": "<FEE_PAYER_AND_STAKE_AUTHORITY>",
        "lamports": "1050000000",
        "reference": "client-split-1",
        "label": "Split child"
      }
    }
  ]
}
```

- `authorizedPubkey` is the source account's stake authority and must sign.
- `lamports` must be a positive base-10 integer **string**, without leading zeros, and must not exceed `9007199254740991`. The example moves 1.05 SOL; check the remaining delegation before using that amount.
- `reference` and `label` are optional. Omitted metadata is inherited or defaulted by the service. A supplied parent label normally gains `" (split)"` when inherited; a blank parent can produce `"Split stake"`.
- Supply an explicit child label to override inheritance. An empty string is accepted.

Example success response, HTTP `201`:

```json
{
  "data": {
    "serialized": "<HEX_ENCODED_V0_MESSAGE>",
    "stakePubkey": "<NEW_CHILD_STAKE_ACCOUNT>",
    "stakePubkeys": ["<NEW_CHILD_STAKE_ACCOUNT>"],
    "signatures": []
  }
}
```

The request's `stakePubkey` identifies the parent. The response's `data.stakePubkeys` contains all new child addresses in instruction order; `data.stakePubkey` is the first child for backwards compatibility. The empty `signatures` array means no additional account signature is supplied by the gateway; it does not remove the caller's signing requirement.

Each build can generate a different child address. Keep the returned address paired with the exact payload from that response. The new account exists on-chain only after the transaction is submitted and succeeds.

Decode, sign, submit and confirm the returned message as described in **Signing and submitting stake transaction payloads** below.

### Merge compatible stake accounts

Merges the source account into a surviving destination account. The source account is closed when the transaction succeeds on-chain.

The top-level `stakePubkey` is the destination that survives. `input.sourceStakePubkey` is the source account that closes. `authorizedPubkey` is the stake authority and must sign.

Accounts must have compatible stake and withdraw authorities, lockup settings and delegation state. Active-stake merges also require compatible validator and vote-credit state. Matching authorities alone does not establish eligibility.

A child split from active stake inherits delegation history and can be merged back without waiting an additional epoch, provided the accounts remain compatible.

The example below uses the same address for the fee payer and stake authority. Replace every `<...>` placeholder with a real public key before submitting a request.

```json
{
  "feePayer": "<FEE_PAYER_AND_STAKE_AUTHORITY>",
  "stakePubkey": "<SURVIVING_STAKE_ACCOUNT>",
  "instructions": [
    {
      "type": "merge",
      "input": {
        "authorizedPubkey": "<FEE_PAYER_AND_STAKE_AUTHORITY>",
        "sourceStakePubkey": "<STAKE_ACCOUNT_TO_CLOSE>"
      }
    }
  ]
}
```

The response's `data.stakePubkey` identifies the surviving destination. Decode, sign, submit and confirm the returned message as described in **Signing and submitting stake transaction payloads** below.

The stake-account listing may retain the source as `DISSOLVED` with its historical balance. Exclude that row when calculating current holdings.

### Signing and submitting stake transaction payloads

`data.serialized` is a hexadecimal-encoded Solana v0 **message**, not a serialized transaction including its signature envelope.

For all instruction types, construct a transaction using `@solana/web3.js` v1.x and restore any additional signatures supplied by the gateway:

```js
import { MessageV0, PublicKey, VersionedTransaction } from '@solana/web3.js';

const message = MessageV0.deserialize(
  Buffer.from(response.data.serialized, 'hex'),
);
const transaction = new VersionedTransaction(message);

for (const { pubKey, signature } of response.data.signatures) {
  transaction.addSignature(new PublicKey(pubKey), Buffer.from(signature, 'hex'));
}
```

For `create` and `createAndDelegate`, `data.signatures` contains the signature of the generated stake account. Keep it paired with the exact returned message and preserve it when adding your own signatures. Other examples return an empty array; the caller's required signatures must still be collected.

Use your wallet or custody integration to sign the required message signers, submit the transaction to the matching Solana network, and confirm execution. Do not pass `data.serialized` directly to `VersionedTransaction.deserialize()`.

### Current integration limitations

The examples each use one instruction per request. Split and merge requests involving undelegated or activating accounts may fail to build through the production gateway.

Building a transaction can create a provisional `REQUESTED` record, including on some failed builds. A listing row is not proof of execution.

Invalid split amounts and mixed split/non-split instruction types return HTTP `400`. Other invalid inputs or unsupported account states can surface as HTTP `500`. Verify the request fields and account state before rebuilding.

# OpenAPI definition

````json
{
  "openapi": "3.0.0",
  "paths": {
    "/solana/stake/buildTransaction": {
      "post": {
        "description": "Builds a Solana staking transaction message for the caller to sign and submit. Building a payload does not broadcast a transaction or confirm an on-chain change.\n\nChoose **Mainnet** or **Devnet** from the **Base URL** dropdown on the right before using **Try It**. Devnet is the Solana test environment. Use an API key and any required account addresses for your selection. Changing **Base URL** does not change the API key or addresses you have entered.\n\nSupply your API credentials in the `api-key` header and send the request body as JSON. Instructions operating on an existing stake account must provide a top-level `stakePubkey` alongside `feePayer` and `instructions`.\n\nAfter building, sign the transaction through your wallet or custody integration, submit it to the selected Solana network, and confirm execution.\n\nSelect an instruction from the **Examples** dropdown or use the complete JSON requests below. Replace every `<...>` placeholder with your own address on the selected network before using **Try It**; entering an API key does not replace them automatically. Each example contains one instruction. The fee payer must sign, along with the instruction-specific signers described below.\n\nFor operations on existing accounts, first call **Get Solana Stake Accounts** (`GET /solana/stakes`) with the same API key and copy the account's `stakePubkey` and relevant authority. Confirm its current balance and state through Solana RPC because the listing can be stale.\n\n### Create and delegate a new stake account\n\nCreates a new stake account and delegates it to the validator configured for the gateway in one transaction. Omit the top-level `stakePubkey` so the gateway generates the new account address.\n\n`fromPubkey` funds the account and must sign. `stakeAuthority` controls delegation and deactivation and must also sign this instruction. `withdrawAuthority` controls withdrawals. The example uses the funding address as `feePayer`.\n\n`lamports` is a decimal string containing the total account funding, including its rent reserve. The example funds 2 SOL; confirm the current rent reserve and minimum delegation before choosing an amount. `reference` and `label` identify the stake within the platform.\n\n```json\n{\n  \"feePayer\": \"<FEE_PAYER_AND_FUNDING_ADDRESS>\",\n  \"instructions\": [\n    {\n      \"type\": \"createAndDelegate\",\n      \"input\": {\n        \"fromPubkey\": \"<FEE_PAYER_AND_FUNDING_ADDRESS>\",\n        \"stakeAuthority\": \"<STAKE_AUTHORITY>\",\n        \"withdrawAuthority\": \"<WITHDRAW_AUTHORITY>\",\n        \"lamports\": \"2000000000\",\n        \"reference\": \"client-create-and-delegate-1\",\n        \"label\": \"Delegated stake\"\n      }\n    }\n  ]\n}\n```\n\nThe response's `data.stakePubkey` identifies the new account. Restore the gateway-supplied account signature before signing and submitting, as described in **Signing and submitting stake transaction payloads** below. The account exists on-chain only after the transaction succeeds.\n\n### Create a new stake account without delegating\n\nCreates and funds an account with the same inputs as `createAndDelegate`, but leaves it undelegated. Omit the top-level `stakePubkey`. The funding address must sign; setting `stakeAuthority` and `withdrawAuthority` does not require those authorities to sign account creation.\n\nThe example funds 2 SOL, including the account's rent reserve, and uses the funding address as `feePayer`. Choose an amount that covers the current rent reserve and any later delegation requirements.\n\n```json\n{\n  \"feePayer\": \"<FEE_PAYER_AND_FUNDING_ADDRESS>\",\n  \"instructions\": [\n    {\n      \"type\": \"create\",\n      \"input\": {\n        \"fromPubkey\": \"<FEE_PAYER_AND_FUNDING_ADDRESS>\",\n        \"stakeAuthority\": \"<STAKE_AUTHORITY>\",\n        \"withdrawAuthority\": \"<WITHDRAW_AUTHORITY>\",\n        \"lamports\": \"2000000000\",\n        \"reference\": \"client-create-1\",\n        \"label\": \"New stake\"\n      }\n    }\n  ]\n}\n```\n\nThe response's `data.stakePubkey` identifies the new account. Restore the gateway-supplied account signature before signing and submitting. To delegate later, use that address as the top-level `stakePubkey` in a `delegate` request.\n\n### Delegate an existing stake account\n\nDelegates the top-level `stakePubkey` to the validator configured for the gateway. Select an account eligible for delegation and confirm that its available stake meets the network's current minimum delegation.\n\n`authorizedPubkey` is the account's stake authority and must sign. The example uses the same address as `feePayer`.\n\n```json\n{\n  \"feePayer\": \"<FEE_PAYER_AND_STAKE_AUTHORITY>\",\n  \"stakePubkey\": \"<STAKE_ACCOUNT>\",\n  \"instructions\": [\n    {\n      \"type\": \"delegate\",\n      \"input\": {\n        \"authorizedPubkey\": \"<FEE_PAYER_AND_STAKE_AUTHORITY>\"\n      }\n    }\n  ]\n}\n```\n\n### Undelegate (deactivate) an existing stake account\n\nStarts deactivation of the top-level `stakePubkey`. `authorizedPubkey` is the account's stake authority and must sign. The example uses the same address as `feePayer`.\n\nDeactivation does not immediately make all delegated stake available to withdraw. Wait until the requested amount is inactive and withdrawable on-chain before building a withdrawal.\n\n```json\n{\n  \"feePayer\": \"<FEE_PAYER_AND_STAKE_AUTHORITY>\",\n  \"stakePubkey\": \"<STAKE_ACCOUNT>\",\n  \"instructions\": [\n    {\n      \"type\": \"undelegate\",\n      \"input\": {\n        \"authorizedPubkey\": \"<FEE_PAYER_AND_STAKE_AUTHORITY>\"\n      }\n    }\n  ]\n}\n```\n\n### Withdraw available inactive stake\n\nWithdraws available inactive stake or excess SOL from the top-level `stakePubkey` to `toPubkey`. `authorizedPubkey` is the account's withdraw authority and must sign. The example uses that authority as `feePayer`.\n\nFor withdrawal, `lamports` is a JSON **number**. The example withdraws 1 SOL (1,000,000,000 lamports); confirm that the amount is currently available and that any remaining balance satisfies the account's rent and delegation requirements.\n\n```json\n{\n  \"feePayer\": \"<FEE_PAYER_AND_WITHDRAW_AUTHORITY>\",\n  \"stakePubkey\": \"<STAKE_ACCOUNT>\",\n  \"instructions\": [\n    {\n      \"type\": \"withdraw\",\n      \"input\": {\n        \"toPubkey\": \"<WITHDRAWAL_RECIPIENT>\",\n        \"authorizedPubkey\": \"<FEE_PAYER_AND_WITHDRAW_AUTHORITY>\",\n        \"lamports\": 1000000000\n      }\n    }\n  ]\n}\n```\n\n### Change a stake account authority\n\nChanges an authority of the top-level `stakePubkey` to `newAuthorizedPubkey`. Set `stakeAuthorizationType` to `0` for the stake authority or `1` for the withdraw authority. `authorizedPubkey` is the current authority for the chosen type and must sign.\n\nThe example changes the stake authority and uses the current authority as `feePayer`. To change the withdraw authority, use `stakeAuthorizationType: 1` and the account's current withdraw authority.\n\n```json\n{\n  \"feePayer\": \"<FEE_PAYER_AND_CURRENT_AUTHORITY>\",\n  \"stakePubkey\": \"<STAKE_ACCOUNT>\",\n  \"instructions\": [\n    {\n      \"type\": \"authorize\",\n      \"input\": {\n        \"authorizedPubkey\": \"<FEE_PAYER_AND_CURRENT_AUTHORITY>\",\n        \"newAuthorizedPubkey\": \"<NEW_AUTHORITY>\",\n        \"stakeAuthorizationType\": 0\n      }\n    }\n  ]\n}\n```\n\n### Split an existing stake account\n\nCreates one or more new child stake accounts and moves each requested amount from the source account into the corresponding child. Supply one split instruction per destination account. Split instructions cannot be combined with other instruction types. The child inherits the source account's stake and withdraw authorities and, for delegated stake, its delegation history.\n\nFor production integrations, use an active source account. Requests involving undelegated or activating accounts may fail. For a partial split of active stake, both the child's delegated stake and the parent's remaining delegated stake must meet the network's current minimum delegation.\n\nThe stake authority (`authorizedPubkey`) funds the new account's rent-exempt reserve separately from the split amount, and `feePayer` pays transaction fees. The examples use the same address for both roles. If feePayer differs from authorizedPubkey, collect both signatures before broadcast. Destination accounts are derived with createWithSeed from authorizedPubkey; no ephemeral secret key is returned for split. Rent and minimum delegation are network parameters; do not hard-code them.\n\nTo try a split, first call **Get Solana Stake Accounts** (`GET /solana/stakes`) with the same API key. Choose an eligible `ACTIVE` account and copy its `stakePubkey` into the request. Set `instructions[0].input.authorizedPubkey` to that account's `stakeAuthority`; the example below also uses that authority as `feePayer`, which must have enough SOL for rent and fees. Confirm the current parent balance and delegation state through Solana RPC, then choose a valid split amount; the listing can be stale. Replace every `<...>` placeholder in the example with a real public key; entering an API key does not replace them automatically.\n\n```json\n{\n  \"feePayer\": \"<FEE_PAYER_AND_STAKE_AUTHORITY>\",\n  \"stakePubkey\": \"<PARENT_STAKE_ACCOUNT>\",\n  \"instructions\": [\n    {\n      \"type\": \"split\",\n      \"input\": {\n        \"authorizedPubkey\": \"<FEE_PAYER_AND_STAKE_AUTHORITY>\",\n        \"lamports\": \"1050000000\",\n        \"reference\": \"client-split-1\",\n        \"label\": \"Split child\"\n      }\n    }\n  ]\n}\n```\n\n- `authorizedPubkey` is the source account's stake authority and must sign.\n- `lamports` must be a positive base-10 integer **string**, without leading zeros, and must not exceed `9007199254740991`. The example moves 1.05 SOL; check the remaining delegation before using that amount.\n- `reference` and `label` are optional. Omitted metadata is inherited or defaulted by the service. A supplied parent label normally gains `\" (split)\"` when inherited; a blank parent can produce `\"Split stake\"`.\n- Supply an explicit child label to override inheritance. An empty string is accepted.\n\nExample success response, HTTP `201`:\n\n```json\n{\n  \"data\": {\n    \"serialized\": \"<HEX_ENCODED_V0_MESSAGE>\",\n    \"stakePubkey\": \"<NEW_CHILD_STAKE_ACCOUNT>\",\n    \"stakePubkeys\": [\"<NEW_CHILD_STAKE_ACCOUNT>\"],\n    \"signatures\": []\n  }\n}\n```\n\nThe request's `stakePubkey` identifies the parent. The response's `data.stakePubkeys` contains all new child addresses in instruction order; `data.stakePubkey` is the first child for backwards compatibility. The empty `signatures` array means no additional account signature is supplied by the gateway; it does not remove the caller's signing requirement.\n\nEach build can generate a different child address. Keep the returned address paired with the exact payload from that response. The new account exists on-chain only after the transaction is submitted and succeeds.\n\nDecode, sign, submit and confirm the returned message as described in **Signing and submitting stake transaction payloads** below.\n\n### Merge compatible stake accounts\n\nMerges the source account into a surviving destination account. The source account is closed when the transaction succeeds on-chain.\n\nThe top-level `stakePubkey` is the destination that survives. `input.sourceStakePubkey` is the source account that closes. `authorizedPubkey` is the stake authority and must sign.\n\nAccounts must have compatible stake and withdraw authorities, lockup settings and delegation state. Active-stake merges also require compatible validator and vote-credit state. Matching authorities alone does not establish eligibility.\n\nA child split from active stake inherits delegation history and can be merged back without waiting an additional epoch, provided the accounts remain compatible.\n\nThe example below uses the same address for the fee payer and stake authority. Replace every `<...>` placeholder with a real public key before submitting a request.\n\n```json\n{\n  \"feePayer\": \"<FEE_PAYER_AND_STAKE_AUTHORITY>\",\n  \"stakePubkey\": \"<SURVIVING_STAKE_ACCOUNT>\",\n  \"instructions\": [\n    {\n      \"type\": \"merge\",\n      \"input\": {\n        \"authorizedPubkey\": \"<FEE_PAYER_AND_STAKE_AUTHORITY>\",\n        \"sourceStakePubkey\": \"<STAKE_ACCOUNT_TO_CLOSE>\"\n      }\n    }\n  ]\n}\n```\n\nThe response's `data.stakePubkey` identifies the surviving destination. Decode, sign, submit and confirm the returned message as described in **Signing and submitting stake transaction payloads** below.\n\nThe stake-account listing may retain the source as `DISSOLVED` with its historical balance. Exclude that row when calculating current holdings.\n\n### Signing and submitting stake transaction payloads\n\n`data.serialized` is a hexadecimal-encoded Solana v0 **message**, not a serialized transaction including its signature envelope.\n\nFor all instruction types, construct a transaction using `@solana/web3.js` v1.x and restore any additional signatures supplied by the gateway:\n\n```js\nimport { MessageV0, PublicKey, VersionedTransaction } from '@solana/web3.js';\n\nconst message = MessageV0.deserialize(\n  Buffer.from(response.data.serialized, 'hex'),\n);\nconst transaction = new VersionedTransaction(message);\n\nfor (const { pubKey, signature } of response.data.signatures) {\n  transaction.addSignature(new PublicKey(pubKey), Buffer.from(signature, 'hex'));\n}\n```\n\nFor `create` and `createAndDelegate`, `data.signatures` contains the signature of the generated stake account. Keep it paired with the exact returned message and preserve it when adding your own signatures. Other examples return an empty array; the caller's required signatures must still be collected.\n\nUse your wallet or custody integration to sign the required message signers, submit the transaction to the matching Solana network, and confirm execution. Do not pass `data.serialized` directly to `VersionedTransaction.deserialize()`.\n\n### Current integration limitations\n\nThe examples each use one instruction per request. Split and merge requests involving undelegated or activating accounts may fail to build through the production gateway.\n\nBuilding a transaction can create a provisional `REQUESTED` record, including on some failed builds. A listing row is not proof of execution.\n\nInvalid split amounts and mixed split/non-split instruction types return HTTP `400`. Other invalid inputs or unsupported account states can surface as HTTP `500`. Verify the request fields and account state before rebuilding.",
        "operationId": "buildSolanaStakeTransactionPayload",
        "parameters": [
          {
            "name": "api-key",
            "in": "header",
            "description": "mavan api key",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/BuildTransactionPayloadRequestDto"
                  },
                  {
                    "anyOf": [
                      {
                        "required": [
                          "stakePubkey"
                        ]
                      },
                      {
                        "properties": {
                          "instructions": {
                            "not": {
                              "items": {
                                "properties": {
                                  "type": {
                                    "not": {
                                      "enum": [
                                        "create",
                                        "createAndDelegate"
                                      ]
                                    }
                                  }
                                }
                              }
                            },
                            "items": {
                              "properties": {
                                "type": {
                                  "not": {
                                    "enum": [
                                      "split",
                                      "merge"
                                    ]
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    ]
                  }
                ]
              },
              "examples": {
                "createAndDelegate": {
                  "summary": "Create and delegate a new stake account",
                  "description": "Replace every <...> placeholder with your own addresses on the selected network before using Try It. Your API key does not select these addresses automatically. Omit stakePubkey so the gateway generates a new account. The funding address and stake authority must sign; the fee payer is the funding address in this example.",
                  "value": {
                    "feePayer": "<FEE_PAYER_AND_FUNDING_ADDRESS>",
                    "instructions": [
                      {
                        "type": "createAndDelegate",
                        "input": {
                          "fromPubkey": "<FEE_PAYER_AND_FUNDING_ADDRESS>",
                          "stakeAuthority": "<STAKE_AUTHORITY>",
                          "withdrawAuthority": "<WITHDRAW_AUTHORITY>",
                          "lamports": "2000000000",
                          "reference": "client-create-and-delegate-1",
                          "label": "Delegated stake"
                        }
                      }
                    ]
                  }
                },
                "create": {
                  "summary": "Create a new stake account without delegating",
                  "description": "Replace every <...> placeholder with your own addresses on the selected network before using Try It. Your API key does not select these addresses automatically. Omit stakePubkey so the gateway generates a new account. The funding address must sign; the fee payer is the funding address in this example.",
                  "value": {
                    "feePayer": "<FEE_PAYER_AND_FUNDING_ADDRESS>",
                    "instructions": [
                      {
                        "type": "create",
                        "input": {
                          "fromPubkey": "<FEE_PAYER_AND_FUNDING_ADDRESS>",
                          "stakeAuthority": "<STAKE_AUTHORITY>",
                          "withdrawAuthority": "<WITHDRAW_AUTHORITY>",
                          "lamports": "2000000000",
                          "reference": "client-create-1",
                          "label": "New stake"
                        }
                      }
                    ]
                  }
                },
                "delegate": {
                  "summary": "Delegate an existing stake account",
                  "description": "Replace every <...> placeholder with your own eligible account and addresses on the selected network before using Try It. Your API key does not select these addresses automatically. The fee payer and stake authority are the same address in this example. Delegation uses the validator configured for the gateway.",
                  "value": {
                    "feePayer": "<FEE_PAYER_AND_STAKE_AUTHORITY>",
                    "stakePubkey": "<STAKE_ACCOUNT>",
                    "instructions": [
                      {
                        "type": "delegate",
                        "input": {
                          "authorizedPubkey": "<FEE_PAYER_AND_STAKE_AUTHORITY>"
                        }
                      }
                    ]
                  }
                },
                "undelegate": {
                  "summary": "Deactivate an existing stake account",
                  "description": "Replace every <...> placeholder with your own eligible account and addresses on the selected network before using Try It. Your API key does not select these addresses automatically. The fee payer and stake authority are the same address in this example. Deactivation does not immediately make all stake available to withdraw.",
                  "value": {
                    "feePayer": "<FEE_PAYER_AND_STAKE_AUTHORITY>",
                    "stakePubkey": "<STAKE_ACCOUNT>",
                    "instructions": [
                      {
                        "type": "undelegate",
                        "input": {
                          "authorizedPubkey": "<FEE_PAYER_AND_STAKE_AUTHORITY>"
                        }
                      }
                    ]
                  }
                },
                "withdraw": {
                  "summary": "Withdraw available inactive stake",
                  "description": "Replace every <...> placeholder with your own eligible account and addresses on the selected network before using Try It. Your API key does not select these addresses automatically. The fee payer and withdraw authority are the same address in this example. Supply lamports as a JSON number and choose an amount currently available to withdraw.",
                  "value": {
                    "feePayer": "<FEE_PAYER_AND_WITHDRAW_AUTHORITY>",
                    "stakePubkey": "<STAKE_ACCOUNT>",
                    "instructions": [
                      {
                        "type": "withdraw",
                        "input": {
                          "toPubkey": "<WITHDRAWAL_RECIPIENT>",
                          "authorizedPubkey": "<FEE_PAYER_AND_WITHDRAW_AUTHORITY>",
                          "lamports": 1000000000
                        }
                      }
                    ]
                  }
                },
                "authorize": {
                  "summary": "Change an existing stake account authority",
                  "description": "Replace every <...> placeholder with your own account and addresses on the selected network before using Try It. Your API key does not select these addresses automatically. This example changes the stake authority (0); use 1 to change the withdraw authority. The current authority must sign; it is also the fee payer in this example.",
                  "value": {
                    "feePayer": "<FEE_PAYER_AND_CURRENT_AUTHORITY>",
                    "stakePubkey": "<STAKE_ACCOUNT>",
                    "instructions": [
                      {
                        "type": "authorize",
                        "input": {
                          "authorizedPubkey": "<FEE_PAYER_AND_CURRENT_AUTHORITY>",
                          "newAuthorizedPubkey": "<NEW_AUTHORITY>",
                          "stakeAuthorizationType": 0
                        }
                      }
                    ]
                  }
                },
                "split": {
                  "summary": "Split an active stake account",
                  "description": "Replace every <...> placeholder with your own eligible accounts on the selected network before using Try It. Your API key does not select these addresses automatically. The fee payer and stake authority are the same address in this example. Choose a split amount that is valid for the parent balance.",
                  "value": {
                    "feePayer": "<FEE_PAYER_AND_STAKE_AUTHORITY>",
                    "stakePubkey": "<PARENT_STAKE_ACCOUNT>",
                    "instructions": [
                      {
                        "type": "split",
                        "input": {
                          "authorizedPubkey": "<FEE_PAYER_AND_STAKE_AUTHORITY>",
                          "lamports": "1050000000",
                          "reference": "client-split-1",
                          "label": "Split child"
                        }
                      }
                    ]
                  }
                },
                "merge": {
                  "summary": "Merge two or more existing stake accounts",
                  "description": "Replace every <...> placeholder with your own eligible accounts on the selected network before using Try It. Your API key does not select these addresses automatically. The source closes and the top-level stakePubkey survives. The accounts must be compatible for merging.",
                  "value": {
                    "feePayer": "<FEE_PAYER_AND_STAKE_AUTHORITY>",
                    "stakePubkey": "<SURVIVING_STAKE_ACCOUNT>",
                    "instructions": [
                      {
                        "type": "merge",
                        "input": {
                          "authorizedPubkey": "<FEE_PAYER_AND_STAKE_AUTHORITY>",
                          "sourceStakePubkey": "<STAKE_ACCOUNT_TO_CLOSE>"
                        }
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Transaction message built successfully. The caller must sign, submit and confirm it.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiResponseBase"
                    },
                    {
                      "properties": {
                        "data": {
                          "$ref": "#/components/schemas/BuildTransactionPayloadResponseDto"
                        }
                      }
                    }
                  ],
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        },
        "servers": [
          {
            "url": "https://api.mavan.bitminetech.io",
            "description": "Mainnet (Solana mainnet-beta)"
          },
          {
            "url": "https://testnetapi.mavan.bitminetech.io",
            "description": "Devnet (MAVAN testnet gateway)"
          }
        ],
        "summary": "Generate a Solana stake transaction payload",
        "tags": [
          "Solana"
        ]
      }
    }
  },
  "info": {
    "title": "MAVAN Staking API",
    "description": "The MAVAN Staking API Docs",
    "version": "1.0.181-main-mainnet",
    "contact": {}
  },
  "servers": [
    {
      "url": "https://gw-1.api.standardvalidator.com"
    }
  ],
  "components": {
    "schemas": {
      "ApiResponseBase": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string"
          }
        }
      },
      "SolanaTransactionSignature": {
        "type": "object",
        "properties": {
          "pubKey": {
            "type": "string"
          },
          "secretKey": {
            "type": "string",
            "description": "secret key of signer, only present for stake creation where keypair is ephemeral"
          },
          "signature": {
            "type": "string"
          }
        },
        "required": [
          "pubKey",
          "signature"
        ]
      },
      "BuildTransactionPayloadResponseDto": {
        "type": "object",
        "properties": {
          "serialized": {
            "type": "string",
            "example": "800200080ac6f91611c...080900040200000000",
            "description": "Hexadecimal-encoded Solana v0 message. Deserialize the message and construct a versioned transaction before signing."
          },
          "stakePubkey": {
            "type": "string",
            "example": "8Htve3nXPsvXk88WrJHH6nQBQCjw4bSCJLuEpT6ArfMY",
            "description": "New account address for create or split; surviving destination for merge; otherwise the account targeted by the instruction."
          },
          "stakePubkeys": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Addresses of all destination stake accounts created by split instructions, in instruction order."
          },
          "signatures": {
            "example": [
              {
                "pubKey": "6V2Lfg1jvanitWUKWRDLTrWvbHvsMMbRuhQ3CTKY1FAq",
                "signature": "2bfb03d5ce6263ba0f...7a24b6d00c4682c04"
              }
            ],
            "description": "Additional signatures supplied by the gateway. An empty array does not mean that the caller's signatures are unnecessary.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SolanaTransactionSignature"
            }
          }
        },
        "required": [
          "serialized",
          "signatures"
        ]
      },
      "CreateSolanaStakeInstructionDto": {
        "type": "object",
        "properties": {
          "fromPubkey": {
            "type": "string",
            "example": "<FEE_PAYER_AND_FUNDING_ADDRESS>",
            "description": "Public key of the funding address. Must sign the transaction."
          },
          "stakeAuthority": {
            "type": "string",
            "example": "<STAKE_AUTHORITY>",
            "description": "address authorized to delegate stake"
          },
          "withdrawAuthority": {
            "type": "string",
            "example": "<WITHDRAW_AUTHORITY>",
            "description": "address authorized to withdraw stake"
          },
          "lamports": {
            "type": "string",
            "example": "2000000000",
            "description": "Total lamports to fund the new account, including its rent reserve, encoded as a decimal string. One SOL equals 1,000,000,000 lamports."
          },
          "reference": {
            "type": "string",
            "example": "Customer Fund 1",
            "description": "an arbitrary reference used to identify/group the stake"
          },
          "label": {
            "type": "string",
            "example": "100 Sol Stake for customer A",
            "description": "an arbitrary label/memo"
          }
        },
        "required": [
          "fromPubkey",
          "stakeAuthority",
          "withdrawAuthority",
          "lamports",
          "reference",
          "label"
        ]
      },
      "DelegateOrUndelegateSolanaStakeInstructionDto": {
        "type": "object",
        "properties": {
          "authorizedPubkey": {
            "type": "string",
            "example": "<FEE_PAYER_AND_STAKE_AUTHORITY>",
            "description": "Stake account's stake authority. Must sign the transaction."
          }
        },
        "required": [
          "authorizedPubkey"
        ]
      },
      "WithdrawSolanaStakeInstructionDto": {
        "type": "object",
        "properties": {
          "toPubkey": {
            "type": "string",
            "example": "<WITHDRAWAL_RECIPIENT>",
            "description": "pubkey of receiving address"
          },
          "authorizedPubkey": {
            "type": "string",
            "example": "<FEE_PAYER_AND_WITHDRAW_AUTHORITY>",
            "description": "Stake account's withdraw authority. Must sign the transaction."
          },
          "lamports": {
            "type": "number",
            "example": 1000000000,
            "description": "Amount of available lamports to withdraw, encoded as a JSON number. One SOL equals 1,000,000,000 lamports."
          }
        },
        "required": [
          "toPubkey",
          "authorizedPubkey",
          "lamports"
        ]
      },
      "AuthorizeSolanaStakeInstructionDto": {
        "type": "object",
        "properties": {
          "authorizedPubkey": {
            "type": "string",
            "example": "<FEE_PAYER_AND_CURRENT_AUTHORITY>",
            "description": "Current authority address for the authority type being changed. Must sign the transaction."
          },
          "newAuthorizedPubkey": {
            "type": "string",
            "example": "<NEW_AUTHORITY>",
            "description": "new authority address"
          },
          "stakeAuthorizationType": {
            "type": "number",
            "example": 0,
            "description": "the authority type to change (0 for stake authority, 1 for withdraw authority)"
          }
        },
        "required": [
          "authorizedPubkey",
          "newAuthorizedPubkey",
          "stakeAuthorizationType"
        ]
      },
      "SplitSolanaStakeInstructionDto": {
        "type": "object",
        "properties": {
          "authorizedPubkey": {
            "type": "string",
            "description": "Source account's stake authority. Must sign the transaction.",
            "example": "<FEE_PAYER_AND_STAKE_AUTHORITY>"
          },
          "lamports": {
            "type": "string",
            "pattern": "^(?:[1-9][0-9]{0,14}|[1-8][0-9]{15}|900[0-6][0-9]{12}|90070[0-9]{11}|90071[0-8][0-9]{10}|900719[0-8][0-9]{9}|9007199[0-1][0-9]{8}|90071992[0-4][0-9]{7}|900719925[0-3][0-9]{6}|9007199254[0-6][0-9]{5}|90071992547[0-3][0-9]{4}|9007199254740[0-8][0-9]{2}|90071992547409[0-8][0-9]{1}|9007199254740990|9007199254740991)$",
            "example": "1050000000",
            "description": "Positive integer amount in lamports, encoded as a base-10 string without leading zeros and not exceeding 9007199254740991. One SOL equals 1,000,000,000 lamports. The new account rent reserve is funded separately by authorizedPubkey (the stake authority).",
            "maxLength": 16
          },
          "reference": {
            "type": "string",
            "description": "Optional child reference. When omitted, inherited or defaulted by the service.",
            "maxLength": 300
          },
          "label": {
            "type": "string",
            "description": "Optional child label. Supply a value, including an empty string, to override inheritance. When omitted, the service normally appends \" (split)\" to a parent label or uses \"Split stake\" for a blank parent.",
            "maxLength": 300
          }
        },
        "required": [
          "authorizedPubkey",
          "lamports"
        ]
      },
      "MergeSolanaStakeInstructionDto": {
        "type": "object",
        "properties": {
          "sourceStakePubkey": {
            "type": "string",
            "description": "Source stake account to close. The top-level stakePubkey is the destination that survives.",
            "example": "<STAKE_ACCOUNT_TO_CLOSE>"
          },
          "authorizedPubkey": {
            "type": "string",
            "description": "Stake authority. Must sign the transaction.",
            "example": "<FEE_PAYER_AND_STAKE_AUTHORITY>"
          }
        },
        "required": [
          "sourceStakePubkey",
          "authorizedPubkey"
        ]
      },
      "BuildTransactionPayloadRequestDto": {
        "type": "object",
        "properties": {
          "feePayer": {
            "type": "string",
            "example": "<FEE_PAYER_AND_FUNDING_ADDRESS>",
            "description": "Public key of the wallet paying transaction fees. Must sign the transaction. Creation is funded by input.fromPubkey; for split, the child rent reserve is funded by input.authorizedPubkey. Replace the placeholder with your address on the selected network. Your API key does not select this address automatically."
          },
          "stakePubkey": {
            "type": "string",
            "example": "<STAKE_ACCOUNT>",
            "description": "Required for instructions operating on an existing stake account. Replace the placeholder with a real stake-account public key associated with your API credentials on the selected network. For split, the source parent account. For merge, the destination account that survives. This is a stake-account address, not the fee payer wallet address."
          },
          "instructions": {
            "type": "array",
            "minItems": 1,
            "description": "Staking instructions to build. Supply one split instruction per destination account; split instructions cannot be combined with other instruction types.",
            "example": [
              {
                "type": "createAndDelegate",
                "input": {
                  "fromPubkey": "<FEE_PAYER_AND_FUNDING_ADDRESS>",
                  "stakeAuthority": "<STAKE_AUTHORITY>",
                  "withdrawAuthority": "<WITHDRAW_AUTHORITY>",
                  "lamports": "2000000000",
                  "reference": "client-create-and-delegate-1",
                  "label": "Delegated stake"
                }
              }
            ],
            "items": {
              "oneOf": [
                {
                  "title": "Create and delegate",
                  "type": "object",
                  "required": [
                    "type",
                    "input"
                  ],
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "createAndDelegate"
                      ]
                    },
                    "input": {
                      "$ref": "#/components/schemas/CreateSolanaStakeInstructionDto"
                    }
                  }
                },
                {
                  "title": "Create",
                  "type": "object",
                  "required": [
                    "type",
                    "input"
                  ],
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "create"
                      ]
                    },
                    "input": {
                      "$ref": "#/components/schemas/CreateSolanaStakeInstructionDto"
                    }
                  }
                },
                {
                  "title": "Delegate",
                  "type": "object",
                  "required": [
                    "type",
                    "input"
                  ],
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "delegate"
                      ]
                    },
                    "input": {
                      "$ref": "#/components/schemas/DelegateOrUndelegateSolanaStakeInstructionDto"
                    }
                  }
                },
                {
                  "title": "Undelegate",
                  "type": "object",
                  "required": [
                    "type",
                    "input"
                  ],
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "undelegate"
                      ]
                    },
                    "input": {
                      "$ref": "#/components/schemas/DelegateOrUndelegateSolanaStakeInstructionDto"
                    }
                  }
                },
                {
                  "title": "Withdraw",
                  "type": "object",
                  "required": [
                    "type",
                    "input"
                  ],
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "withdraw"
                      ]
                    },
                    "input": {
                      "$ref": "#/components/schemas/WithdrawSolanaStakeInstructionDto"
                    }
                  }
                },
                {
                  "title": "Authorize",
                  "type": "object",
                  "required": [
                    "type",
                    "input"
                  ],
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "authorize"
                      ]
                    },
                    "input": {
                      "$ref": "#/components/schemas/AuthorizeSolanaStakeInstructionDto"
                    }
                  }
                },
                {
                  "title": "Split",
                  "type": "object",
                  "required": [
                    "type",
                    "input"
                  ],
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "split"
                      ]
                    },
                    "input": {
                      "$ref": "#/components/schemas/SplitSolanaStakeInstructionDto"
                    }
                  }
                },
                {
                  "title": "Merge",
                  "type": "object",
                  "required": [
                    "type",
                    "input"
                  ],
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "merge"
                      ]
                    },
                    "input": {
                      "$ref": "#/components/schemas/MergeSolanaStakeInstructionDto"
                    }
                  }
                }
              ]
            }
          }
        },
        "description": "For an existing-account operation, supply stakePubkey. Without it, at least one create or createAndDelegate instruction is required. Split and merge always require stakePubkey.",
        "required": [
          "feePayer",
          "instructions"
        ]
      }
    }
  }
}
````