Skip to content

JSON-RPC APIs

To enable a software application to interact with the blockchain, JSON RPC is the preferred method. Darwinia provides an Ethereum-compatible JSON RPC endpoint, allowing developers to seamlessly interact with the Darwinia node just as they would with Ethereum API. While these APIs strive for high compatibility with Ethereum, it's important to acknowledge that there may be variations, particularly in relation to the consensus mechanism. The details of these differences will be explained in the accompanying guide.

Note

✅ means the method is fully compatible with the Ethereum, and ❌ means it is not.

Supported API Methods

eth_protocolVersion

  • Returns the current Ethereum protocol version.
  • Compatible Issue: returns 1 by default.

eth_submitHashrate

  • Used for submitting mining hashrate.
  • Compatible Issue: returns "0x0" by default

eth_submitWork

  • Used for submitting a proof-of-work solution.
  • Compatible Issue: returns false by default.

eth_getWork

  • Returns the hash of the current block, the seedHash, and the boundary condition to be met ("target").
  • Compatible Issue: returns null by default

eth_mining

  • Returns true if client is actively mining new blocks.
  • Compatible Issue: returns false by default

eth_hashrate

  • Returns the number of hashes per second that the node is mining with.
  • Compatible Issue: returns false by default.

eth_getUncleByBlockHashAndIndex

  • Returns information about a uncle of a block by hash and uncle index position.
  • Compatible Issue: returns null by default

eth_getUncleByBlockNumberAndIndex

  • Returns information about a uncle of a block by number and uncle index position.
  • Compatible Issue: returns null by default

eth_getUncleCountByBlockHash

  • Returns the number of uncles in a block from a block matching the given block hash.
  • Compatible Issue: returns null by default

eth_getUncleCountByBlockNumber

  • Returns the number of uncles in a block from a block matching the given block number.
  • Compatible Issue: returns null by default

eth_accounts

  • Returns a list of addresses owned by client.

eth_blockNumber

  • Returns the number of most recent block.

eth_call

  • Executes a new message call immediately without creating a transaction on the block chain.

eth_chainId

  • Returns the chain ID used for signing replay-protected transactions.

eth_coinbase

  • Returns the latest block author.

eth_estimateGas

  • Generates and returns an estimate of how much gas is necessary to allow the transaction to complete. The transaction will not be added to the blockchain. Note that the estimate may be significantly more than the amount of gas actually used by the transaction, for a variety of reasons including EVM mechanics and node performance.

eth_feeHistory

  • Returns a collection of historical gas information from which you can decide what to submit as your maxFeePerGas and/or maxPriorityFeePerGas. This method was introduced with EIP 1559.

eth_gasPrice

  • Returns the current price per gas in wei.

eth_maxPriorityFeePerGas

  • Generally you will use the value returned from this method to set the maxFeePerGas in a subsequent transaction that you are submitting. This method was introduced with EIP 1559.

eth_sendRawTransaction

  • Creates new message call transaction or a contract creation for signed transactions.

eth_sendTransaction

  • Creates new message call transaction or a contract creation, if the data field contains code.

eth_getBalance

  • Returns the balance of the account of given address.

eth_getBlockByHash

  • Returns information about a block by hash.

eth_getBlockByNumber

  • Returns information about a block by block number.

eth_getBlockTransactionCountByHash

  • Returns the number of transactions in a block from a block matching the given block hash.

eth_getBlockTransactionCountByNumber

  • Returns the number of transactions in a block matching the given block number.

eth_getCode

  • Returns code at a given address.

eth_getStorageAt

  • Returns the value from a storage position at a given address.

eth_getTransactionByBlockHashAndIndex

  • Returns information about a transaction by block hash and transaction index position.

eth_getTransactionByBlockNumberAndIndex

  • Returns information about a transaction by block number and transaction index position.

eth_getTransactionByHash

  • Returns the information about a transaction requested by transaction hash.

eth_getTransactionCount

  • Returns the number of transactions sent from an address.

eth_getTransactionReceipt

  • Returns the receipt of a transaction by transaction hash.

eth_newFilter

  • Creates a filter object, based on filter options, to notify when the state changes (logs). To check if the state has changed, call eth_getFilterChanges.

eth_newBlockFilter

  • Creates a filter in the node, to notify when a new block arrives. To check if the state has changed, call eth_getFilterChanges.

eth_newPendingTransactionFilter

  • Creates a filter in the node, to notify when new pending transactions arrive. To check if the state has changed, call eth_getFilterChanges.

eth_getLogs

  • Returns an array of all logs matching a given filter object.

eth_getFilterLogs

  • Returns an array of all logs matching a given filter object.

eth_getFilterChanges

  • Polling method for a filter, which returns an array of logs which occurred since last poll.

eth_uninstallFilter

  • Uninstalls a filter with given id. Should always be called when watch is no longer needed. Additionally Filters timeout when they aren't requested with eth_getFilterChanges for a period of time.

eth_subscribe

  • Creates a new subscription for desired events. Sends data as soon as it occurs.

eth_unsubscribe

  • cancels the subscription given by its ID

eth_syncing

  • Returns an object with data about the sync status or false.

web3_clientVersion

  • Returns the current client version.

web3_sha3

  • Returns Keccak-256 (not the standardized SHA3-256) of the given data.

txpool_content

  • List the exact details of all the transactions currently pending for inclusion in the next block(s), as well as the ones that are being scheduled for future execution only.

txpool_inspect

  • List a textual summary of all the transactions currently pending for inclusion in the next block(s), as well as the ones that are being scheduled for future execution only.

txpool_status

  • For the number of transactions currently pending for inclusion in the next block(s), as well as the ones that are being scheduled for future execution only.

debug_traceBlockByNumber

  • Replays the block that matching the given block number.
  • Note: Only accessible on the EVM-tracing node.

debug_traceBlockByHash

  • Replays the block that matching the given block hash.
  • Note: Only accessible on the EVM-tracing node.

debug_traceTransaction

  • Attempts to run the transaction in the exact same manner as it was executed on the network. It will replay any transaction that may have been executed prior to this one before it and will then attempt to execute the transaction that corresponds to the given hash.
  • Note: Only accessible on the EVM-tracing node.

trace_filter

  • Returns traces matching given filter.
  • Note: Only accessible on the EVM-tracing node.