For the complete documentation index, see llms.txt. This page is also available as Markdown.

Polkadot JSON-RPC API (Relaychain)

JSON-RPC API reference for the Polkadot Relaychain. Explore method list, request examples, and how to connect to GetBlock's Polkadot RPC endpoints

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

https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/
wss://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

Method
Description

account_nextIndex

Returns the next nonce for an account, including any transactions already queued in the pool

system_accountNextIndex

Returns the next nonce for an account, including transactions already in the pool

Author

Method
Description

author_pendingExtrinsics

Returns the extrinsics currently in the node's transaction pool that are waiting to be included in a block

author_submitExtrinsic

Submits a signed extrinsic to the node's transaction pool for inclusion in a block and returns its hash

Chain

Method
Description

chain_getBlock

Returns a full block by its hash, including the header and the scale-encoded extrinsics it contains

chain_getBlockHash

Returns the block hash for a given block number

chain_getFinalizedHead

Returns the hash of the most recently finalized block

chain_getHeader

Returns the header of a block by its hash, without the extrinsics

chain_getRuntimeVersion

Returns the runtime version at a given block

State

Method
Description

state_getRuntimeVersion

Returns the runtime version at a given block, including the spec name, spec version, and the supported runtime api versions

state_getMetadata

Returns the scale-encoded runtime metadata at a given block

state_getStorage

Returns the raw scale-encoded value stored at a storage key, at a given block

state_getStorageHash

Returns the hash of the value stored at a storage key, at a given block

state_getStorageSize

Returns the size in bytes of the value stored at a storage key, at a given block

state_getKeys

Returns the storage keys that start with a given prefix, at a given block

state_getKeysPaged

Returns a page of storage keys starting from a prefix, bounded by a count and an optional start key

state_getPairs

Returns the key/value pairs under a storage prefix, at a given block

state_queryStorageAt

Returns the current values for a list of storage keys at a given block, in a single call

state_call

Executes a runtime api call by name with scale-encoded arguments and returns the scale-encoded result, at a given block

state_getReadProof

Returns a merkle read proof for a set of storage keys at a given block

state_getChildReadProof

Returns a merkle read proof for keys in a child trie at a given block

state_traceBlock

Re-executes a block and returns storage access and event traces filtered by the given targets, storage keys, and methods

System

Method
Description

system_chain

Returns the human-readable name of the chain the node is connected to

system_chainType

Returns the type of the chain the node is connected to, such as live, local, or development

system_health

Returns the health of the node, including its peer count, whether it is syncing, and whether it is expected to have peers

system_properties

Returns chain-specific properties, including the token symbol, token decimals, and ss58 address format

system_version

Returns the version string of the node's client software

system_name

Returns the name of the node's client implementation

system_nodeRoles

Returns the roles the node performs on the network, such as full or authority

system_syncState

Returns the sync state of the node: the block it started syncing from, the current block, and the highest known block

system_peers

Returns details of the peers currently connected to the node

system_localPeerId

Returns the base-58 encoded libp2p peer id of the local node

system_localListenAddresses

Returns the libp2p multiaddresses the local node is listening on

system_reservedPeers

Returns the set of reserved peers configured on the node

system_dryRun

Dry-runs an extrinsic against the current state and returns the encoded result without submitting it

Payment

Method
Description

payment_queryInfo

Returns the weight and estimated fee for a submitted extrinsic

payment_queryFeeDetails

Returns the breakdown of the inclusion fee for an extrinsic: the base fee, length fee, and adjusted weight fee

Consensus (GRANDPA & BEEFY)

Method
Description

grandpa_roundState

Returns the state of the current grandpa voting round, including prevotes and precommits and their weights

grandpa_proveFinality

Returns a grandpa finality proof for a given block number, if available

beefy_getFinalizedHead

Returns the hash of the latest block finalized by beefy

Child State

Method
Description

childstate_getKeys

Returns the keys in a child trie that match a prefix, at a given block

childstate_getKeysPaged

Returns a page of keys in a child trie starting from a prefix, bounded by a count and an optional start key

childstate_getStorage

Returns the value stored at a key within a child trie, at a given block

childstate_getStorageHash

Returns the hash of the value stored at a key within a child trie, at a given block

childstate_getStorageSize

Returns the size in bytes of the value stored at a key within a child trie, at a given block

MMR

Method
Description

mmr_root

Returns the merkle mountain range (mmr) root at a given block

mmr_generateProof

Generates an mmr proof for one or more block numbers, returning the leaves and the proof needed to verify them against the mmr root

mmr_verifyProof

Verifies an mmr proof for a set of leaves against the node's mmr state and returns whether the proof is valid

RPC

Method
Description

rpc_methods

Returns the list of json-rpc methods the node exposes

Support

See Also

Last updated

Was this helpful?