The Allnodes API generates serialized unsigned transactions. To send a transaction to the network, you will need experience with @polkadot/api:

https://polkadot.js.org/docs/api

In every HTTP request of the Allnodes API, you need to specify your API key via an HTTP header: Authorization: Bearer <YOUR_API_KEY>


Polkadot API documentation: https://docs.allnodes.com/dot/staking


How to get an API key:

  1. Register an account here: https://www.allnodes.com

  2. Go to the settings of your account: https://www.allnodes.com/settings

  3. Open the API tab.

  4. Click on the "Enable API" button.

  5. Save the "Read and Write API Key" and "Read-Only API Key" in a safe place.


How to Stake

  1. You will need to bond your coins and prepare two addresses: one for the stash and one for the controller. You need at least 10.1 DOT in the stash account and a small balance on the controller account. Also, you need to choose one of the options for payment (rewards) destinations:

    • stash-reinvest - your stash account with compounding rewards;

    • stash-save - your stash account;

    • controller - your controller account.

    If you have bonded coins already, go to step 4.
    If you want to bond extra coins, go to the "Bond extra coins" section.

  2. Send an HTTP POST request to the URL https://www.allnodes.com/api/v1/staking with the following json body:

    {
    "address": "<YOUR_STASH_ADDRESS>",
    "controller": "<YOUR_CONTROLLER_ADDRESS>",
    "payee": "stash-reinvest" | "stash-save" | "controller",
    "amount": "<DOT_AMOUNT_TO_BOND>",
    "currencySymbol": "DOT",
    "action": "initial-bond"
    }


    Example:

    curl --location --request POST 'https://www.allnodes.com/api/v1/staking' \
    --header 'Authorization: Bearer <YOUR_API_KEY>' \
    --header 'Content-Type: application/json' \
    --data-raw '{
    "address": "<YOUR_STASH_ADDRESS>",
    "controller": "<YOUR_CONTROLLER_ADDRESS>",
    "payee": "stash-reinvest" | "stash-save" | "controller",
    "amount": "<DOT_AMOUNT_TO_STAKE>",
    "currencySymbol": "DOT",
    "action": "initial-bond"
    }'

    The response to your request contains:

    • serializedTransaction - sign it with your stash account and send this transaction to the network using @polkadot/api.

  3. You have successfully bonded your coins! Now you need to nominate validators (up to 16 unique addresses).

  4. Send an HTTP POST request to the URL https://www.allnodes.com/api/v1/staking with the following json body:

    {
    "address": "<YOUR_STASH_ADDRESS>",
    "validators": ["<VALIDATOR_ADDRESS_1>", "VALIDATOR_ADDRESS_2", …, "VALIDATOR_ADDRESS_N"],
    "currencySymbol": "DOT",
    "action": "nominate"
    }

    Example:

    curl --location --request POST 'https://www.allnodes.com/api/v1/staking' \
    --header 'Authorization: Bearer <YOUR_API_KEY>' \
    --header 'Content-Type: application/json' \
    --data-raw '{
    "address": "<YOUR_STASH_ADDRESS>",
    "validators": ["<VALIDATOR_ADDRESS_1>", "VALIDATOR_ADDRESS_2", …, "VALIDATOR_ADDRESS_N"],
    "currencySymbol": "DOT",
    "action": "nominate"
    }'

    The response to your request contains:
    serializedTransaction - sign it with your controller account and send this transaction to the network using @polkadot/api.

  5. Now your bonded coins are distributed between nominated validators, and you are eligible to receive rewards if any of your nominated validators gets into the active set.
    If you want to nominate other validators, you can resubmit this request, but you should be aware that the new list of validators will completely overwrite the previous list.


How to Bond Extra Coins

  1. To bond extra coins, send an HTTP POST request to the URL https://www.allnodes.com/api/v1/staking with the following json body:

    {
    "address": "<YOUR_STASH_ADDRESS>",
    "amount": "<DOT_AMOUNT_TO_BOND>",
    "currencySymbol": "DOT",
    "action": "bond-extra"
    }

    Example:

    curl --location --request POST 'https://www.allnodes.com/api/v1/staking' \
    --header 'Authorization: Bearer <YOUR_API_KEY>' \
    --header 'Content-Type: application/json' \
    --data-raw '{
    "address": "<YOUR_STASH_ADDRESS>",
    "amount": "<DOT_AMOUNT_TO_BOND>",
    "currencySymbol": "DOT",
    "action": "bond-extra"
    }'

    The response to your request contains:

    serializedTransaction - sign it with your stash account and send this transaction to the network using @polkadot/api.

  2. You successfully bonded extra coins!


How to Withdraw Stake

  1. First, you will need to unbond coins and wait for the 28 day unbonding period to finish.
    If your unbonding period has already finished, go to step 4.

  2. To unbond extra coins, send an HTTP POST request to the URL https://www.allnodes.com/api/v1/staking with the following json body:

    {
    "address": "<YOUR_STASH_ADDRESS>",
    "amount": "<DOT_AMOUNT_TO_UNBOND>",
    "currencySymbol": "DOT",
    "action": "unbond"
    }

    Example:

    curl --location --request POST 'https://www.allnodes.com/api/v1/staking' \
    --header 'Authorization: Bearer <YOUR_API_KEY>' \
    --header 'Content-Type: application/json' \
    --data-raw '{
    "address": "<YOUR_STASH_ADDRESS>",
    "amount": "<DOT_AMOUNT_TO_UNBOND>",
    "currencySymbol": "DOT",
    "action": "unbond"
    }'

    The response to your request contains:

    serializedTransaction - sign it with your stash account and send this transaction to the network using @polkadot/api.

  3. You successfully unbonded coins!
    You need to wait 28 days before going to the next step.

  4. Send an HTTP POST request to the URL https://www.allnodes.com/api/v1/staking with the following json body:

    {
    "address": "<YOUR_STASH_ADDRESS>",
    "currencySymbol": "DOT",
    "action": "withdraw-stake"
    }

    Example:

    curl --location --request POST 'https://www.allnodes.com/api/v1/staking' \
    --header 'Authorization: Bearer <YOUR_API_KEY>' \
    --header 'Content-Type: application/json' \
    --data-raw '{
    "address": "<YOUR_STASH_ADDRESS>",
    "currencySymbol": "DOT",
    "action": "withdraw-stake"
    }'

    The response to your request contains:

    serializedTransaction - sign it with your stash account and send this transaction to the network using @polkadot/api.

  5. You have successfully withdrawn your staked coins!

Did this answer your question?