Skip to content

Supported Ethereum RPC Methods

Introduction

The Moonbeam team has collaborated closely with Parity on developing Frontier, an Ethereum compatibility layer for Substrate-based chains. This layer enables developers to run unmodified Ethereum dApps on Moonbeam seamlessly.

Nevertheless, not all Ethereum JSON-RPC methods are supported; some of those supported return default values (those related to Ethereum's PoW consensus mechanism in particular). This guide provides a comprehensive list of supported Ethereum JSON-RPC methods on Moonbeam. Developers can quickly reference this list to understand the available functionality for interfacing with Moonbeam's Ethereum-compatible blockchain.

Standard Ethereum JSON-RPC Methods

The basic JSON-RPC methods from the Ethereum API supported by Moonbeam are:

  • eth_protocolVersion — returns 1 by default
  • eth_syncing — returns an object with data about the sync status or false
  • eth_hashrate — returns "0x0" by default
  • eth_coinbase — returns the latest block author. Not necessarily a finalized block
  • eth_mining — returns false by default
  • eth_chainId — returns the chain ID used for signing at the current block
  • eth_gasPrice — returns the base fee per unit of gas used. This is currently the minimum gas price for each network
  • eth_accounts — returns a list of addresses owned by the client
  • eth_blockNumber — returns the highest available block number
  • eth_getBalance — returns the balance of the given address. Instead of providing a block number as a parameter, you can provide a default block parameter
  • eth_getStorageAt — returns the content of the storage at a given address. Instead of providing a block number as a parameter, you can provide a default block parameter
  • eth_getBlockByHash — returns information about the block of the given hash, including baseFeePerGas on post-London blocks
  • eth_getBlockByNumber — returns information about the block specified by block number, including baseFeePerGas on post-London blocks. Instead of providing a block number as the first parameter, you can provide a default block parameter
  • eth_getBlockReceipts — returns all transaction receipts for a given block
  • eth_getTransactionCount — returns the number of transactions sent from the given address (nonce). Instead of providing a block number as a parameter, you can provide a default block parameter
  • eth_getBlockTransactionCountByHash — returns the number of transactions in a block with a given block hash
  • eth_getBlockTransactionCountByNumber — returns the number of transactions in a block with a given block number
  • eth_getUncleCountByBlockHash — returns "0x0" by default
  • eth_getUncleCountByBlockNumber — returns "0x0" by default
  • eth_getCode — returns the code at the given address at the given block number. Instead of providing a block number as a parameter, you can provide a default block parameter
  • eth_sendTransaction — creates a new message call transaction or a contract creation, if the data field contains code. Returns the transaction hash or the zero hash if the transaction is not yet available
  • eth_sendRawTransaction — creates a new message call transaction or a contract creation for signed transactions. Returns the transaction hash or the zero hash if the transaction is not yet available
  • eth_call — executes a new message call immediately without creating a transaction on the blockchain, returning the value of the executed call
    • Moonbeam supports the use of the optional state override set object. This address-to-state mapping object allows the user to specify some state to be ephemerally overridden before executing a call to eth_call. The state override set is commonly used for tasks like debugging smart contracts. Visit the go-ethereum documentation to learn more
    • Instead of providing a block number as a parameter, you can provide a default block parameter
  • eth_estimateGas — returns an estimated amount of gas necessary for a given transaction to succeed. You can optionally specify a gasPrice or maxFeePerGas and maxPriorityFeePerGas. Instead of providing a block number as a parameter, you can provide a default block parameter
  • eth_maxPriorityFeePerGas - returns an estimate of how much priority fee, in Wei, is needed for inclusion in a block
  • eth_feeHistory — returns baseFeePerGas, gasUsedRatio, oldestBlock, and reward for a specified range of up to 1024 blocks
  • eth_getTransactionByHash — returns the information about a transaction with a given hash. EIP-1559 transactions have maxPriorityFeePerGas and maxFeePerGas fields
  • eth_getTransactionByBlockHashAndIndex — returns information about a transaction at a given block hash and a given index position. EIP-1559 transactions have maxPriorityFeePerGas and maxFeePerGas fields
  • eth_getTransactionByBlockNumberAndIndex — returns information about a transaction at a given block number and a given index position. EIP-1559 transactions have maxPriorityFeePerGas and maxFeePerGas fields. Instead of providing a block number as a parameter, you can provide a default block parameter
  • eth_getTransactionReceipt — returns the transaction receipt of a given transaction hash
  • eth_getUncleByBlockHashAndIndex — returns null by default
  • eth_getUncleByBlockNumberAndIndex — returns null by default
  • eth_getLogs — returns an array of all logs matching a given filter object. Instead of providing a block number as a parameter, you can provide a default block parameter
  • eth_newFilter — creates a filter object based on the input provided. Returns a filter ID
  • eth_newBlockFilter — creates a filter in the node to notify when a new block arrives. Returns a filter ID
  • eth_newPendingTransactionFilter - creates a filter in the node to notify when new pending transactions arrive. Returns a filter ID
  • eth_getFilterChanges — polling method for filters (see methods above). Returns an array of logs that occurred since the last poll
  • eth_getFilterLogs — returns an array of all the logs matching the filter with a given ID
  • eth_uninstallFilter — uninstall a filter with a given ID. It should be used when polling is no longer needed. Filters timeout when they are not requested using eth_getFilterChanges after some time

Default Block Parameters

Moonbeam supports several default block parameters that allow you to query a subset of JSON-RPC methods at significant block heights. Moonbeam supports the following default block parameters:

  • finalized - Refers to the most recent block that Polkadot validators have finalized
  • safe - Synonymous with finalized in Moonbeam. In Ethereum, safe refers to the most recent block that is considered safe by the network, meaning it is unlikely to be reverted but has not yet been finalized. With Moonbeam's fast and deterministic finality, finalized and safe refer to the same blocks.
  • earliest - Refers to the genesis block of the blockchain
  • pending - Represents the latest state, including pending transactions that have not yet been mined into a block. This is a live view of the mempool
  • latest - Refers to the latest confirmed block in the blockchain, which may not be finalized

Unsupported Ethereum JSON-RPC Methods

Moonbeam does not support the following Ethereum API JSON-RPC methods:

  • eth_getProof - returns the account and storage values of the specified account including the Merkle-proof
  • eth_blobBaseFee - returns the expected base fee for blobs in the next block
  • eth_createAccessList - creates an EIP-2930 type accessList based on a given transaction object
  • eth_sign - allows the user to sign an arbitrary hash to be sent at a later time. Presents a security risk as the arbitrary hash can be fraudulently applied to other transactions
  • eth_signTransaction - allows the user to sign a transaction to be sent at a later time. It is rarely used due to associated security risks

Additional RPC Methods

Check out some of the non-standard Ethereum and Moonbeam-specific RPC methods:

Last update: October 2, 2024
| Created: April 17, 2024