Node API
Supported Chains
API Reference
Kusama

Kusama


Available for Premium users only.

Kusama API is available on Web3 API platform (opens in a new tab).

Kusama is an early release of Polkadot: a scalable, multichain network for radical innovation. Kusama serves as a proving ground that allows teams and developers to build and deploy a parachain, and experiment with Polkadot’s governance and NPoS functionality in a real environment.

The API interaction follows the JSON-RPC (opens in a new tab) which is a stateless, light-weight remote procedure call (RPC) protocol. It defines several data structures and the rules around their processing. It is transport agnostic in that the concepts can be used within the same process, over sockets, over HTTP, or in other message-passing environments. It uses JSON (RFC 4627) as data format.


Methods supported


chain_getBlock

Retrieves the header and body of a relay chain block.

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    • <BlockHash> (data; 32 byte; optional): a hash of the block to retrieve; if omitted, retrieves the latest finalized block.

Returns

  • SignedBlock: the header and body data of a relay chain block.

Request example

curl -X POST https://rpc.ankr.com/kusama/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "chain_getBlock",
      "params": []
}'

Response example

{
    "jsonrpc": "2.0",
    "result": {
        "block": {
            "header": {
                "parentHash": "0x805af41d6b9e4a559a188c1824ca8bbfd454761d40791013ca9acbb7022f41b1",
                "number": "0x1136a68",
                "stateRoot": "0x512ca942fdd6ac82d445fddc9e6b3c23548bbbcff431dd9136fd73c3377fd1f1",
                "extrinsicsRoot": "0xd45d7104386fd2bc68ec0b9455c5395b53dd8d72fb73376f13e433e282bfda34",
                "digest": {
                    "logs": [
                        "0x0642414245b50103a4030000cef6bc1000000000620f5a0e38b9f5c4695c9271c17aa6d75adbbd4ed06f5d08a0f17280524242133e3eb41876d2ff9609ee2cfa422ac8a4772179ad7310d950c8edb97f0e7543006eb79fd3fbd865c24f8601f8ee50409984c915b59480e01b9382d2abccd55f06",
                        "0x05424142450101e45511be6785f935a0c729a15cab7503b06aeed6b881d9cdf75978e7d393060a356278eff9ac4918c1fba3127c4dfa88206ccd8a737b8796e99171728e0b448c"
                    ]
                }
            },
            "extrinsics": [
                "0x280402000b217cd84c8801"
            ]
        },
        "justifications": null
    },
    "id": 1
}

chain_getBlockHash

Retrieves the block hash for a specific block.

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    <BlockNumber> (string; hex; optional): the number of a block to retrieve the hash for; if omitted, retrieves the latest finalized block.

Returns

  • <BlockHash>: the block hash of the block specified.

Request example

curl -X POST https://rpc.ankr.com/kusama/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "chain_getBlockHash",
      "params": ["0xb48f90"]
}'

Response example

{
    "jsonrpc": "2.0",
    "result": "0xb5c3146ceb55f547304c7ad6879d0c017016b6f526c86cd3579314116365072c",
    "id": 1
}

chain_getHeader

Retrieves the header for a specific block.

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    • <BlockHash> (data; 32 byte; optional): a hash of the block to retrieve the header for; if omitted, shows the result for the latest finalized block.

Returns

  • <Header>: the header of the block specified.

Request example

curl -X POST https://rpc.ankr.com/kusama/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "chain_getHeader",
      "params": ["0x56547256415c6ca5d7e43e32f0664ede1aa78aae59e07cdc64f2037beba31e9e"]
}'

Response example

{
    "jsonrpc": "2.0",
    "result": {
        "parentHash": "0x88ac4b5bc7ea4e0cb1b8d8e1d2dce838e37d1a4480c4bde37bdfdcc9c8fffb64",
        "number": "0xb48f75",
        "stateRoot": "0xa2baf709447aa9055b4ca5046fc76a0ca05ace90758fcf3bc3bc004612173bfa",
        "extrinsicsRoot": "0xe94f82eae3aba9331e0370f1c3b7d72da3bd9a82dd36711448d6197b6659e308",
        "digest": {
            "logs": [
                "0x0642414245b50103c0000000076382100000000084c21f756e3473b8717c13d27c85a94466cbd0f64fe8bbd37cbf23dd46c70e5a49626481005b811dfcff67dda4b12ee502cb3589c6b2ff6450c6537f18298c08fd2942aaa2f0ee1591522fe4dc0482949c920a046201cf39f7ba766af4907509",
                "0x05424142450101340de0372f172ba4d9c12d767ddd42e2f1844691c93f74773e7839ccba29b96f400a6b8bbea109e807033696c182f08c8c02918c3521968612cd20ed82af0b89"
            ]
        }
    },
    "id": 1
}

chain_getFinalizedHead

Retrieves the hash of the last finalized block in the canon chain.

Parameters

  • id (integer; required): a request ID (example: 1).
  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).
  • method (string; required): a method used for the request.
  • params (array; required): none.

Returns

  • <BlockHash>: the hash of the last finalized block in the canon chain.

Request example

curl -X POST https://rpc.ankr.com/kusama/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "chain_getFinalizedHead",
      "params": []
}'

Response example

{
    "jsonrpc": "2.0",
    "result": "0x6b19ea53df54f69c7b931fa0708e5cc2b5d1397488ecf26364f11c6fe14cb663",
    "id": 1
}

state_getStorage

Retrieves the storage for a key.

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    • <StorageKey> (string; hex ; required): the key to retrieve the storage for.
    • <BlockHash> (data; 32 byte; optional): a hash of the block.

Returns

  • <StorageData>: the storage data.

Request example

curl -X POST https://rpc.ankr.com/kusama/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "state_getStorage",
      "params": ["0xf0c365c3cf59d671eb72da0e7a4113c49f1f0515f462cdcf84e0f1d6045dfcbb"]
}'

Response example

{
    "jsonrpc": "2.0",
    "result": "0xb052db4c88010000",
    "id": 1
}

state_getStorageHash

Retrieves the storage hash.

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    • <StorageKey> (string; hex; required): a storage key.
    • <BlockHash> (data; 32 byte; optional): a hash of the block.

Returns

  • <Hash>: the storage hash.

Request example

curl -X POST https://rpc.ankr.com/kusama/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "state_getStorageHash",
      "params": ["0xf0c365c3cf59d671eb72da0e7a4113c49f1f0515f462cdcf84e0f1d6045dfcbb"]
}'

Response example

{
    "jsonrpc": "2.0",
    "result": "0xa1d4f18e6e91789e6a9a73f2635b3ef87a61f951c6c85aa27b3c893edd3ae44f",
    "id": 1
}

state_getStorageSize

Retrieves the storage size.

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    • <StorageKey> (string; hex; required): the storage key.
    • <BlockHash> (data; 32 byte; optional): a hash of the block.

Returns

  • <u64>: the storage size.

Request example

curl -X POST https://rpc.ankr.com/kusama/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "state_getStorageSize",
      "params": ["0xf0c365c3cf59d671eb72da0e7a4113c49f1f0515f462cdcf84e0f1d6045dfcbb"]
}'

Response example

{
    "jsonrpc": "2.0",
    "result": 8,
    "id": 1
}

grandpa_proveFinality

Proves finality for the given block number, returning the Justification for the last block in the set.

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    • <BlockNumber> (integer; required): the number of a block to prove finality for.

Returns

  • Option<EncodedFinalityProofs>: the Justification for the last block in the set.

Request example

curl -X POST https://rpc.ankr.com/kusama/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "grandpa_proveFinality",
      "params": [11833440]
}'

grandpa_roundState

Returns the state of the current best round state as well as the ongoing background rounds.

Parameters

  • id (integer; required): a request ID (example: 1).
  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).
  • method (string; required): a method used for the request.
  • params (array; required): none.

Returns

  • <ReportedRoundStates>: the states of reported rounds.

Request example

curl -X POST https://rpc.ankr.com/kusama/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "grandpa_roundState",
      "params": []
}'

Response example

{
    "jsonrpc": "2.0",
    "result": {
        "setId": 6983,
        "best": {
            "round": 1667,
            "totalWeight": 1000,
            "thresholdWeight": 667,
            "prevotes": {
                "currentWeight": 869,
                "missing": [
                    "Caf9kG6ieAounXaTYQatykAsHXkU5cGzAtb91huUBZGLS4c",
                    "CbagHSxtekR2Lo4nk9C5jvSSK1cXcTbuu34xDMU4hxxKCak"
                ]
            },
            "precommits": {
                "currentWeight": 0,
                "missing": [
                    "CaYgCrbi6k8cZCFr6WG16cv6epGECLofz1HvfLtHD2Dj7SU",
                    "Caf9kG6ieAounXaTYQatykAsHXkU5cGzAtb91huUBZGLS4c"
                ]
            }
        },
        "background": []
    },
    "id": 1
}

system_chain

Retrieves the chain.

Parameters

  • id (integer; required): a request ID (example: 1).
  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).
  • method (string; required): a method used for the request.
  • params (array; required): none.

Returns

  • <Text>: a chain name.

Request example

curl -X POST https://rpc.ankr.com/kusama/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "system_chain",
      "params": []
}'

Response example

{
    "jsonrpc": "2.0",
    "result": "Kusama",
    "id": 1
}

system_chainType

Retrieves the chain type.

Parameters

  • id (integer; required): a request ID (example: 1).
  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).
  • method (string; required): a method used for the request.
  • params (array; required): none.

Returns

  • <ChainType>: a chain type.

Request example

curl -X POST https://rpc.ankr.com/kusama/{your_token} \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "system_chainType",
      "params": []
}'

Response example

{
    "jsonrpc": "2.0",
    "result": "Live",
    "id": 1
}