Polkadot JSON-RPC API (Relaychain)

The Polkadot JSON-RPC API exposes the relay chain's Substrate node interface over JSON-RPC 2.0. Methods are grouped into namespaces (chain_, state_, system_, payment_, grandpa_, and others). Requests POST a JSON-RPC 2.0 body to the endpoint; the method is selected by the body.

This reference documents the stable HTTP methods. GetBlock's node also exposes WebSocket subscription methods (chain_subscribe*, state_subscribe*, grandpa_subscribe*), the newer JSON-RPC spec (chainHead_v1_*, chainSpec_v1_*, transaction_v1_*), and node-administration methods; those are reached over WebSocket or restricted on shared endpoints.

Base URL

bashhttps://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/
bashwss://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/

The Polkadot.js API (@polkadot/api) connects over the WebSocket endpoint. Each method page below includes a Polkadot.js example.

Available Methods

Account

MethodDescription
account_nextIndexReturns the next nonce for an account, including any transactions already queued in the pool
system_accountNextIndexReturns the next nonce for an account, including transactions already in the pool

Author

MethodDescription
author_pendingExtrinsicsReturns the extrinsics currently in the node's transaction pool that are waiting to be included in a block
author_submitExtrinsicSubmits a signed extrinsic to the node's transaction pool for inclusion in a block and returns its hash

Chain

MethodDescription
chain_getBlockReturns a full block by its hash, including the header and the scale-encoded extrinsics it contains
chain_getBlockHashReturns the block hash for a given block number
chain_getFinalizedHeadReturns the hash of the most recently finalized block
chain_getHeaderReturns the header of a block by its hash, without the extrinsics
chain_getRuntimeVersionReturns the runtime version at a given block

State

MethodDescription
state_getRuntimeVersionReturns the runtime version at a given block, including the spec name, spec version, and the supported runtime api versions
state_getMetadataReturns the scale-encoded runtime metadata at a given block
state_getStorageReturns the raw scale-encoded value stored at a storage key, at a given block
state_getStorageHashReturns the hash of the value stored at a storage key, at a given block
state_getStorageSizeReturns the size in bytes of the value stored at a storage key, at a given block
state_getKeysReturns the storage keys that start with a given prefix, at a given block
state_getKeysPagedReturns a page of storage keys starting from a prefix, bounded by a count and an optional start key
state_getPairsReturns the key/value pairs under a storage prefix, at a given block
state_queryStorageAtReturns the current values for a list of storage keys at a given block, in a single call
state_callExecutes a runtime api call by name with scale-encoded arguments and returns the scale-encoded result, at a given block
state_getReadProofReturns a merkle read proof for a set of storage keys at a given block
state_getChildReadProofReturns a merkle read proof for keys in a child trie at a given block
state_traceBlockRe-executes a block and returns storage access and event traces filtered by the given targets, storage keys, and methods

System

MethodDescription
system_chainReturns the human-readable name of the chain the node is connected to
system_chainTypeReturns the type of the chain the node is connected to, such as live, local, or development
system_healthReturns the health of the node, including its peer count, whether it is syncing, and whether it is expected to have peers
system_propertiesReturns chain-specific properties, including the token symbol, token decimals, and ss58 address format
system_versionReturns the version string of the node's client software
system_nameReturns the name of the node's client implementation
system_nodeRolesReturns the roles the node performs on the network, such as full or authority
system_syncStateReturns the sync state of the node: the block it started syncing from, the current block, and the highest known block
system_peersReturns details of the peers currently connected to the node
system_localPeerIdReturns the base-58 encoded libp2p peer id of the local node
system_localListenAddressesReturns the libp2p multiaddresses the local node is listening on
system_reservedPeersReturns the set of reserved peers configured on the node
system_dryRunDry-runs an extrinsic against the current state and returns the encoded result without submitting it

Payment

MethodDescription
payment_queryInfoReturns the weight and estimated fee for a submitted extrinsic
payment_queryFeeDetailsReturns the breakdown of the inclusion fee for an extrinsic: the base fee, length fee, and adjusted weight fee

Consensus (GRANDPA & BEEFY)

MethodDescription
grandpa_roundStateReturns the state of the current grandpa voting round, including prevotes and precommits and their weights
grandpa_proveFinalityReturns a grandpa finality proof for a given block number, if available
beefy_getFinalizedHeadReturns the hash of the latest block finalized by beefy

Child State

MethodDescription
childstate_getKeysReturns the keys in a child trie that match a prefix, at a given block
childstate_getKeysPagedReturns a page of keys in a child trie starting from a prefix, bounded by a count and an optional start key
childstate_getStorageReturns the value stored at a key within a child trie, at a given block
childstate_getStorageHashReturns the hash of the value stored at a key within a child trie, at a given block
childstate_getStorageSizeReturns the size in bytes of the value stored at a key within a child trie, at a given block

MMR

MethodDescription
mmr_rootReturns the merkle mountain range (mmr) root at a given block
mmr_generateProofGenerates an mmr proof for one or more block numbers, returning the leaves and the proof needed to verify them against the mmr root
mmr_verifyProofVerifies an mmr proof for a set of leaves against the node's mmr state and returns whether the proof is valid

RPC

MethodDescription
rpc_methodsReturns the list of json-rpc methods the node exposes

Support

See Also