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

### **AccountNonceApi**

**accountNonce(accountId: `AccountId`): `Index`**

* **interface**: `api.call.accountNonceApi.accountNonce`
* **runtime**: `AccountNonceApi_account_nonce`
* **summary**: The API to query account nonce (aka transaction index).

###

### **AuraApi**

**authorities(): `Vec<AuthorityId>`**

* **interface**: `api.call.auraApi.authorities`
* **runtime**: `AuraApi_authorities`
* **summary**: Returns the current set of authorities.

**slotDuration(): `SlotDuration`**

* **interface**: `api.call.auraApi.slotDuration`
* **runtime**: `AuraApi_slot_duration`
* **summary**: Returns the slot duration for Aura.

###

### **BlockBuilder**

**applyExtrinsic(extrinsic: `Extrinsic`): `ApplyExtrinsicResult`**

* **interface**: `api.call.blockBuilder.applyExtrinsic`
* **runtime**: `BlockBuilder_apply_extrinsic`
* **summary**: Applies the given extrinsic.

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

* **interface**: `api.call.blockBuilder.checkInherents`
* **runtime**: `BlockBuilder_check_inherents`
* **summary**: Checks that the inherents are valid.

**finalizeBlock(): `Header`**

* **interface**: `api.call.blockBuilder.finalizeBlock`
* **runtime**: `BlockBuilder_finalize_block`
* **summary**: Finishes the current block.

**inherentExtrinsics(inherent: `InherentData`): `Vec<Extrinsic>`**

* **interface**: `api.call.blockBuilder.inherentExtrinsics`
* **runtime**: `BlockBuilder_inherent_extrinsics`
* **summary**: Generates inherent extrinsics.

###

### **ConvertTransactionRuntimeApi**

**convertTransaction(transaction: `TransactionV2`): `Extrinsic`**

* **interface**: `api.call.convertTransactionRuntimeApi.convertTransaction`
* **runtime**: `ConvertTransactionRuntimeApi_convert_transaction`
* **summary**: Converts an Ethereum-style transaction to Extrinsic

###

### **Core**

**executeBlock(block: `Block`): `Null`**

* **interface**: `api.call.core.executeBlock`
* **runtime**: `Core_execute_block`
* **summary**: Executes the given block.

**initializeBlock(header: `Header`): `Null`**

* **interface**: `api.call.core.initializeBlock`
* **runtime**: `Core_initialize_block`
* **summary**: Initializes a block with the given header.

**version(): `RuntimeVersion`**

* **interface**: `api.call.core.version`
* **runtime**: `Core_version`
* **summary**: Returns the version of the runtime.

###

### **DebugRuntimeApi**

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

* **interface**: `api.call.debugRuntimeApi.traceBlock`
* **runtime**: `DebugRuntimeApi_trace_block`
* **summary**: Traces all block extrinsics.

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

* **interface**: `api.call.debugRuntimeApi.traceTransaction`
* **runtime**: `DebugRuntimeApi_trace_transaction`
* **summary**: Traces transaction extrinsics.

###

### **EthereumRuntimeRPCApi**

**accountBasic(address: `H160`): `EvmAccount`**

* **interface**: `api.call.ethereumRuntimeRPCApi.accountBasic`
* **runtime**: `EthereumRuntimeRPCApi_account_basic`
* **summary**: Returns pallet\_evm::Accounts basic information by address.

**accountCodeAt(address: `H160`): `Bytes`**

* **interface**: `api.call.ethereumRuntimeRPCApi.accountCodeAt`
* **runtime**: `EthereumRuntimeRPCApi_account_code_at`
* **summary**: Returns pallet\_evm::AccountCodes for a given account address.

**author(): `H160`**

* **interface**: `api.call.ethereumRuntimeRPCApi.author`
* **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**: `api.call.ethereumRuntimeRPCApi.call`
* **runtime**: `EthereumRuntimeRPCApi_call`
* **summary**: Returns a pallet\_ethereum::call response.

**chainId(): `u64`**

* **interface**: `api.call.ethereumRuntimeRPCApi.chainId`
* **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**: `api.call.ethereumRuntimeRPCApi.create`
* **runtime**: `EthereumRuntimeRPCApi_create`
* **summary**: Returns a pallet\_ethereum::call response.

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

* **interface**: `api.call.ethereumRuntimeRPCApi.currentAll`
* **runtime**: `EthereumRuntimeRPCApi_current_all`
* **summary**: Returns all the current data for a block in a single runtime call.

**currentBlock(): `BlockV2`**

* **interface**: `api.call.ethereumRuntimeRPCApi.currentBlock`
* **runtime**: `EthereumRuntimeRPCApi_current_block`
* **summary**: Returns the current block.

**currentReceipts(): `Option<Vec<EthReceiptV3>>`**

* **interface**: `api.call.ethereumRuntimeRPCApi.currentReceipts`
* **runtime**: `EthereumRuntimeRPCApi_current_receipts`
* **summary**: Returns the current receipt.

**currentTransactionStatuses(): `Option<Vec<EthTransactionStatus>>`**

* **interface**: `api.call.ethereumRuntimeRPCApi.currentTransactionStatuses`
* **runtime**: `EthereumRuntimeRPCApi_current_transaction_statuses`
* **summary**: Returns the current transaction status.

**elasticity(): `Option<Permill>`**

* **interface**: `api.call.ethereumRuntimeRPCApi.elasticity`
* **runtime**: `EthereumRuntimeRPCApi_elasticity`
* **summary**: Returns the elasticity multiplier.

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

* **interface**: `api.call.ethereumRuntimeRPCApi.extrinsicFilter`
* **runtime**: `EthereumRuntimeRPCApi_extrinsic_filter`
* **summary**: Receives a `Vec<OpaqueExtrinsic>` and filters all the ethereum transactions.

**gasPrice(): `u256`**

* **interface**: `api.call.ethereumRuntimeRPCApi.gasPrice`
* **runtime**: `EthereumRuntimeRPCApi_gas_price`
* **summary**: Returns FixedGasPrice::min\_gas\_price

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

* **interface**: `api.call.ethereumRuntimeRPCApi.storageAt`
* **runtime**: `EthereumRuntimeRPCApi_storage_at`
* **summary**: Returns pallet\_evm::AccountStorages for a given account address and index.&#x20;

###

### **GrandpaApi**

**currentSetId(): `SetId`**

* **interface**: `api.call.grandpaApi.currentSetId`
* **runtime**: `GrandpaApi_current_set_id`
* **summary**: Gets current GRANDPA authority set id.

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

* **interface**: `api.call.grandpaApi.generateKeyOwnershipProof`
* **runtime**: `GrandpaApi_generate_key_ownership_proof`
* **summary**: Generates a proof of key ownership for the given authority in the given set.

**grandpaAuthorities(): `AuthorityList`**

* **interface**: `api.call.grandpaApi.grandpaAuthorities`
* **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**: `api.call.grandpaApi.submitReportEquivocationUnsignedExtrinsic`
* **runtime**: `GrandpaApi_submit_report_equivocation_unsigned_extrinsic`
* **summary**: Submits an unsigned extrinsic to report an equivocation.

###

### **Metadata**

**metadata(): `OpaqueMetadata`**

* **interface**: `api.call.metadata.metadata`
* **runtime**: `Metadata_metadata`
* **summary**: Returns the metadata of a runtime.

###

### **OffchainWorkerApi**

**offchainWorker(header: `Header`): `Null`**

* **interface**: `api.call.offchainWorkerApi.offchainWorker`
* **runtime**: `OffchainWorkerApi_offchain_worker`
* **summary**: Starts the off-chain task for the given block header.

###

### **SessionKeys**

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

* **interface**: `api.call.sessionKeys.decodeSessionKeys`
* **runtime**: `SessionKeys_decode_session_keys`
* **summary**: Decodes the given public session keys.

**generateSessionKeys(seed: `Option<Bytes>`): `Bytes`**

* **interface**: `api.call.sessionKeys.generateSessionKeys`
* **runtime**: `SessionKeys_generate_session_keys`
* **summary**: Generates a set of session keys with optionally using the given seed.

###

### **TaggedTransactionQueue**

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

* **interface**: `api.call.taggedTransactionQueue.validateTransaction`
* **runtime**: `TaggedTransactionQueue_validate_transaction`
* **summary**: Validates the transaction.

###

### **TransactionPaymentApi**

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

* **interface**: `api.call.transactionPaymentApi.queryFeeDetails`
* **runtime**: `TransactionPaymentApi_query_fee_details`
* **summary**: The transaction fee details.

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

* **interface**: `api.call.transactionPaymentApi.queryInfo`
* **runtime**: `TransactionPaymentApi_query_info`
* **summary**: The transaction info.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.bifrostnetwork.com/bifrost-network/developer-documentations/client-api/runtime-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
