The Staking API's staking proxy flow for Polkadot will walk your application through the process of adding proxy rights to another account.

🚧

Proxy On-Chain deposit

Proxies require deposits in the native currency (i.e. DOT) to be created. The deposit is required because adding a proxy requires some storage space on-chain, which must be replicated across every peer in the network.

Once the proxy is removed, both the storage space and the deposited amount are returned.

The required deposit amount for n proxies is equal to:

ProxyDepositBase + ProxyDepositFactor

Where the ProxyDepositBase is the required amount to be reserved for an account to have a proxy list (creates one new item in storage). For every proxy the account has, an additional amount defined by the ProxyDepositFactor is reserved as well.

The ProxyDepositBase is 20.008 DOT and the ProxyDepositFactor is 0.033 DOT.

In the following guide we will illustrate how to add a proxy account.

Create New Add Staking Proxy Flow

To add a staking proxy, create a new flow with a POST request to /api/v1/flows.

URL

https://polkadot-slate.datahub.figment.io/api/v1/flows

Request

  • flow : object
    • network_code* : string Network this flow operates on (ex. polkadot).
    • chain_code* : string Chain this flow operates on (ex. westend).
    • operation* : string The operation to perform (ex. add_proxy).
{
  "flow": {
    "network_code": "polkadot",
    "chain_code": "westend",
    "operation": "add_proxy"
  }
}

Response

  • id : string ID of the flow.
  • operation : string The Staking API operation being performed by this flow.
  • state : string The current state of the flow.
  • actions : array It includes the name & inputs of all next possible actions.
    • create_add_proxy_tx : Use this action to generate an add proxy transaction.
      • proxy_account_address : The address to which you want to grant proxy rights.
      • proxied_account_address : The account whose rights will be proxied.
  • data : object Flow & transaction data.
{
  "id": "5d2a7dc6-0f7c-41a5-bbb6-fb27b2e16a9b",
  "operation": "add_proxy",
  "state": "initialized",
  "actions": [
    {
      "name": "create_add_proxy_tx",
      "inputs": [
        {
          "name": "proxy_account_address",
          "display": "Proxy Account Address",
          "description": "",
          "type": "string",
          "validations": [
            {
              "type": "presence",
              "options": {}
            }
          ],
          "array": false,
          "default_value": null
        },
        {
          "name": "proxied_account_address",
          "display": "Proxied Account Address",
          "description": "",
          "type": "string",
          "validations": [
            {
              "type": "presence",
              "options": {}
            }
          ],
          "array": false,
          "default_value": null
        }
      ]
    }
  ],
  "data": {
    "proxy_account_address": null,
    "proxied_account_address": null,
    "add_proxy_transaction": null
  },
  "network_code": "polkadot",
  "chain_code": "westend",
  "created_at": "2023-02-28T19:11:38.281Z",
  "updated_at": "2023-02-28T19:11:38.281Z"
}

Submit Add Proxy Data

After collecting the required inputs, send a PUT request to /api/v1/flows/[:flow_id]/next to proceed to the next step.

URL

https://polkadot-slate.datahub.figment.io/api/v1/flows/[:flow_id]/next

Request

  • name* : create_add_proxy_tx
  • inputs* : object
    • proxy_account_address* : string The address to which you want to add proxy rights.
    • proxied_account_address* : string The account whose rights will be proxied.
{
  "name": "create_add_proxy_tx",
  "inputs": {
    "proxy_account_address": "5CDAhYcPZEx6sN4oGbQMRFZzo5Eur6NTN4nd85SADgMdnxAS",
    "proxied_account_address": "5FWX3P9gwg4FKAyDHp1UYJp4ZZYPPoQZHfWRcN74HwBgXifh"
  }
}

Response

  • id : string ID of the flow.
  • operation : string The Staking API operation being performed by this flow.
  • state : string The current state of the flow.
  • actions : array It includes the name & inputs of all next possible actions.
  • data : object Flow & transaction data.
{
  "id": "5d2a7dc6-0f7c-41a5-bbb6-fb27b2e16a9b",
  "operation": "add_proxy",
  "state": "add_proxy_tx_signature",
  "actions": [
    {
      "name": "refresh_add_proxy_tx",
      "inputs": [
        {
          "name": "proxy_account_address",
          "display": "Proxy Account Address",
          "description": "",
          "type": "string",
          "validations": [
            {
              "type": "presence",
              "options": {}
            }
          ],
          "array": false,
          "default_value": "5HDojdfR1Vm9dnDYEB4JQyxgcgH3aHHeWgE9jqarBkChULRJ"
        },
        {
          "name": "proxied_account_address",
          "display": "Proxied Account Address",
          "description": "",
          "type": "string",
          "validations": [
            {
              "type": "presence",
              "options": {}
            }
          ],
          "array": false,
          "default_value": "5FNVfA6qhVJBKrG4KCo6CLzvcXVRRdiGpsYHbkzujMUG6JJG"
        }
      ]
    },
    {
      "name": "sign_add_proxy_tx",
      "inputs": [
        {
          "name": "transaction_payload",
          "display": "Transaction Payload",
          "description": "",
          "type": "signed_transaction",
          "validations": [
            {
              "type": "sign_payload",
              "options": {}
            }
          ],
          "array": false,
          "default_value": null,
          "signers": [
            "5FNVfA6qhVJBKrG4KCo6CLzvcXVRRdiGpsYHbkzujMUG6JJG"
          ],
          "transaction_payload": "0x0008000000000000000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e00000000000000000000000000000000000000000000000000000000000000000000000000160100e41e2a54397e0657cb58d978d0f2a9201a84b3d953a83780df5795a1006ecf7d02000000001c77657374656e64387061726974792d77657374656e6402000000a42400000000000040df6acb689907609b0400000037e397fc7c91f5e40100000040fe3ad401f8959a06000000d2bc9897eed08f1503000000f78b278be53f454c02000000af2c0297a23e6d3d0300000049eaaf1b548a0cb00100000091d5df18b0d2cf5801000000ed99c5acb25eedf503000000cbca25e39f14238702000000687ad44ad37f03c201000000ab3c0572291feb8b01000000bc9d89904f5b923f0100000037c8bb1350a9a2a803000000f3ff14d5ab5270590300000017a6bc0d0062aeb30100000013000000010004"
        },
        {
          "name": "signatures",
          "display": "Signatures",
          "description": "",
          "type": "array_of_signatures",
          "validations": [],
          "array": true,
          "default_value": null,
          "element_type": "signature_data",
          "signers": [
            "5FNVfA6qhVJBKrG4KCo6CLzvcXVRRdiGpsYHbkzujMUG6JJG"
          ],
          "transaction_payload": "0x0008000000000000000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e00000000000000000000000000000000000000000000000000000000000000000000000000160100e41e2a54397e0657cb58d978d0f2a9201a84b3d953a83780df5795a1006ecf7d02000000001c77657374656e64387061726974792d77657374656e6402000000a42400000000000040df6acb689907609b0400000037e397fc7c91f5e40100000040fe3ad401f8959a06000000d2bc9897eed08f1503000000f78b278be53f454c02000000af2c0297a23e6d3d0300000049eaaf1b548a0cb00100000091d5df18b0d2cf5801000000ed99c5acb25eedf503000000cbca25e39f14238702000000687ad44ad37f03c201000000ab3c0572291feb8b01000000bc9d89904f5b923f0100000037c8bb1350a9a2a803000000f3ff14d5ab5270590300000017a6bc0d0062aeb30100000013000000010004",
          "signing_payload": "0x160100e41e2a54397e0657cb58d978d0f2a9201a84b3d953a83780df5795a1006ecf7d0200000000000800a424000013000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e",
          "inputs": [
            {
              "name": "account_address",
              "display": "Account Address",
              "description": "",
              "type": "string",
              "validations": [
                {
                  "type": "presence",
                  "options": {}
                }
              ],
              "array": false,
              "default_value": null
            },
            {
              "name": "signature",
              "display": "Signature",
              "description": "",
              "type": "string",
              "validations": [
                {
                  "type": "presence",
                  "options": {}
                }
              ],
              "array": false,
              "default_value": null
            }
          ]
        }
      ]
    },
    {
      "name": "confirm_add_proxy_tx_by_hash",
      "inputs": [
        {
          "name": "hash",
          "display": "Hash",
          "description": "",
          "type": "string",
          "validations": [
            {
              "type": "presence",
              "options": {}
            }
          ],
          "array": false,
          "default_value": null
        },
        {
          "name": "block_number",
          "display": "Block Number",
          "description": "",
          "type": "integer",
          "validations": [],
          "array": false,
          "default_value": null
        }
      ]
    }
  ],
  "data": {
    "proxy_account_address": "5HDojdfR1Vm9dnDYEB4JQyxgcgH3aHHeWgE9jqarBkChULRJ",
    "proxied_account_address": "5FNVfA6qhVJBKrG4KCo6CLzvcXVRRdiGpsYHbkzujMUG6JJG",
    "add_proxy_transaction": {
      "raw": "0x0008000000000000000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e00000000000000000000000000000000000000000000000000000000000000000000000000160100e41e2a54397e0657cb58d978d0f2a9201a84b3d953a83780df5795a1006ecf7d02000000001c77657374656e64387061726974792d77657374656e6402000000a42400000000000040df6acb689907609b0400000037e397fc7c91f5e40100000040fe3ad401f8959a06000000d2bc9897eed08f1503000000f78b278be53f454c02000000af2c0297a23e6d3d0300000049eaaf1b548a0cb00100000091d5df18b0d2cf5801000000ed99c5acb25eedf503000000cbca25e39f14238702000000687ad44ad37f03c201000000ab3c0572291feb8b01000000bc9d89904f5b923f0100000037c8bb1350a9a2a803000000f3ff14d5ab5270590300000017a6bc0d0062aeb30100000013000000010004",
      "signing_payload": "0x160100e41e2a54397e0657cb58d978d0f2a9201a84b3d953a83780df5795a1006ecf7d0200000000000800a424000013000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e",
      "signed": null,
      "hash": null,
      "status": null,
      "error": null,
      "signatures": null,
      "block_time": null,
      "block_number": null,
      "proxy": null
    }
  },
  "network_code": "polkadot",
  "chain_code": "westend",
  "created_at": "2023-02-28T19:11:38.281Z",
  "updated_at": "2023-02-28T19:14:40.992Z"
}

Submit Signed Add Proxy Transaction for Broadcast

Before broadcasting the transaction, you must sign the transaction_payload you received in the previous step. After signing the transaction, you will PUT /api/v1/flows/[:flow_id]/next (as always!) and the Staking API will broadcast the transaction to the Polkadot network.

URL

https://polkadot-slate.datahub.figment.io/api/v1/flows/[:flow_id]/next

Request

  • name* : sign_add_proxy_tx
  • inputs* : object
    • transaction_payload* : Signed transaction payload from the previous step's response.
    • signatures : array of object The signatures array can be used instead of sending a transaction payload when the signing keys are kept in a custodial solution, such as Fireblocks. Refer to the guide Signing Transactions with the Fireblocks API for details.
{
  "name": "sign_add_proxy_tx",
  "inputs": {
    "transaction_payload": "0x390284009864ac6455584af3c38540ec03927eca126342d266d3c9b62e44b41844a3166601665fc2eaae2fa8bdd6b7be7f0aaec5081ed2f45d54910cf6695a5795f329c262331af7f0803768c510a59fd45b7f81f0a01c4c393504a50a790545ec3f99538a000400160100067452e7828dafb80be77c82b33a3781e71de7d04096aad144cfac000a7fd2400200000000"
  }
}

Response

  • id : string ID of the flow.
  • operation : string The Staking API operation being performed by this flow.
  • state : string The current state of the flow.
    • add_proxy_tx_broadcasting : Transaction has been broadcast and is waiting confirmation.
    • registered : Transaction has been confirmed and the proxy is complete.
  • actions : array It includes the name & inputs of all next possible actions.
  • data : object Flow & transaction data.
{
  "id": "5d2a7dc6-0f7c-41a5-bbb6-fb27b2e16a9b",
  "operation": "add_proxy",
  "state": "add_proxy_tx_broadcasting",
  "actions": [
    {
      "name": "wait",
      "estimated_state_change_at": "2023-02-28T19:28:27.209Z",
      "inputs": []
    }
  ],
  "data": {
    "proxy_account_address": "5HDojdfR1Vm9dnDYEB4JQyxgcgH3aHHeWgE9jqarBkChULRJ",
    "proxied_account_address": "5FNVfA6qhVJBKrG4KCo6CLzvcXVRRdiGpsYHbkzujMUG6JJG",
    "add_proxy_transaction": {
      "raw": "0x0008000000000000000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e00000000000000000000000000000000000000000000000000000000000000000000000000160100e41e2a54397e0657cb58d978d0f2a9201a84b3d953a83780df5795a1006ecf7d02000000001c77657374656e64387061726974792d77657374656e6402000000a42400000000000040df6acb689907609b0400000037e397fc7c91f5e40100000040fe3ad401f8959a06000000d2bc9897eed08f1503000000f78b278be53f454c02000000af2c0297a23e6d3d0300000049eaaf1b548a0cb00100000091d5df18b0d2cf5801000000ed99c5acb25eedf503000000cbca25e39f14238702000000687ad44ad37f03c201000000ab3c0572291feb8b01000000bc9d89904f5b923f0100000037c8bb1350a9a2a803000000f3ff14d5ab5270590300000017a6bc0d0062aeb30100000013000000010004",
      "signing_payload": "0x160100e41e2a54397e0657cb58d978d0f2a9201a84b3d953a83780df5795a1006ecf7d0200000000000800a424000013000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e",
      "signed": "0x3902840092460dcf0b9ae6cabf654c1b33f02f52934d1ae262f8db733b470b631c5871650168412eb87861dfec907b59f82abc2bd30f8e79b03d899af35a0edb2c250d797238e124dc5beffb808f10f397b89116262f96f3d138483a094e0b5b9032394b88000800160100e41e2a54397e0657cb58d978d0f2a9201a84b3d953a83780df5795a1006ecf7d0200000000",
      "hash": "0xb1460239a2a02c504aff2482d0461454f0a4c73033f14f5b96827a8d6f7b464e",
      "status": null,
      "error": null,
      "signatures": [],
      "block_time": null,
      "block_number": 14838468,
      "proxy": null
    }
  },
  "network_code": "polkadot",
  "chain_code": "westend",
  "created_at": "2023-02-28T19:11:38.281Z",
  "updated_at": "2023-02-28T19:27:27.188Z"
}

Get Add Staking Proxy Flow Status

To get the current state of the existing flow, send a GET request to /api/v1/flows/[:flow_id] using the flow ID from the previous step.

URL

https://polkadot-slate.datahub.figment.io/api/v1/flows/[:flow_id]

Request

  • None

Response

  • id : string ID of the flow.
  • operation : string The Staking API operation being performed by this flow.
  • state : string The current state of the flow.
    • add_proxy_tx_broadcasting : Broadcasting transaction
    • registered : Transaction broadcasted & confirmed
  • actions : array It includes the name & inputs of all next possible actions.
  • data : object Flow & transaction data.
{
  "id": "90a28f6e-09b4-4fe1-aeb4-c8e3720933ab",
  "operation": "staking",
  "state": "bonding_complete",
  "actions": [
    {
      "name": "create_nomination_tx",
      "inputs": [
        {
          "name": "validator_addresses",
          "display": "Validator Addresses",
          "description": "",
          "type": "array_of_strings",
          "validations": [
            {
              "type": "array",
              "options": {
                "allow_empty": false,
                "allow_duplicates": false
              }
            },
            {
              "type": "length",
              "options": {
                "maximum": 16,
                "message": "Cannot have more than 16 validators"
              }
            }
          ],
          "array": false,
          "default_value": null
        }
      ]
    },
    {
      "name": "create_bond_more_tx",
      "inputs": [
        {
          "name": "amount",
          "display": "Amount",
          "description": "in DOT",
          "type": "string",
          "validations": [
            {
              "type": "presence",
              "options": {}
            },
            {
              "type": "numericality",
              "options": {
                "greater_than": 0
              }
            }
          ],
          "array": false,
          "default_value": "1.0"
        }
      ]
    },
    {
      "name": "complete",
      "inputs": []
    },
    {
      "name": "assign_stash_and_controller_account",
      "inputs": [
        {
          "name": "controller_account_address",
          "display": "Controller Account Address",
          "description": "",
          "type": "string",
          "validations": [
            {
              "type": "presence",
              "options": {}
            }
          ],
          "array": false,
          "default_value": "5CtTpJSdf13cbBZU4RX7EHkEaJ53pVaAF5XJosmusXJ5gdDg"
        },
        {
          "name": "controller_proxy_account_address",
          "display": "Controller Proxy Account Address",
          "description": "",
          "type": "string",
          "validations": [],
          "array": false,
          "default_value": null
        },
        {
          "name": "stash_account_address",
          "display": "Stash Account Address",
          "description": "",
          "type": "string",
          "validations": [
            {
              "type": "presence",
              "options": {}
            }
          ],
          "array": false,
          "default_value": "5HRJp9zQzMTjyv7skG3gnWwopPgFfc5FNwyNtEsmLHLyRK8t"
        },
        {
          "name": "stash_proxy_account_address",
          "display": "Stash Proxy Account Address",
          "description": "",
          "type": "string",
          "validations": [],
          "array": false,
          "default_value": null
        }
      ]
    }
  ],
  "data": {
    "controller_account_address": "5CtTpJSdf13cbBZU4RX7EHkEaJ53pVaAF5XJosmusXJ5gdDg",
    "controller_proxy_account_address": null,
    "stash_account_address": "5HRJp9zQzMTjyv7skG3gnWwopPgFfc5FNwyNtEsmLHLyRK8t",
    "stash_proxy_account_address": null,
    "validator_addresses": null,
    "reward_destination": "5HRJp9zQzMTjyv7skG3gnWwopPgFfc5FNwyNtEsmLHLyRK8t",
    "amount": "1.0",
    "bonding_transaction": {
      "raw": "0x0000000000000000000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e00000000000000000000000000000000000000000000000000000000000000000000000000060000246c8389743df168ed8f55e531a31e55d5d3ac774d8f7efe626d46c2c433e679070010a5d4e803ece3c0004ffa0c55acd1bb2ec951f24d6b898fbafee6520dab3022fe12bec7451c77657374656e64387061726974792d77657374656e6402000000a42400000000000040df6acb689907609b0400000037e397fc7c91f5e40100000040fe3ad401f8959a06000000d2bc9897eed08f1503000000f78b278be53f454c02000000af2c0297a23e6d3d0300000049eaaf1b548a0cb00100000091d5df18b0d2cf5801000000ed99c5acb25eedf503000000cbca25e39f14238702000000687ad44ad37f03c201000000ab3c0572291feb8b01000000bc9d89904f5b923f0100000037c8bb1350a9a2a803000000f3ff14d5ab5270590300000017a6bc0d0062aeb30100000013000000010004",
      "signing_payload": "0x060000246c8389743df168ed8f55e531a31e55d5d3ac774d8f7efe626d46c2c433e679070010a5d4e803ece3c0004ffa0c55acd1bb2ec951f24d6b898fbafee6520dab3022fe12bec745000000a424000013000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e",
      "signed": "0xc1028400ece3c0004ffa0c55acd1bb2ec951f24d6b898fbafee6520dab3022fe12bec745017e6fb8557959f7c8806aee19a18b54f42336f0f7c814514f66d8fa788b32902722ea6dc1bfe66cf6e402b8f139137900e63e20e72951b780abd3a6d80e640f8b000000060000246c8389743df168ed8f55e531a31e55d5d3ac774d8f7efe626d46c2c433e679070010a5d4e803ece3c0004ffa0c55acd1bb2ec951f24d6b898fbafee6520dab3022fe12bec745",
      "hash": "0xed90569932c9897bd0defbf763d8e9ab24fd849f9c627a5a50d6d622b3f37449",
      "status": "confirmed",
      "error": null,
      "signatures": [],
      "block_time": "2023-02-28T18:42:42.254Z",
      "block_number": 14838035,
      "proxy": false
    },
    "nomination_transaction": null,
    "bond_more_transaction": null
  },
  "network_code": "polkadot",
  "chain_code": "westend",
  "created_at": "2023-02-28T17:41:14.880Z",
  "updated_at": "2023-02-28T18:42:42.261Z"
}