Runtime API

External node components handle most of the logic such as peer discovery, transaction pooling, block and transaction propagations, consensus mechanisms, and RPC requests. In some cases, external components require some data that is provided by the Runtime. Thus, the Runtime API allows the Runtime and external components to communicate easily with each other.

The API definitions below are the Runtime APIs supported on the Bifrost Network.


accountNonce(accountId: AccountId): Index

  • interface:

  • runtime: AccountNonceApi_account_nonce

  • summary: The API to query account nonce (aka transaction index).


authorities(): Vec<AuthorityId>

  • interface:

  • runtime: AuraApi_authorities

  • summary: Returns the current set of authorities.

slotDuration(): SlotDuration

  • interface:

  • runtime: AuraApi_slot_duration

  • summary: Returns the slot duration for Aura.


applyExtrinsic(extrinsic: Extrinsic): ApplyExtrinsicResult

  • interface:

  • runtime: BlockBuilder_apply_extrinsic

  • summary: Applies the given extrinsic.

checkInherents(block: Block, data: InherentData): CheckInherentsResult

  • interface:

  • runtime: BlockBuilder_check_inherents

  • summary: Checks that the inherents are valid.

finalizeBlock(): Header

  • interface:

  • runtime: BlockBuilder_finalize_block

  • summary: Finishes the current block.

inherentExtrinsics(inherent: InherentData): Vec<Extrinsic>

  • interface:

  • runtime: BlockBuilder_inherent_extrinsics

  • summary: Generates inherent extrinsics.


convertTransaction(transaction: TransactionV2): Extrinsic

  • interface:

  • runtime: ConvertTransactionRuntimeApi_convert_transaction

  • summary: Converts an Ethereum-style transaction to Extrinsic


executeBlock(block: Block): Null

  • interface:

  • runtime: Core_execute_block

  • summary: Executes the given block.

initializeBlock(header: Header): Null

  • interface:

  • runtime: Core_initialize_block

  • summary: Initializes a block with the given header.

version(): RuntimeVersion

  • interface:

  • runtime: Core_version

  • summary: Returns the version of the runtime.


traceBlock(extrinsics: Vec<Extrinsic>, knownTransactions: Vec<H256>): Result<(), DispatchError>

  • interface:

  • runtime: DebugRuntimeApi_trace_block

  • summary: Traces all block extrinsics.

traceTransaction(extrinsics: Vec<Extrinsic>, transaction: EthTransaction): Result<(), DispatchError>

  • interface:

  • runtime: DebugRuntimeApi_trace_transaction

  • summary: Traces transaction extrinsics.


accountBasic(address: H160): EvmAccount

  • interface:

  • runtime: EthereumRuntimeRPCApi_account_basic

  • summary: Returns pallet_evm::Accounts basic information by address.

accountCodeAt(address: H160): Bytes

  • interface:

  • runtime: EthereumRuntimeRPCApi_account_code_at

  • summary: Returns pallet_evm::AccountCodes for a given account address.

author(): H160

  • interface:

  • runtime: EthereumRuntimeRPCApi_author

  • summary: Returns the converted FindAuthor::find_author authority id.

call(from: H160, to: H160, data: Vec<u8>, value: U256, gasLimit: U256, maxFeePerGas: Option<U256>, maxPriorityFeePerGas: Option<U256>, nonce: Option<U256>, estimate: bool, accessList: Option<Vec<(H160, Vec<H256>)>>): Result<EvmCallInfo, DispatchError>

  • interface:

  • runtime: EthereumRuntimeRPCApi_call

  • summary: Returns a pallet_ethereum::call response.

chainId(): u64

  • interface:

  • runtime: EthereumRuntimeRPCApi_chain_id

  • summary: Returns runtime defined pallet_evm::ChainId.

create(from: H160, data: Vec<u8>, value: U256, gasLimit: U256, maxFeePerGas: Option<U256>, maxPriorityFeePerGas: Option<U256>, nonce: Option<U256>, estimate: bool, accessList: Option<Vec<(H160, Vec<H256>)>>): Result<EvmCreateInfo, DispatchError>

  • interface:

  • runtime: EthereumRuntimeRPCApi_create

  • summary: Returns a pallet_ethereum::call response.

currentAll(): (Option<BlockV2>, Option<Vec<EthReceiptV3>>, Option<Vec<EthTransactionStatus>>)

  • interface:

  • runtime: EthereumRuntimeRPCApi_current_all

  • summary: Returns all the current data for a block in a single runtime call.

currentBlock(): BlockV2

  • interface:

  • runtime: EthereumRuntimeRPCApi_current_block

  • summary: Returns the current block.

currentReceipts(): Option<Vec<EthReceiptV3>>

  • interface:

  • runtime: EthereumRuntimeRPCApi_current_receipts

  • summary: Returns the current receipt.

currentTransactionStatuses(): Option<Vec<EthTransactionStatus>>

  • interface:

  • runtime: EthereumRuntimeRPCApi_current_transaction_statuses

  • summary: Returns the current transaction status.

elasticity(): Option<Permill>

  • interface:

  • runtime: EthereumRuntimeRPCApi_elasticity

  • summary: Returns the elasticity multiplier.

extrinsicFilter(xts: Vec<Extrinsic>): Vec<TransactionV2>

  • interface:

  • runtime: EthereumRuntimeRPCApi_extrinsic_filter

  • summary: Receives a Vec<OpaqueExtrinsic> and filters all the ethereum transactions.

gasPrice(): u256

  • interface:

  • runtime: EthereumRuntimeRPCApi_gas_price

  • summary: Returns FixedGasPrice::min_gas_price

storageAt(address: H160, index: u256): H256

  • interface:

  • runtime: EthereumRuntimeRPCApi_storage_at

  • summary: Returns pallet_evm::AccountStorages for a given account address and index.


currentSetId(): SetId

  • interface:

  • runtime: GrandpaApi_current_set_id

  • summary: Gets current GRANDPA authority set id.

generateKeyOwnershipProof(setId: SetId, authorityId: AuthorityId): Option<OpaqueKeyOwnershipProof>

  • interface:

  • runtime: GrandpaApi_generate_key_ownership_proof

  • summary: Generates a proof of key ownership for the given authority in the given set.

grandpaAuthorities(): AuthorityList

  • interface:

  • runtime: GrandpaApi_grandpa_authorities

  • summary: Gets the current GRANDPA authorities and weights. This should not change except when changes are scheduled and the corresponding delay has passed.

submitReportEquivocationUnsignedExtrinsic(equivocationProof: GrandpaEquivocationProof, keyOwnerProof: OpaqueKeyOwnershipProof): Option<Null>

  • interface:

  • runtime: GrandpaApi_submit_report_equivocation_unsigned_extrinsic

  • summary: Submits an unsigned extrinsic to report an equivocation.


metadata(): OpaqueMetadata

  • interface:

  • runtime: Metadata_metadata

  • summary: Returns the metadata of a runtime.


offchainWorker(header: Header): Null

  • interface:

  • runtime: OffchainWorkerApi_offchain_worker

  • summary: Starts the off-chain task for the given block header.


decodeSessionKeys(encoded: Bytes): Option<Vec<(Bytes, KeyTypeId)>>

  • interface:

  • runtime: SessionKeys_decode_session_keys

  • summary: Decodes the given public session keys.

generateSessionKeys(seed: Option<Bytes>): Bytes

  • interface:

  • runtime: SessionKeys_generate_session_keys

  • summary: Generates a set of session keys with optionally using the given seed.


validateTransaction(source: TransactionSource, tx: Extrinsic, blockHash: BlockHash): TransactionValidity

  • interface:

  • runtime: TaggedTransactionQueue_validate_transaction

  • summary: Validates the transaction.


queryFeeDetails(uxt: Extrinsic, len: u32): FeeDetails

  • interface:

  • runtime: TransactionPaymentApi_query_fee_details

  • summary: The transaction fee details.

queryInfo(uxt: Extrinsic, len: u32): RuntimeDispatchInfo

  • interface:

  • runtime: TransactionPaymentApi_query_info

  • summary: The transaction info.

Last updated