Getting Started

The staking process for Polkadot in the Staking API with a public node consists of several main steps:

  1. Submit Bond: Submit a bond to the Polkadot network. It's important to note that there is a dynamic minimum threshold to stake.
  2. Submit Nomination: The process of selecting validators within the Polkadot network.

Get an authentication token to start using Staking API. While staking, it's essential to keep a minimum deposit of 1 DOT on the account.

A request example is provided using cURL.

1. Submit Bond

  1. Send a POST request to /api/v1/polkadot/{network}/staking/bond.

    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": "5H6ryBWChC5w7eaQ4GZjo329sEnhvjetSr6MBEt42mZ5tPw5",
      "rewardDestinationType": "account",
      "rewardDestination": "5H6ryBWChC5w7eaQ4GZjo329sEnhvjetSr6MBEt42mZ5tPw5",
      "amount": 3
    }'
    
    • stashAccountAddress — main stash account address which keeps tokens for bonding.

    • rewardDestinationType — rewards destination type:

      • staked — Rewards will be sent to your Stash account and added to your current bond (compounding rewards).
      • stash — Rewards will be sent to your Stash account as a transferrable balance (not compounding rewards).
      • account — Rewards will be sent to any account you specify 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.

    Example response:

    {
      "result": {
        "unsignedTransaction": "0xac0406000b00487835a302032c6eca5cdaa3e87d7f8e06d10015bf0508b52d301c8991af113d5cf49a53553f",
        "stashAccountAddress": "5H6ryBWChC5w7eaQ4GZjo329sEnhvjetSr6MBEt42mZ5tPw5",
        "rewardDestinationType": "account",
        "rewardDestination": "5H6ryBWChC5w7eaQ4GZjo329sEnhvjetSr6MBEt42mZ5tPw5",
        "amount": 3,
        "createdAt": "2023-08-15T15:07:54.795Z"
      }
    }
    
    • 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.

    • rewardDestinationType — rewards destination type:

      • staked — Rewards will be sent to your Stash account and added to your current bond (compounding rewards).
      • stash — Rewards will be sent to your Stash account as a transferrable balance (not compounding rewards).
      • account — Rewards will be sent to any account you specify 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.

  2. Sign and broadcast unsignedTransaction to the Polkadot network.

2. Submit Nomination

  1. Send a POST request to /api/v1/polkadot/{network}/staking/nominate.

    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"
    }'
    
    • stashAccountAddress — main stash account address which keeps tokens for bonding.

    Example response:

    {
      "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 — selected validators in the targets.
    • createdAt — timestamp of the transaction in the ISO 8601 format.
  2. Sign and broadcast unsignedTransaction to the Polkadot network.

What's Next?