Getting Started
There are two ways to start staking on the Polkadot network using the Staking API with a public node:
- Stake directly.
- Stake via a nomination pool.
Get an authentication token to start using Staking API. For staking, it is essential to keep a minimum deposit of 1 DOT on the account.
A request example is provided using cURL.
Staking directly
1. Create Bond Request
-
Send a POST request to /api/v1/polkadot/{network}/staking/bond. Note that there is a dynamic minimum threshold to stake.
Example request (for
westend
network):curl --request POST \ --url https://api.p2p.org/api/v1/polkadot/westend/staking/bond \ --header 'accept: application/json' \ --header 'authorization: Bearer <token>' \ --header 'content-type: application/json' \ --data ' { "stashAccountAddress": "5HdzgJMcKFwCeiso1izCWGLyVLk9YFztVFjK4rCadNXz6ztE", "rewardDestinationType": "account", "rewardDestination": "5HdzgJMcKFwCeiso1izCWGLyVLk9YFztVFjK4rCadNXz6ztE", "amount": 1, "extended": true }'
-
stashAccountAddress
— main stash account address which keeps tokens for bonding. -
rewardDestinationType
— rewards destination type:staked
— rewards will be sent to the stash account and added to the current bond (compounding rewards).stash
— rewards will be sent to the stash account as a transferrable balance (not compounding rewards).
-
account
— rewards will be sent to any account specified as a transferrable balance. -
rewardDestination
— rewards destination account address. -
amount
— amount of tokens to bond. DOT is used for the main network, KSM for Kusama, and WND for Westend. -
extended
— optional boolean parameter (true
orfalse
) indicating whether to include additional metadata in the response. This information may be crucial for integrating with custodial platforms, offline signers, or advanced transaction builders.
Example response (for
extended
parameter set totrue
):{ "result": { "unsignedTransaction": "0xa8040600070010a5d4e803f690e412f0f0d6a963b89e78f9f44015c8909b2ee57836fff9a739e56897d51b", "unsignedTransactionSerialized": "7b2261646472657373223a223548647a67....", "unsignedTransactionPayload": "0x0600070010a5d4e803f690e412f0f0d6a963b89e78f9f44015c8909b2ee57836fff9a739e56897d51b", "unsignedTransactionObject": { "blockHash": "0xe9ee44203904ee47859882a6944bb9cb57a28a21146d699f0f731076f3beffe2", "eraPeriod": 64, "genesisHash": "0xe143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e", "metadataRpc": "0x6d6574610e150f000c1c73705f636f72...", "method": { "args": { "value": "1,000,000,000,000", "payee": { "Account": "5HdzgJMcKFwCeiso1izCWGLyVLk9YFztVFjK4rCadNXz6ztE" } }, "method": "bond", "section": "staking" }, "nonce": 1, "specVersion": 1018001, "transactionVersion": 27, "tip": 0 }, "stashAccountAddress": "5HdzgJMcKFwCeiso1izCWGLyVLk9YFztVFjK4rCadNXz6ztE", "rewardDestinationType": "account", "rewardDestination": "5HdzgJMcKFwCeiso1izCWGLyVLk9YFztVFjK4rCadNXz6ztE", "amount": 1, "createdAt": "2025-04-02T15:38:35.826Z" } }
-
unsignedTransaction
— unsigned transaction in the hexadecimal format. Sign the transaction and submit it to the blockchain to perform the called action. -
unsignedTransactionSerialized
— unsigned serialized transaction. -
unsignedTransactionObject
— full decoded transaction structure with all metadata:blockHash
— hash of the checkpoint block in which the transaction was included.eraPeriod
— validity period of the transaction, representing the number of blocks after the checkpoint for which the transaction is valid.currentEra
— current staking era of the transaction.genesisHash
— hash of the genesis block.metadataRpc
— serialized metadata used for offline decoding and transaction signing.method
is the list of data fields containing information on the method called to construct a transaction.nonce
— nonce of the transaction.specVersion
— current version of the chain specification for the runtime.transactionVersion
— current version of the transaction format.tip
— optional fee used to increase the transaction priority.
-
stashAccountAddress
— main stash account address which keeps tokens for bonding. -
rewardDestinationType
— rewards destination type:staked
— rewards will be sent to the stash account and added to the current bond (compounding rewards).stash
— rewards will be sent to the stash account as a transferrable balance (not compounding rewards).account
— rewards will be sent to any account specified as a transferrable balance.
-
rewardDestination
— rewards destination account address. -
amount
— amount of tokens to bond. DOT is used for the main network, KSM for Kusama, and WND for Westend. -
createdAt
— timestamp of the transaction in the ISO 8601 format.
-
-
Sign and broadcast the
unsignedTransaction
to the Polkadot network.
2. Create Nomination Request
-
Send a POST request to /api/v1/polkadot/{network}/staking/nominate to select validators within the Polkadot network.
Example request (for
westend
network):curl --request POST \ --url https://api.p2p.org/api/v1/polkadot/westend/staking/nominate \ --header 'accept: application/json' \ --header 'authorization: Bearer <token>' \ --header 'content-type: application/json' \ --data ' { "stashAccountAddress": "5H6ryBWChC5w7eaQ4GZjo329sEnhvjetSr6MBEt42mZ5tPw5", "extended": false }'
stashAccountAddress
— main stash account address which keeps tokens for bonding.extended
— optional boolean parameter (true
orfalse
) indicating whether to include additional metadata in the response.
Example response (for
extended
request parameter set tofalse
):{ "result": { "unsignedTransaction": "0x2102040605100096b33e0a9647f13198ad16a2812c549a363646a3a7ddbdcc5590f5839c408c6200767f36484b1e2acf5c265c7a64bfb46e95259c66a8189bbcd216195def43685200c21ad1e5198cc0dc3b0f9f43a50f292678f63235ea321e59385d7ee45a7208360018164fa6f9ce28792fb781185e8de4e6eaae34c0f545e5864952fe23c183df0c", "stashAccountAddress": "5H6ryBWChC5w7eaQ4GZjo329sEnhvjetSr6MBEt42mZ5tPw5", "targets": [ "5FUJHYEzKpVJfNbtXmR9HFqmcSEz6ak7ZUhBECz7GpsFkSYR", "5Ek5JCnrRsyUGYNRaEvkufG1i1EUxEE9cytuWBBjA9oNZVsf", "5GTD7ZeD823BjpmZBCSzBQp7cvHR1Gunq7oDkurZr9zUev2n", "5CcHdjf6sPcEkTmXFzF2CfH7MFrVHyY5PZtSm1eZsxgsj1KC" ], "createdAt": "2023-09-18T14:49:23.998Z" } }
unsignedTransaction
— unsigned transaction in hex format. Sign the transaction and submit it to the blockchain to perform the called action.stashAccountAddress
— main stash account address which keeps tokens for bonding.targets
— addresses of validators selected in the targets.createdAt
— timestamp of the transaction in the ISO 8601 format.
-
Sign and broadcast the
unsignedTransaction
to the Polkadot network.
3. Add Proxy Account — optional step
It is possible to add a staking proxy to utilize the main stash account less frequently. It allows delegating your staking rights to another account, which can then sign transactions on your behalf. The original account retains all of its rights, and the proxy account can be removed at any time.
-
Send a POST request to /api/v1/polkadot/{network}/account/add.
Example request (for
westend
network):curl --request POST \ --url https://api.p2p.org/api/v1/polkadot/westend/account/add \ --header 'accept: application/json' \ --header 'authorization: Bearer <token>' \ --header 'content-type: application/json' \ --data ' { "stashAccountAddress": "5H6ryBWChC5w7eaQ4GZjo329sEnhvjetSr6MBEt42mZ5tPw5", "proxyAccountAddress": "5Ggpg3JepXM3ZrktNpoc5QA1sKaFVpUPWMRr7jppiMxTuU75", "extended": false }'
stashAccountAddress
— main stash account address which keeps tokens for bonding; a proxied address that transfers rights to a proxy account.proxyAccountAddress
— address that receives rights from the proxied account.extended
— optional boolean parameter (true
orfalse
) indicating whether to include additional metadata.
Example response (for
extended
request parameter set tofalse
):{ "result": { "unsignedTransaction": "0xa404160100cc7cb7325ad1208212e2d8ee41a7572e816d53ac1bcac1be5df433486819213c0200000000", "createdAt": "2023-09-18T14:49:23.998Z" } }
unsignedTransaction
— unsigned transaction in hex format. Sign the transaction and submit it to the blockchain to perform the called action.createdAt
— timestamp of the transaction in the ISO 8601 format.
-
Sign and broadcast the
unsignedTransaction
to the Polkadot network.
Staking via a nomination pool
1. Create Bond Request
-
Create a bond request by sending a POST request to /api/v1/polkadot/{network}/staking/pool/bond. The P2P.org pool ID on Polkadot mainnet is 238.
Example request (for
westend
network):curl --request POST \ --url https://api.p2p.org/api/v1/polkadot/westend/staking/pool/bond \ --header 'accept: application/json' \ --header 'authorization: Bearer <token>' \ --header 'content-type: application/json' \ --data ' { "stashAccountAddress": "5H6ryBWChC5w7eaQ4GZjo329sEnhvjetSr6MBEt42mZ5tPw5", "poolId": 238, "amount": 3, "extended": true }'
-
stashAccountAddress
— main stash account address which keeps tokens for bonding. -
poolId
— ID of the nomination pool. -
amount
— amount of tokens to bond. DOT is used for the main network, KSM for Kusama, and WND for Westend. -
extended
— optional boolean parameter (true
orfalse
) indicating whether to include additional metadata in the response. This information may be crucial for integrating with custodial platforms, offline signers, or advanced transaction builders.
Example response (for
extended
parameter set totrue
):{ "result": { "unsignedTransaction": "0xac0406000b00487835a302032c6eca5cdaa3e87d7f8e06d10015bf0508b52d301c8991af113d5cf49a53553f", "unsignedTransactionSerialized": "7b2261646472657373223a223548647a67....", "unsignedTransactionPayload": "0x0600070010a5d4e803f690e412f0f0d6a963b89e78f9f44015c8909b2ee57836fff9a739e56897d51b", "unsignedTransactionObject": { "blockHash": "0xe9ee44203904ee47859882a6944bb9cb57a28a21146d699f0f731076f3beffe2", "eraPeriod": 64, "genesisHash": "0xe143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e", "metadataRpc": "0x6d6574610e150f000c1c73705f636f72...", "method": { "args": { "value": "3,000,000,000,000", "payee": { "Account": "5HdzgJMcKFwCeiso1izCWGLyVLk9YFztVFjK4rCadNXz6ztE" } }, "method": "bond", "section": "staking" }, "nonce": 1, "specVersion": 1018001, "transactionVersion": 27, "tip": 0 }, "stashAccountAddress": "5HdzgJMcKFwCeiso1izCWGLyVLk9YFztVFjK4rCadNXz6ztE", "rewardDestinationType": "account", "rewardDestination": "5HdzgJMcKFwCeiso1izCWGLyVLk9YFztVFjK4rCadNXz6ztE", "amount": 3, "createdAt": "2025-04-02T15:38:35.826Z" } }
-
unsignedTransaction
— unsigned transaction in the hexadecimal format. Sign the transaction and submit it to the blockchain to perform the called action. -
unsignedTransactionSerialized
— unsigned serialized transaction. -
unsignedTransactionObject
— full decoded transaction structure with all metadata:blockHash
— hash of the checkpoint block in which the transaction was included.eraPeriod
— validity period of the transaction, representing the number of blocks after the checkpoint for which the transaction is valid.currentEra
— current staking era of the transaction.genesisHash
— hash of the genesis block.metadataRpc
— serialized metadata used for offline decoding and transaction signing.method
is the list of data fields containing information on the method called to construct a transaction.nonce
— nonce of the transaction.specVersion
— current version of the chain specification for the runtime.transactionVersion
— current version of the transaction format.tip
— optional fee used to increase the transaction priority.
-
stashAccountAddress
— main stash account address which keeps tokens for bonding. -
rewardDestinationType
— rewards destination type:staked
— rewards will be sent to the stash account and added to the current bond (compounding rewards).stash
— rewards will be sent to the stash account as a transferrable balance (not compounding rewards).account
— rewards will be sent to any account specified as a transferrable balance.
-
rewardDestination
— rewards destination account address. -
amount
— amount of tokens to bond. DOT is used for the main network, KSM for Kusama, and WND for Westend. -
createdAt
— timestamp of the transaction in the ISO 8601 format.
-
-
Sign and broadcast the
unsignedTransaction
to the Polkadot network.
2. Create Set Permission Request
-
Grant permission to the pool for managing rewards on your behalf by sending a POST request to api/v1/polkadot/{network}/staking/pool/set-claim-permission.
Example request (for
westend
network):curl --request POST \ --url https://api.p2p.org/api/v1/polkadot/westend/staking/pool/set-claim-permission \ --header 'accept: application/json' \ --header 'authorization: Bearer <token>' \ --header 'content-type: application/json' \ --data ' { "stashAccountAddress": "5H6ryBWChC5w7eaQ4GZjo329sEnhvjetSr6MBEt42mZ5tPw5", "permission": "PermissionlessAll", "extended": false } '
-
stashAccountAddress
— main stash account address which keeps tokens for bonding. -
permission
— state of the permission to grant:Permissioned
— only you can claim, bond or withdraw rewards. If this level of permission is set, an additional Claiming Payout request is needed.PermissionlessCompound
— compounding of rewards (claim and then bond) on your behalf is permitted.PermissionlessWithdraw
— withdrawing of rewards (claim and then keep as a free balance) on your behalf is permitted.PermissionlessAll
— claiming, bonding and withdrawing rewards on your behalf are permitted.
-
extended
— optional boolean parameter (true
orfalse
) indicating whether to include additional metadata in the response.
Example response:
{ "result": { "unsignedTransaction": "0xa404160200165874de804160c3cd013d9b6f4bba864657c4c2168a542f78ff14a0253873190200000000", "createdAt": "2023-08-24T08:23:18.830Z" }, "error": {} }
-
-
unsignedTransaction
— unsigned transaction in hex format. Sign the transaction and submit it to the blockchain to perform the called action. -
createdAt
— timestamp of the transaction in the ISO 8601 format.
- Sign and broadcast the
unsignedTransaction
to the Polkadot network.
3. Create Claim Payout Request
Unlike direct staking, after the rewards is distributed to the nomination pool by a validator, each pool member has to claim their part manually. Since that, to bond, compound or withdraw your rewards, you may need to perform an additional claiming payout request.
Whether it is required depends on the claim rewards permissions you set in the step 2:
- For
PermissionlessAll
, the step is optional. - For
Permissioned
, the step is necessary, as you are the only who can claim the rewards. - For
PermissionlessCompound
andPermissionlessWithdraw
, the step is required if you want to withdraw and compound your rewards accordingly.
To create claim payout request:
-
Send a POST request to /api/v1/polkadot/{network}/staking/pool/claim-payout.
Example request (for
westend
network):curl --request POST \ --url https://api.p2p.org/api/v1/polkadot/westend/staking/pool/claim-payout \ --header 'accept: application/json' \ --header 'authorization: Bearer <token>' \ --header 'content-type: application/json' \ --data ' { "stashAccountAddress": "5H6ryBWChC5w7eaQ4GZjo329sEnhvjetSr6MBEt42mZ5tPw5", "extended": false }'
stashAccountAddress
— main stash account address which keeps tokens for bonding.extended
— optional boolean parameter (true
orfalse
) indicating whether to include additional metadata in the response.
Example response:
{ "result": { "unsignedTransaction": "0xa404160100cc7cb7325ad1208212e2d8ee41a7572e816d53ac1bcac1be5df433486819213c0200000000", "createdAt": "2023-08-24T08:23:18.830Z" } }
unsignedTransaction
— unsigned transaction in hex format. Sign the transaction and submit it to the blockchain to perform the called action.createdAt
— timestamp of the transaction in the ISO 8601 format.
-
Sign and broadcast the
unsignedTransaction
to the Polkadot network.
What's Next?
- Staking API reference.
- Withdrawal.
Updated 13 days ago