Select Git revision

Keith Millette authored
rpc.md 28.53 KiB
title: JSON-RPC
The following sections contain known RPC methods that may be available on specific nodes (depending on configuration and available pallets) and allow you to interact with the actual node, query, and submit.
author
Bytes
, keyType: Text
): bool
hasKey(publicKey: -
interface:
api.rpc.author.hasKey
-
jsonrpc:
author_hasKey
- summary: Returns true if the keystore has private keys for the given public key and key type.
Bytes
): bool
hasSessionKeys(sessionKeys: -
interface:
api.rpc.author.hasSessionKeys
-
jsonrpc:
author_hasSessionKeys
- summary: Returns true if the keystore has private keys for the given session public keys.
Text
, suri: Text
, publicKey: Bytes
): Bytes
insertKey(keyType: -
interface:
api.rpc.author.insertKey
-
jsonrpc:
author_insertKey
- summary: Insert a key into the keystore.
Vec<Extrinsic>
pendingExtrinsics(): -
interface:
api.rpc.author.pendingExtrinsics
-
jsonrpc:
author_pendingExtrinsics
- summary: Returns all pending extrinsics, potentially grouped by sender
Vec<ExtrinsicOrHash>
): Vec<Hash>
removeExtrinsic(bytesOrHash: -
interface:
api.rpc.author.removeExtrinsic
-
jsonrpc:
author_removeExtrinsic
- summary: Remove given extrinsic from the pool and temporarily ban it to prevent reimporting
Bytes
rotateKeys(): -
interface:
api.rpc.author.rotateKeys
-
jsonrpc:
author_rotateKeys
- summary: Generate new session keys and returns the corresponding public keys
Extrinsic
): ExtrinsicStatus
submitAndWatchExtrinsic(extrinsic: -
interface:
api.rpc.author.submitAndWatchExtrinsic
-
jsonrpc:
author_submitAndWatchExtrinsic
- summary: Submit and subscribe to watch an extrinsic until unsubscribed
Extrinsic
): Hash
submitExtrinsic(extrinsic: -
interface:
api.rpc.author.submitExtrinsic
-
jsonrpc:
author_submitExtrinsic
- summary: Submit a fully formatted extrinsic for block inclusion
babe
HashMap<AuthorityId, EpochAuthorship>
epochAuthorship(): -
interface:
api.rpc.babe.epochAuthorship
-
jsonrpc:
babe_epochAuthorship
- summary: Returns data about which slots (primary or secondary) can be claimed in the current epoch with the keys in the keystore
beefy
H256
getFinalizedHead(): -
interface:
api.rpc.beefy.getFinalizedHead
-
jsonrpc:
beefy_getFinalizedHead
- summary: Returns hash of the latest BEEFY finalized block as seen by this client.
BeefySignedCommitment
subscribeJustifications(): -
interface:
api.rpc.beefy.subscribeJustifications
-
jsonrpc:
beefy_subscribeJustifications
- summary: Returns the block most recently finalized by BEEFY, alongside side its justification.
chain
BlockHash
): SignedBlock
getBlock(hash?: -
interface:
api.rpc.chain.getBlock
-
jsonrpc:
chain_getBlock
- summary: Get header and body of a relay chain block
BlockNumber
): BlockHash
getBlockHash(blockNumber?: -
interface:
api.rpc.chain.getBlockHash
-
jsonrpc:
chain_getBlockHash
- summary: Get the block hash for a specific block
BlockHash
getFinalizedHead(): -
interface:
api.rpc.chain.getFinalizedHead
-
jsonrpc:
chain_getFinalizedHead
- summary: Get hash of the last finalized block in the canon chain
BlockHash
): Header
getHeader(hash?: -
interface:
api.rpc.chain.getHeader
-
jsonrpc:
chain_getHeader
- summary: Retrieves the header for a specific block
Header
subscribeAllHeads(): -
interface:
api.rpc.chain.subscribeAllHeads
-
jsonrpc:
chain_subscribeAllHeads
- summary: Retrieves the newest header via subscription
Header
subscribeFinalizedHeads(): -
interface:
api.rpc.chain.subscribeFinalizedHeads
-
jsonrpc:
chain_subscribeFinalizedHeads
- summary: Retrieves the best finalized header via subscription
Header
subscribeNewHeads(): -
interface:
api.rpc.chain.subscribeNewHeads
-
jsonrpc:
chain_subscribeNewHeads
- summary: Retrieves the best header via subscription
childstate
PrefixedStorageKey
, prefix: StorageKey
, at?: Hash
): Vec<StorageKey>
getKeys(childKey: -
interface:
api.rpc.childstate.getKeys
-
jsonrpc:
childstate_getKeys
- summary: Returns the keys with prefix from a child storage, leave empty to get all the keys
PrefixedStorageKey
, prefix: StorageKey
, count: u32
, startKey?: StorageKey
, at?: Hash
): Vec<StorageKey>
getKeysPaged(childKey: -
interface:
api.rpc.childstate.getKeysPaged
-
jsonrpc:
childstate_getKeysPaged
- summary: Returns the keys with prefix from a child storage with pagination support
PrefixedStorageKey
, key: StorageKey
, at?: Hash
): Option<StorageData>
getStorage(childKey: -
interface:
api.rpc.childstate.getStorage
-
jsonrpc:
childstate_getStorage
- summary: Returns a child storage entry at a specific block state
PrefixedStorageKey
, keys: Vec<StorageKey>
, at?: Hash
): Vec<Option<StorageData>>
getStorageEntries(childKey: -
interface:
api.rpc.childstate.getStorageEntries
-
jsonrpc:
childstate_getStorageEntries
- summary: Returns child storage entries for multiple keys at a specific block state
PrefixedStorageKey
, key: StorageKey
, at?: Hash
): Option<Hash>
getStorageHash(childKey: -
interface:
api.rpc.childstate.getStorageHash
-
jsonrpc:
childstate_getStorageHash
- summary: Returns the hash of a child storage entry at a block state
PrefixedStorageKey
, key: StorageKey
, at?: Hash
): Option<u64>
getStorageSize(childKey: -
interface:
api.rpc.childstate.getStorageSize
-
jsonrpc:
childstate_getStorageSize
- summary: Returns the size of a child storage entry at a block state
contracts
ContractCallRequest
, at?: BlockHash
): ContractExecResult
call(callRequest: -
interface:
api.rpc.contracts.call
-
jsonrpc:
contracts_call
- summary: Executes a call to a contract
AccountId
, key: H256
, at?: BlockHash
): Option<Bytes>
getStorage(address: -
interface:
api.rpc.contracts.getStorage
-
jsonrpc:
contracts_getStorage
- summary: Returns the value under a specified storage key in a contract
InstantiateRequest
, at?: BlockHash
): ContractInstantiateResult
instantiate(request: -
interface:
api.rpc.contracts.instantiate
-
jsonrpc:
contracts_instantiate
- summary: Instantiate a new contract
AccountId
, at?: BlockHash
): Option<BlockNumber>
rentProjection(address: -
interface:
api.rpc.contracts.rentProjection
-
jsonrpc:
contracts_rentProjection
- summary: Returns the projected time a given contract will be able to sustain paying its rent
CodeUploadRequest
, at?: BlockHash
): CodeUploadResult
uploadCode(uploadRequest: -
interface:
api.rpc.contracts.uploadCode
-
jsonrpc:
contracts_upload_code
- summary: Upload new code without instantiating a contract from it
dev
Hash
): Option<BlockStats>
getBlockStats(at: -
interface:
api.rpc.dev.getBlockStats
-
jsonrpc:
dev_getBlockStats
-
summary: Reexecute the specified
block_hash
and gather statistics while doing so
engine
bool
, finalize: bool
, parentHash?: BlockHash
): CreatedBlock
createBlock(createEmpty: -
interface:
api.rpc.engine.createBlock
-
jsonrpc:
engine_createBlock
- summary: Instructs the manual-seal authorship task to create a new block
BlockHash
, justification?: Justification
): bool
finalizeBlock(hash: -
interface:
api.rpc.engine.finalizeBlock
-
jsonrpc:
engine_finalizeBlock
- summary: Instructs the manual-seal authorship task to finalize a block
eth
Vec<H160>
accounts(): -
interface:
api.rpc.eth.accounts
-
jsonrpc:
eth_accounts
- summary: Returns accounts list.
U256
blockNumber(): -
interface:
api.rpc.eth.blockNumber
-
jsonrpc:
eth_blockNumber
- summary: Returns the blockNumber
EthCallRequest
, number?: BlockNumber
): Bytes
call(request: -
interface:
api.rpc.eth.call
-
jsonrpc:
eth_call
- summary: Call contract, returning the output data.
U64
chainId(): -
interface:
api.rpc.eth.chainId
-
jsonrpc:
eth_chainId
- summary: Returns the chain ID used for transaction signing at the current best block. None is returned if not available.
H160
coinbase(): -
interface:
api.rpc.eth.coinbase
-
jsonrpc:
eth_coinbase
- summary: Returns block author.
EthCallRequest
, number?: BlockNumber
): U256
estimateGas(request: -
interface:
api.rpc.eth.estimateGas
-
jsonrpc:
eth_estimateGas
- summary: Estimate gas needed for execution of given contract.
U256
, newestBlock: BlockNumber
, rewardPercentiles: Option<Vec<f64>>
): EthFeeHistory
feeHistory(blockCount: -
interface:
api.rpc.eth.feeHistory
-
jsonrpc:
eth_feeHistory
- summary: Returns fee history for given block count & reward percentiles
U256
gasPrice(): -
interface:
api.rpc.eth.gasPrice
-
jsonrpc:
eth_gasPrice
- summary: Returns current gas price.
H160
, number?: BlockNumber
): U256
getBalance(address: -
interface:
api.rpc.eth.getBalance
-
jsonrpc:
eth_getBalance
- summary: Returns balance of the given account.
H256
, full: bool
): Option<EthRichBlock>
getBlockByHash(hash: -
interface:
api.rpc.eth.getBlockByHash
-
jsonrpc:
eth_getBlockByHash
- summary: Returns block with given hash.
BlockNumber
, full: bool
): Option<EthRichBlock>
getBlockByNumber(block: -
interface:
api.rpc.eth.getBlockByNumber
-
jsonrpc:
eth_getBlockByNumber
- summary: Returns block with given number.
H256
): U256
getBlockTransactionCountByHash(hash: -
interface:
api.rpc.eth.getBlockTransactionCountByHash
-
jsonrpc:
eth_getBlockTransactionCountByHash
- summary: Returns the number of transactions in a block with given hash.
BlockNumber
): U256
getBlockTransactionCountByNumber(block: -
interface:
api.rpc.eth.getBlockTransactionCountByNumber
-
jsonrpc:
eth_getBlockTransactionCountByNumber
- summary: Returns the number of transactions in a block with given block number.
H160
, number?: BlockNumber
): Bytes
getCode(address: -
interface:
api.rpc.eth.getCode
-
jsonrpc:
eth_getCode
- summary: Returns the code at given address at given time (block number).
U256
): EthFilterChanges
getFilterChanges(index: -
interface:
api.rpc.eth.getFilterChanges
-
jsonrpc:
eth_getFilterChanges
- summary: Returns filter changes since last poll.
U256
): Vec<EthLog>
getFilterLogs(index: -
interface:
api.rpc.eth.getFilterLogs
-
jsonrpc:
eth_getFilterLogs
- summary: Returns all logs matching given filter (in a range 'from' - 'to').
EthFilter
): Vec<EthLog>
getLogs(filter: -
interface:
api.rpc.eth.getLogs
-
jsonrpc:
eth_getLogs
- summary: Returns logs matching given filter object.
H160
, storageKeys: Vec<H256>
, number: BlockNumber
): EthAccount
getProof(address: -
interface:
api.rpc.eth.getProof
-
jsonrpc:
eth_getProof
- summary: Returns proof for account and storage.
H160
, index: U256
, number?: BlockNumber
): H256
getStorageAt(address: -
interface:
api.rpc.eth.getStorageAt
-
jsonrpc:
eth_getStorageAt
- summary: Returns content of the storage at given address.
H256
, index: U256
): EthTransaction
getTransactionByBlockHashAndIndex(hash: -
interface:
api.rpc.eth.getTransactionByBlockHashAndIndex
-
jsonrpc:
eth_getTransactionByBlockHashAndIndex
- summary: Returns transaction at given block hash and index.
BlockNumber
, index: U256
): EthTransaction
getTransactionByBlockNumberAndIndex(number: -
interface:
api.rpc.eth.getTransactionByBlockNumberAndIndex
-
jsonrpc:
eth_getTransactionByBlockNumberAndIndex
- summary: Returns transaction by given block number and index.
H256
): EthTransaction
getTransactionByHash(hash: -
interface:
api.rpc.eth.getTransactionByHash
-
jsonrpc:
eth_getTransactionByHash
- summary: Get transaction by its hash.