Skip to content
Snippets Groups Projects
Select Git revision
  • f99c1657d2f37d6ed302741cb69758fc4610371c
  • master default protected
  • docusaurus
3 results

rpc.md

Blame
  • 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

    hasKey(publicKey: Bytes, keyType: Text): bool

    • 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.

    hasSessionKeys(sessionKeys: Bytes): bool

    • interface: api.rpc.author.hasSessionKeys
    • jsonrpc: author_hasSessionKeys
    • summary: Returns true if the keystore has private keys for the given session public keys.

    insertKey(keyType: Text, suri: Text, publicKey: Bytes): Bytes

    • interface: api.rpc.author.insertKey
    • jsonrpc: author_insertKey
    • summary: Insert a key into the keystore.

    pendingExtrinsics(): Vec<Extrinsic>

    • interface: api.rpc.author.pendingExtrinsics
    • jsonrpc: author_pendingExtrinsics
    • summary: Returns all pending extrinsics, potentially grouped by sender

    removeExtrinsic(bytesOrHash: Vec<ExtrinsicOrHash>): Vec<Hash>

    • interface: api.rpc.author.removeExtrinsic
    • jsonrpc: author_removeExtrinsic
    • summary: Remove given extrinsic from the pool and temporarily ban it to prevent reimporting

    rotateKeys(): Bytes

    • interface: api.rpc.author.rotateKeys
    • jsonrpc: author_rotateKeys
    • summary: Generate new session keys and returns the corresponding public keys

    submitAndWatchExtrinsic(extrinsic: Extrinsic): ExtrinsicStatus

    • interface: api.rpc.author.submitAndWatchExtrinsic
    • jsonrpc: author_submitAndWatchExtrinsic
    • summary: Submit and subscribe to watch an extrinsic until unsubscribed

    submitExtrinsic(extrinsic: Extrinsic): Hash

    • interface: api.rpc.author.submitExtrinsic
    • jsonrpc: author_submitExtrinsic
    • summary: Submit a fully formatted extrinsic for block inclusion

    babe

    epochAuthorship(): HashMap<AuthorityId, 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

    getFinalizedHead(): H256

    • interface: api.rpc.beefy.getFinalizedHead
    • jsonrpc: beefy_getFinalizedHead
    • summary: Returns hash of the latest BEEFY finalized block as seen by this client.

    subscribeJustifications(): BeefySignedCommitment

    • interface: api.rpc.beefy.subscribeJustifications
    • jsonrpc: beefy_subscribeJustifications
    • summary: Returns the block most recently finalized by BEEFY, alongside side its justification.

    chain

    getBlock(hash?: BlockHash): SignedBlock

    • interface: api.rpc.chain.getBlock
    • jsonrpc: chain_getBlock
    • summary: Get header and body of a relay chain block

    getBlockHash(blockNumber?: BlockNumber): BlockHash

    • interface: api.rpc.chain.getBlockHash
    • jsonrpc: chain_getBlockHash
    • summary: Get the block hash for a specific block

    getFinalizedHead(): BlockHash

    • interface: api.rpc.chain.getFinalizedHead
    • jsonrpc: chain_getFinalizedHead
    • summary: Get hash of the last finalized block in the canon chain

    getHeader(hash?: BlockHash): Header

    • interface: api.rpc.chain.getHeader
    • jsonrpc: chain_getHeader
    • summary: Retrieves the header for a specific block

    subscribeAllHeads(): Header

    • interface: api.rpc.chain.subscribeAllHeads
    • jsonrpc: chain_subscribeAllHeads
    • summary: Retrieves the newest header via subscription

    subscribeFinalizedHeads(): Header

    • interface: api.rpc.chain.subscribeFinalizedHeads
    • jsonrpc: chain_subscribeFinalizedHeads
    • summary: Retrieves the best finalized header via subscription

    subscribeNewHeads(): Header

    • interface: api.rpc.chain.subscribeNewHeads
    • jsonrpc: chain_subscribeNewHeads
    • summary: Retrieves the best header via subscription

    childstate

    getKeys(childKey: PrefixedStorageKey, prefix: StorageKey, at?: Hash): Vec<StorageKey>

    • 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

    getKeysPaged(childKey: PrefixedStorageKey, prefix: StorageKey, count: u32, startKey?: StorageKey, at?: Hash): Vec<StorageKey>

    • interface: api.rpc.childstate.getKeysPaged
    • jsonrpc: childstate_getKeysPaged
    • summary: Returns the keys with prefix from a child storage with pagination support

    getStorage(childKey: PrefixedStorageKey, key: StorageKey, at?: Hash): Option<StorageData>

    • interface: api.rpc.childstate.getStorage
    • jsonrpc: childstate_getStorage
    • summary: Returns a child storage entry at a specific block state

    getStorageEntries(childKey: PrefixedStorageKey, keys: Vec<StorageKey>, at?: Hash): Vec<Option<StorageData>>

    • interface: api.rpc.childstate.getStorageEntries
    • jsonrpc: childstate_getStorageEntries
    • summary: Returns child storage entries for multiple keys at a specific block state

    getStorageHash(childKey: PrefixedStorageKey, key: StorageKey, at?: Hash): Option<Hash>

    • interface: api.rpc.childstate.getStorageHash
    • jsonrpc: childstate_getStorageHash
    • summary: Returns the hash of a child storage entry at a block state

    getStorageSize(childKey: PrefixedStorageKey, key: StorageKey, at?: Hash): Option<u64>

    • interface: api.rpc.childstate.getStorageSize
    • jsonrpc: childstate_getStorageSize
    • summary: Returns the size of a child storage entry at a block state

    contracts

    call(callRequest: ContractCallRequest, at?: BlockHash): ContractExecResult

    • interface: api.rpc.contracts.call
    • jsonrpc: contracts_call
    • summary: Executes a call to a contract

    getStorage(address: AccountId, key: H256, at?: BlockHash): Option<Bytes>

    • interface: api.rpc.contracts.getStorage
    • jsonrpc: contracts_getStorage
    • summary: Returns the value under a specified storage key in a contract

    instantiate(request: InstantiateRequest, at?: BlockHash): ContractInstantiateResult

    • interface: api.rpc.contracts.instantiate
    • jsonrpc: contracts_instantiate
    • summary: Instantiate a new contract

    rentProjection(address: AccountId, at?: BlockHash): Option<BlockNumber>

    • interface: api.rpc.contracts.rentProjection
    • jsonrpc: contracts_rentProjection
    • summary: Returns the projected time a given contract will be able to sustain paying its rent

    uploadCode(uploadRequest: CodeUploadRequest, at?: BlockHash): CodeUploadResult

    • interface: api.rpc.contracts.uploadCode
    • jsonrpc: contracts_upload_code
    • summary: Upload new code without instantiating a contract from it

    dev

    getBlockStats(at: Hash): Option<BlockStats>

    • interface: api.rpc.dev.getBlockStats
    • jsonrpc: dev_getBlockStats
    • summary: Reexecute the specified block_hash and gather statistics while doing so

    engine

    createBlock(createEmpty: bool, finalize: bool, parentHash?: BlockHash): CreatedBlock

    • interface: api.rpc.engine.createBlock
    • jsonrpc: engine_createBlock
    • summary: Instructs the manual-seal authorship task to create a new block

    finalizeBlock(hash: BlockHash, justification?: Justification): bool

    • interface: api.rpc.engine.finalizeBlock
    • jsonrpc: engine_finalizeBlock
    • summary: Instructs the manual-seal authorship task to finalize a block

    eth

    accounts(): Vec<H160>

    • interface: api.rpc.eth.accounts
    • jsonrpc: eth_accounts
    • summary: Returns accounts list.

    blockNumber(): U256

    • interface: api.rpc.eth.blockNumber
    • jsonrpc: eth_blockNumber
    • summary: Returns the blockNumber

    call(request: EthCallRequest, number?: BlockNumber): Bytes

    • interface: api.rpc.eth.call
    • jsonrpc: eth_call
    • summary: Call contract, returning the output data.

    chainId(): U64

    • 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.

    coinbase(): H160

    • interface: api.rpc.eth.coinbase
    • jsonrpc: eth_coinbase
    • summary: Returns block author.

    estimateGas(request: EthCallRequest, number?: BlockNumber): U256

    • interface: api.rpc.eth.estimateGas
    • jsonrpc: eth_estimateGas
    • summary: Estimate gas needed for execution of given contract.

    feeHistory(blockCount: U256, newestBlock: BlockNumber, rewardPercentiles: Option<Vec<f64>>): EthFeeHistory

    • interface: api.rpc.eth.feeHistory
    • jsonrpc: eth_feeHistory
    • summary: Returns fee history for given block count & reward percentiles

    gasPrice(): U256

    • interface: api.rpc.eth.gasPrice
    • jsonrpc: eth_gasPrice
    • summary: Returns current gas price.

    getBalance(address: H160, number?: BlockNumber): U256

    • interface: api.rpc.eth.getBalance
    • jsonrpc: eth_getBalance
    • summary: Returns balance of the given account.

    getBlockByHash(hash: H256, full: bool): Option<EthRichBlock>

    • interface: api.rpc.eth.getBlockByHash
    • jsonrpc: eth_getBlockByHash
    • summary: Returns block with given hash.

    getBlockByNumber(block: BlockNumber, full: bool): Option<EthRichBlock>

    • interface: api.rpc.eth.getBlockByNumber
    • jsonrpc: eth_getBlockByNumber
    • summary: Returns block with given number.

    getBlockTransactionCountByHash(hash: H256): U256

    • interface: api.rpc.eth.getBlockTransactionCountByHash
    • jsonrpc: eth_getBlockTransactionCountByHash
    • summary: Returns the number of transactions in a block with given hash.

    getBlockTransactionCountByNumber(block: BlockNumber): U256

    • interface: api.rpc.eth.getBlockTransactionCountByNumber
    • jsonrpc: eth_getBlockTransactionCountByNumber
    • summary: Returns the number of transactions in a block with given block number.

    getCode(address: H160, number?: BlockNumber): Bytes

    • interface: api.rpc.eth.getCode
    • jsonrpc: eth_getCode
    • summary: Returns the code at given address at given time (block number).

    getFilterChanges(index: U256): EthFilterChanges

    • interface: api.rpc.eth.getFilterChanges
    • jsonrpc: eth_getFilterChanges
    • summary: Returns filter changes since last poll.

    getFilterLogs(index: U256): Vec<EthLog>

    • interface: api.rpc.eth.getFilterLogs
    • jsonrpc: eth_getFilterLogs
    • summary: Returns all logs matching given filter (in a range 'from' - 'to').

    getLogs(filter: EthFilter): Vec<EthLog>

    • interface: api.rpc.eth.getLogs
    • jsonrpc: eth_getLogs
    • summary: Returns logs matching given filter object.

    getProof(address: H160, storageKeys: Vec<H256>, number: BlockNumber): EthAccount

    • interface: api.rpc.eth.getProof
    • jsonrpc: eth_getProof
    • summary: Returns proof for account and storage.

    getStorageAt(address: H160, index: U256, number?: BlockNumber): H256

    • interface: api.rpc.eth.getStorageAt
    • jsonrpc: eth_getStorageAt
    • summary: Returns content of the storage at given address.

    getTransactionByBlockHashAndIndex(hash: H256, index: U256): EthTransaction

    • interface: api.rpc.eth.getTransactionByBlockHashAndIndex
    • jsonrpc: eth_getTransactionByBlockHashAndIndex
    • summary: Returns transaction at given block hash and index.

    getTransactionByBlockNumberAndIndex(number: BlockNumber, index: U256): EthTransaction

    • interface: api.rpc.eth.getTransactionByBlockNumberAndIndex
    • jsonrpc: eth_getTransactionByBlockNumberAndIndex
    • summary: Returns transaction by given block number and index.

    getTransactionByHash(hash: H256): EthTransaction

    • interface: api.rpc.eth.getTransactionByHash
    • jsonrpc: eth_getTransactionByHash
    • summary: Get transaction by its hash.

    getTransactionCount(hash: H256, number?: BlockNumber): U256