API Methods
ADMIN
methods
ADMIN
methodsThe ADMIN
API methods provide administrative functionality to manage your node.
Note
The ADMIN
API methods are not enabled by default for JSON-RPC. To enable the ADMIN
API methods, use the --rpc-http-api
or --rpc-ws-api
options.
admin_addPeer
admin_addPeer
Adds a static node.
Caution
If connections are timing out, ensure the node ID in the enode URL is correct.
Parameters
enode
: string - enode URL of peer to add
Returns
result
: boolean - true
if peer added or false
if peer already a static node
Example
curl HTTP request
wscat WS requestJSON result
admin_changeLogLevel
admin_changeLogLevel
Changes the log level without restarting Besu. You can change the log level for all logs, or you can change the log level for specific packages or classes.
You can specify only one log level per RPC call.
Parameters
level
: string - log levellog_filter
: array - (optional) packages or classes for which to change the log level
Returns
result
: string - Success
if the log level has changed, otherwise error
Example
The following example changes the debug level for specified classes to DEBUG
.
curl HTTP request
wscat WS requestJSON result
The following example changes the debug level of all logs to WARN
.
curl HTTP request
wscat WS requestJSON result
admin_generateLogBloomCache
admin_generateLogBloomCache
Generates cached log bloom indexes for blocks. APIs such as eth_getLogs
and eth_getFilterLogs
use the cache for improved performance.
Tip
Manually executing admin_generateLogBloomCache
is not required unless the --auto-log-bloom-caching-enabled
command line option is set to false.
Note
Each index file contains 100000 blocks. The last fragment of blocks less than 100000 are not indexed.
Parameters
startBlock
: string - block to start generating indexesendBlock
: string - block to stop generating indexes
Returns
result
: object - log bloom index details:
startBlock
: string - starting block for the last requested cache generationendBlock
: string - ending block for the last requested cache generationcurrentBlock
: string - most recent block added to the cacheindexing
: boolean - indicates if indexing is in progressboolean - indicates acceptance of the request from this call to generate the cache
Example
curl HTTP request
wscat WS requestJSON result
admin_logsRemoveCache
admin_logsRemoveCache
Removes cache files for the specified range of blocks.
Parameters
fromBlock
: string - integer representing a block number or one of the string tagslatest
,earliest
, orpending
, as described in Block ParametertoBlock
: string - integer representing a block number or one of the string tagslatest
,earliest
, orpending
, as described in Block Parameter
You can skip a parameter by using an empty string, ""
. If you specify:
No parameters, the call removes cache files for all blocks.
Only
fromBlock
, the call removes cache files for the specified block.Only
toBlock
, the call removes cache files from the genesis block to the specified block.
Returns
result
: object - Cache Removed
status or error
.
Example
curl HTTP request
wscat WS requestJSON result
admin_logsRepairCache
admin_logsRepairCache
Repairs cached logs by fixing all segments starting with the specified block number.
Parameters
startBlock
: string - decimal index of the starting block to fix; defaults to the head block
Returns
result
: object - status of the repair request; Started
or Already running
Example
curl HTTP request
wscat WS requestJSON result
admin_nodeInfo
admin_nodeInfo
Returns networking information about the node. The information includes general information about the node and specific information from each running Ethereum sub-protocol (for example, eth
).
Parameters
None
Returns
result
: object - node object with the following fields:
enode
: string - enode URL of the nodelistenAddr
: string - host and port for the nodename
: string - client nameid
: string - node public keyports
: object - peer discovery and listening portsprotocols
: object - list of objects containing information for each Ethereum sub-protocol
Note
If the node is running locally, the host of the enode
and listenAddr
display as [::]
in the result. When advertising externally, the external address displayed for the enode
and listenAddr
is defined by --nat-method
.
Example
curl HTTP request
wscat WS requestJSON result
admin_peers
admin_peers
Returns networking information about connected remote nodes.
Parameters
None
Returns
result
: array of objects - list of objects returned for each remote node, with the following fields.
version
: string - P2P protocol versionname
: string - client namecaps
: array of strings - list of Ethereum sub-protocol capabilitiesnetwork
: object - local and remote addresses established at time of bonding with the peer (the remote address might not match the hex value forport
; it depends on which node initiated the connection.)port
: string - port on the remote node on which P2P discovery is listeningid
: string - node public key (excluding the0x
prefix, the node public key is the ID in the enode URLenode://<id ex 0x>@<host>:<port>
.)protocols
: object - current state of peer includingdifficulty
andhead
(head
is the hash of the highest known block for the peer.)enode
: string - enode URL of the remote node
Example
curl HTTP request
wscat WS requestJSON result
admin_removePeer
admin_removePeer
Removes a static node.
Parameters
enode
: string - enode URL of peer to remove
Returns
result
: boolean - true
if peer removed or false
if peer not a static node
Example
curl HTTP request
wscat WS requestJSON result
CLIQUE
methods
CLIQUE
methodsThe CLIQUE
API methods provide access to the Clique consensus engine.
Note
The CLIQUE
API methods are not enabled by default for JSON-RPC. To enable the CLIQUE
API methods use the --rpc-http-api
or --rpc-ws-api
options.
clique_discard
clique_discard
Discards a proposal to add or remove a signer with the specified address.
Parameters
address
: string - 20-byte address of proposed signer
Returns
result
: boolean - indicates if the proposal is discarded
Example
curl HTTP request
wscat WS requestJSON result
clique_getSigners
clique_getSigners
Lists signers for the specified block.
Parameters
blockNumber
: string - integer representing a block number or one of the string tags latest
, earliest
, or pending
, as described in Block Parameter
Returns
result
: array of string - list of 20-byte addresses of signers
Example
curl HTTP request
wscat WS requestJSON result
clique_getSignerMetrics
clique_getSignerMetrics
Provides the following validator metrics for the specified range:
Number of blocks from each validator
Block number of the last block proposed by each validator (if any proposed in the specified range)
All validators present in the last block
Parameters
fromBlockNumber
: string - integer representing a block number or the string tagearliest
, as described in Block ParametertoBlockNumber
: string - integer representing a block number or one of the string tagslatest
orpending
, as described in Block Parameter
If you specify:
No parameters, the call provides metrics for the last 100 blocks, or all blocks if there are less than 100 blocks.
Only the first parameter, the call provides metrics for all blocks from the block specified to the latest block.
Returns
result
: array of objects - list of validator objects
Note
The proposer of the genesis block has address 0x0000000000000000000000000000000000000000
.
Example
curl HTTP
wscat WSJSON result
clique_getSignersAtHash
clique_getSignersAtHash
Lists signers for the specified block.
Parameters
hash
: string - 32-byte block hash
Returns
result
: array of string - list of 20-byte addresses of signers
Example
curl HTTP request
wscat WS requestJSON result
clique_proposals
clique_proposals
Returns current proposals.
Parameters
None
Returns
result
: map of strings to booleans - map of account addresses to corresponding boolean values indicating the proposal for each account (if true
, the proposal is to add a signer; if false
, the proposal is to remove a signer.)
Example
curl HTTP request
wscat WS requestJSON result
clique_propose
clique_propose
Proposes to add or remove a signer with the specified address.
Parameters
address
: string - 20-byte addressproposal
: boolean -true
to propose adding signer orfalse
to propose removing signer
Returns
result
: boolean - true
Example
curl HTTP request
wscat WS requestJSON result
DEBUG
methods
DEBUG
methodsThe DEBUG
API methods allow you to inspect and debug the network. The DEBUG
API is a more verbose alternative to the TRACE
API, and its main purpose is compatibility with tools such as Remix. We recommend using the TRACE
API for production use over the DEBUG
API.
Note
The DEBUG
API methods are not enabled by default for JSON-RPC. To enable the DEBUG
API methods, use the --rpc-http-api
or --rpc-ws-api
options.
debug_accountRange
debug_accountRange
Retesteth uses debug_accountRange
to implement debugging.
Returns the accounts for a specified block.
Parameters
blockHashOrNumber
: string - block hash or numbertxIndex
: number - transaction index from which to startaddress
: string - address hash from which to startlimit
: integer - maximum number of account entries to return
Returns
result
: object - account details object with the following fields:
addressMap
: map of strings to strings - map of address hashes and account addressesnextKey
: string - hash of the next address if any addresses remain in the state, otherwise zero
Example
curl HTTP request
wscat WS requestJSON result
debug_batchSendRawTransaction
debug_batchSendRawTransaction
Sends a list of signed transactions. This is used to quickly load a network with a lot of transactions. This does the same thing as calling eth_sendRawTransaction
multiple times.
Parameters
data
: string - signed transaction data array
Returns
result
: array of objects - object returned for each transaction, with the following fields:
index
: string - index of the transaction in the request parameters arraysuccess
: boolean - indicates whether or not the transaction has been added to the transaction poolerrorMessage
: string - (optional) error message
Example
curl HTTP
wscat WSJSON result
debug_getBadBlocks
debug_getBadBlocks
Returns a list of invalid blocks. This is used to detect and analyze consensus flaws.
Parameters
None
Returns
result
: array of objects - list of block objects
Example
curl HTTP
wscat WSJSON result
debug_standardTraceBlockToFile
debug_standardTraceBlockToFile
Generates files containing the block trace. A separate file is generated for each transaction in the block.
You can also specify a trace file for a specific transaction in a block.
Use debug_standardTraceBadBlockToFile
to view the trace for an invalid block.
Parameters
blockHash
: string - block hash
txHash
: string - (optional) transaction hash; if omitted, a trace file is generated for each transaction in the block.
disableMemory
: boolean - (optional) specifies whether to capture EVM memory during the trace; defaults to true
Returns
result
: string - location of the generated trace files
Example
curl HTTP request
wscat WS requestJSON result
debug_standardTraceBadBlockToFile
debug_standardTraceBadBlockToFile
Generates files containing the block trace of invalid blocks. A separate file is generated for each transaction in the block.
Use debug_standardTraceBlockToFile
to view the trace for a valid block.
Parameters
blockHash
: string - block hash
Returns
result
: string - location of the generated trace files
Example
curl HTTP request
wscat WS requestJSON result
debug_storageRangeAt
debug_storageRangeAt
Remix uses debug_storageRangeAt
to implement debugging. Use the Debugger tab in Remix instead of calling debug_storageRangeAt
directly.
Returns the contract storage for the specified range.
Parameters
blockHash
: string - block hashtxIndex
: number - transaction index from which to startaddress
: string - contract addressstartKey
: string - start keylimit
: number - number of storage entries to return
Returns
result
: object - range object.
Example
curl HTTP request
wscat WS requestJSON result
debug_metrics
debug_metrics
Returns metrics providing information on the internal operation of Besu.
The available metrics might change over time. The JVM metrics might vary based on the JVM implementation used.
The metric types are:
Timer
Counter
Gauge
Parameters
None
Returns
result
: object - metrics object
Example
curl HTTP request
wscat WS requestJSON result
debug_traceTransaction
debug_traceTransaction
Remix uses debug_traceTransaction
to implement debugging. Use the Debugger tab in Remix instead of calling debug_traceTransaction
directly.
Reruns the transaction with the same state as when the transaction executed.
Parameters
transactionHash
: string - transaction hashoptions
: object - request options object with the following fields (all optional and default tofalse
):disableStorage
: boolean -true
disables storage capture.disableMemory
: boolean -true
disables memory capture.disableStack
: boolean -true
disables stack capture.
Returns
result
: object - trace object
Example
curl HTTP request
wscat WS requestJSON result
debug_traceBlock
debug_traceBlock
Returns full trace of all invoked opcodes of all transactions included in the block.
Parameters
block
: string - RLP of the blockoptions
: object - request options object with the following fields (all optional and default tofalse
):disableStorage
: boolean -true
disables storage capture.disableMemory
: boolean -true
disables memory capture.disableStack
: boolean -true
disables stack capture.
Returns
result
: object - trace object
Example
curl HTTP request
wscat WS requestJSON result
debug_traceBlockByHash
debug_traceBlockByHash
Returns full trace of all invoked opcodes of all transactions included in the block.
Parameters
blockHash
: string - block hashoptions
: object - request options object with the following fields (all optional and default tofalse
):disableStorage
: boolean -true
disables storage capture.disableMemory
: boolean -true
disables memory capture.disableStack
: boolean -true
disables stack capture.
Returns
result
: array of objects - list of trace objects
Example
curl HTTP request
wscat WS requestJSON result
debug_traceBlockByNumber
debug_traceBlockByNumber
Returns full trace of all invoked opcodes of all transactions included in the block.
Parameters
blockNumber
: string - integer representing a block number or one of the string tagslatest
,earliest
, orpending
, as described in Block Parameteroptions
: object - request options object with the following fields (all optional and default tofalse
):disableStorage
: boolean -true
disables storage capture.disableMemory
: boolean -true
disables memory capture.disableStack
: boolean -true
disables stack capture.
Returns
result
: array of objects - list of trace objects
Example
curl HTTP request
wscat WS requestJSON result
EEA
methods
EEA
methodsThe EEA
API methods provide functionality for private transactions and privacy groups.
Note
The EEA
API methods are not enabled by default for JSON-RPC. To enable the EEA
API methods, use the --rpc-http-api
or --rpc-ws-api
options.
eea_sendRawTransaction
eea_sendRawTransaction
Distributes the private transaction, generates the privacy marker transaction and submits it to the transaction pool, and returns the transaction hash of the privacy marker transaction.
The signed transaction passed as an input parameter includes the privateFrom
, privateFor
or privacyGroupId
, and restriction
fields.
The gas
and gasPrice
are used by the privacy marker transaction not the private transaction itself.
To avoid exposing your private key, create signed transactions offline and send the signed transaction data using eea_sendRawTransaction
.
Important
For production systems requiring private transactions, use a network with a consensus mechanism supporting transaction finality to make sure the private state does not become inconsistent with the chain. For example, IBFT 2.0 and QBFT provide the required finality.
Using private transactions with pruning or fast sync is not supported.
Besu does not implement eea_sendTransaction
.
EthSigner provides transaction signing and implements eea_sendTransaction
.
Parameters
transaction
: string - signed RLP-encoded private transaction
Returns
result
: string - 32-byte transaction hash of the Privacy Marker Transaction
Tip
If creating a contract, use priv_getTransactionReceipt to retrieve the contract address after the transaction is finalized.
Example
curl HTTP request
wscat WS requestJSON result
ETH
methods
ETH
methodsThe ETH
API methods allow you to interact with the blockchain.
Note
Methods with an equivalent GraphQL query include a GraphQL request and result in the method example. The parameter and result descriptions apply to the JSON-RPC requests. The GraphQL specification is defined in the schema.
eth_accounts
eth_accounts
Returns a list of account addresses a client owns.
Note
This method returns an empty object because Besu doesn’t support key management inside the client.
To provide access to your key store and and then sign transactions, use EthSigner with Besu.
Parameters
None
Returns
result
: array of strings - list of 20-byte account addresses owned by the client
Example
curl HTTP request
wscat WS requestJSON result
eth_blockNumber
eth_blockNumber
Returns the index corresponding to the block number of the current chain head.
Parameters
None
Returns
result
: string - hexadecimal integer representing the index corresponding to the block number of the current chain head
Example
curl HTTP
wscat WSJSON resultcurl GraphQLGraphQLGraphQL result
eth_call
eth_call
Invokes a contract function locally and does not change the state of the blockchain.
You can interact with contracts using eth_sendRawTransaction
or eth_call
.
If revert reason is enabled with --revert-reason-enabled
, the eth_call
error response includes the revert reason.
Parameters
call
: object - transaction call object
blockNumber
: string - integer representing a block number or one of the string tags latest
, earliest
, or pending
, as described in Block Parameter
Note
By default, eth_call
does not fail if the sender account has an insufficient balance. This is done by setting the balance of the account to a large amount of ether. To enforce balance rules, set the strict
parameter in the transaction call object to true
.
Returns
result
: string - return value of the executed contract
Example
curl HTTP
wscat WSJSON resultcurl GraphQLGraphQLGraphQL result
eth_chainId
eth_chainId
Returns the chain ID.
Parameters
None
Returns
result
: string - chain ID in hexadecimal
Example
curl HTTP request
wscat WS requestJSON result
eth_coinbase
eth_coinbase
Returns the client coinbase address. The coinbase address is the account to pay mining rewards to.
To set a coinbase address, start Besu with the --miner-coinbase
option set to a valid Ethereum account address. You can get the Ethereum account address from a client such as MetaMask or Etherscan. For example:
Example
Parameters
None
Returns
result
: string - coinbase address
Example
curl HTTP request
wscat WS requestJSON result
eth_estimateGas
eth_estimateGas
Returns an estimate of the gas required for a transaction to complete. The estimation process does not use gas and the transaction is not added to the blockchain. The resulting estimate can be greater than the amount of gas the transaction ends up using, for reasons including EVM mechanics and node performance.
The eth_estimateGas
call does not send a transaction. You must call eth_sendRawTransaction
to execute the transaction.
If revert reason is enabled with --revert-reason-enabled
, the eth_estimateGas
error response includes the revert reason.
Parameters
For eth_estimateGas
, all fields are optional because setting a gas limit is irrelevant to the estimation process (unlike transactions, in which gas limits apply).
call
: object - transaction call object
Returns
result
: string - amount of gas used
Example of cost estimate of a value transaction
The following example returns an estimate of 21000 wei (0x5208
) for the transaction.
curl HTTP
wscat WSJSON resultcurl GraphQLGraphQLGraphQL result
Example of cost estimate of deploying a simple storage smart contract
The following example request estimates the cost of deploying a simple storage smart contract to the network. The data field contains the hash of the compiled contract you want to deploy. (You can get the compiled contract hash from your IDE, for example, Remix > Compile tab > details > WEB3DEPLOY.) The result is 113355 wei.
curl HTTP request
JSON result
eth_feeHistory
eth_feeHistory
Returns base fee per gas and transaction effective priority fee per gas history for the requested block range, allowing you to track trends over time.
Parameters
blockCount
: integer - Number of blocks in the requested range. Between 1 and 1024 blocks can be requested in a single query. If blocks in the specified block range are not available, then only the fee history for available blocks is returned.newestBlock
: string - Integer representing the highest number block of the requested range or one of the string tagslatest
,earliest
, orpending
, as described in Block parameter.
Returns
result
: object - Fee history results object.
Example
curl HTTP
wscat WSJSON result
eth_gasPrice
eth_gasPrice
Returns a percentile gas unit price for the most recent blocks, in Wei. By default, the last 100 blocks are examined and the 50th percentile gas unit price (that is, the median value) is returned.
If there are no blocks, the value for --min-gas-price
is returned. The value returned is restricted to values between --min-gas-price
and --api-gas-price-max
. By default, 1000 Wei and 500GWei.
Use the --api-gas-price-blocks
, --api-gas-price-percentile
, and --api-gas-price-max
command line options to configure the eth_gasPrice
default values.
Parameters
None
Returns
result
: string - percentile gas unit price for the most recent blocks, in Wei, as a hexadecimal value
Example
curl HTTP
wscat WSJSON resultcurl GraphQLGraphQLGraphQL result
eth_getBalance
eth_getBalance
Returns the account balance of the specified address.
Parameters
address
: string - 20-byte account address from which to retrieve the balanceblockNumber
: string - integer representing a block number or one of the string tagslatest
,earliest
, orpending
, as described in Block Parameter
Returns
result
: string - current balance, in Wei, as a hexadecimal value
Example
curl HTTP
wscat WSJSON resultcurl GraphQLGraphQLGraphQL result
eth_getBlockByHash
eth_getBlockByHash
Returns information about the block matching the specified block hash.
Parameters
hash
: string - 32-byte hash of a blockverbose
: boolean - iftrue
, returns the full transaction objects; iffalse
, returns the transaction hashes
Returns
result
: object - block object, or null
when there is no block
Example
curl HTTP
wscat WSJSON resultcurl GraphQLGraphQLGraphQL result
eth_getBlockByNumber
eth_getBlockByNumber
Returns information about the block matching the specified block number.
Parameters
blockNumber
: string - integer representing a block number or one of the string tagslatest
,earliest
, orpending
, as described in Block Parameterverbose
: boolean - iftrue
, returns the full transaction objects; iffalse
, returns only the hashes of the transactions.
Returns
result
: object - block object, or null
when there is no block.
Example
curl HTTP
wscat WSJSON resultcurl GraphQLGraphQLGraphQL result
eth_getBlockTransactionCountByHash
eth_getBlockTransactionCountByHash
Returns the number of transactions in the block matching the specified block hash.
Parameters
hash
: string - 32-byte block hash
Returns
result
: number - integer representing the number of transactions in the specified block, or null
if no matching block hash is found
Example
curl HTTP
wscat WSJSON resultcurl GraphQLGraphQLGraphQL result
eth_getBlockTransactionCountByNumber
eth_getBlockTransactionCountByNumber
Returns the number of transactions in a block matching the specified block number.
Parameters
blockNumber
: string - integer representing a block number or one of the string tags latest
, earliest
, or pending
, as described in Block Parameter
Returns
result
: string - integer representing the number of transactions in the specified block, or null
if no matching block number is found
Example
curl HTTP
wscat WSJSON resultcurl GraphQLGraphQLGraphQL result
eth_getCode
eth_getCode
Returns the code of the smart contract at the specified address. Besu stores compiled smart contract code as a hexadecimal value.
Parameters
address
: string - 20-byte contract address
blockNumber
: string - integer representing a block number or one of the string tags latest
, earliest
, or pending
, as described in Block Parameter
Returns
result
: data - code stored at the specified address
Example
curl HTTP
wscat WSJSON resultcurl GraphQLGraphQLGraphQL result
eth_getFilterChanges
eth_getFilterChanges
Polls the specified filter and returns an array of changes that have occurred since the last poll.
Parameters
filterId
: string - filter ID
Returns
result
: array of strings or objects - if nothing changed since the last poll, an empty list; otherwise:
For filters created with
eth_newBlockFilter
, returns block hashes.For filters created with
eth_newPendingTransactionFilter
, returns transaction hashes.For filters created with
eth_newFilter
, returns log objects.
Example
curl HTTP request
wscat WS requestJSON result
eth_getFilterLogs
eth_getFilterLogs
Returns an array of logs for the specified filter.
Leave the --auto-log-bloom-caching-enabled
command line option at the default value of true
to improve log retrieval performance.
Note
eth_getFilterLogs
is only used for filters created with eth_newFilter
. To specify a filter object and get logs without creating a filter, use eth_getLogs
.
Parameters
filterId
: string - filter ID
Returns
result
: array of objects - list of log objects
Example
curl HTTP request
wscat WS requestJSON result
eth_getLogs
eth_getLogs
Returns an array of logs matching a specified filter object.
Leave the --auto-log-bloom-caching-enabled
command line option at the default value of true
to improve log retrieval performance.
Attention
Using eth_getLogs
to get the logs from a large range of blocks, especially an entire chain from its genesis block, can cause Besu to hang and never return a response. We recommend splitting one large query into multiple ones for better performance.
Parameters
filterOptions
: object - filter options object
Returns
result
: array of objects - list of log objects
Example
curl HTTP
wscat WSJSON resultcurl GraphQLGraphQLGraphQL result
eth_getMinerDataByBlockHash
eth_getMinerDataByBlockHash
Returns miner data for the specified block.
Parameters
hash
: string - 32-byte block hash
Returns
result
: object - miner data object
Example
curl HTTP
wscat WSJSON result
eth_getMinerDataByBlockNumber
eth_getMinerDataByBlockNumber
Returns miner data for the specified block.
Parameters
blockNumber
: string - integer representing a block number or one of the string tags latest
, earliest
, or pending
, as described in Block Parameter
Returns
result
: object - miner data object
Example
curl HTTP
wscat WSJSON result
eth_getProof
eth_getProof
Returns the account and storage values of the specified account, including the Merkle proof.
The API allows IoT devices or mobile apps which are unable to run light clients to verify responses from untrusted sources, by using a trusted block hash.
Parameters
address
: string - 20-byte address of the account or contract
keys
: array of strings - list of 32-byte storage keys to generate proofs for
blockNumber
: string - integer representing a block number or one of the string tags latest
, earliest
, or pending
, as described in Block Parameter
Returns
result
: object - account details object with the following fields:
balance
: string - account balancecodeHash
: string - 32-byte hash of the account codenonce
: string - number of transactions sent from the accountstorageHash
: string - 32-byte SHA3 of thestorageRoot
accountProof
: array of strings - list of RLP-encoded Merkle tree nodes, starting with thestateRoot
storageProof
: array of objects - list of storage entry objects with the following fields:key
: string - storage keyvalue
: string - storage valueproof
: array of strings - list of RLP-encoded Merkle tree nodes, starting with thestorageHash
Example
curl HTTP
wscat WSJSON result
eth_getQuorumPayload
eth_getQuorumPayload
When using GoQuorum-compatible privacy, returns the unencrypted payload from Tessera.
Parameters
id
: string - the generated SHA3-512 hash of the encrypted payload from Tessera, in hex (the input
value in the transaction)
Returns
result
: string - unencrypted transaction payload in hex
Example
curl HTTP
wscat WSJSON result
eth_getStorageAt
eth_getStorageAt
Returns the value of a storage position at a specified address.
Parameters
address
: string - 20-byte storage address
index
: string - integer index of the storage position
blockNumber
: string - integer representing a block number or one of the string tags latest
, earliest
, or pending
, as described in Block Parameter
Returns
result
: string - value at the specified storage position
Example
Calculating the correct position depends on the storage you want to retrieve.
curl HTTP
wscat WSJSON resultcurl GraphQLGraphQLGraphQL result
eth_getTransactionByBlockHashAndIndex
eth_getTransactionByBlockHashAndIndex
Returns transaction information for the specified block hash and transaction index position.
Parameters
block
: string - 32-byte hash of a block
index
: string - integer representing the transaction index position
Returns
result
: object - transaction object, or null
when there is no transaction
Example
curl HTTP
wscat WSJSON resultcurl GraphQLGraphQLGraphQL result
eth_getTransactionByBlockNumberAndIndex
eth_getTransactionByBlockNumberAndIndex
Returns transaction information for the specified block number and transaction index position.
Parameters
blockNumber
: string - integer representing a block number or one of the string tags latest
, earliest
, or pending
, as described in Block Parameter
index
: string - transaction index position
Returns
result
: object - transaction object, or null
when there is no transaction
Example
This request returns the third transaction in the 82990 block on the Ropsten testnet. You can also view this block and transaction on Etherscan.
curl HTTP
wscat WSJSON resultcurl GraphQLGraphQLGraphQL result
eth_getTransactionByHash
eth_getTransactionByHash
Returns transaction information for the specified transaction hash.
Parameters
transaction
: string - 32-byte transaction hash
Returns
result
: object - transaction object, or null
when there is no transaction
Example
curl HTTP
wscat WSJSON resultcurl GraphQLGraphQLGraphQL result
eth_getTransactionCount
eth_getTransactionCount
Returns the number of transactions sent from a specified address. Use the pending
tag to get the next account nonce not used by any pending transactions.
Parameters
address
: string - 20-byte account address
blockNumber
: string - integer representing a block number or one of the string tags latest
, earliest
, or pending
, as described in Block Parameter
Returns
result
: string - integer representing the number of transactions sent from the specified address
Example
curl HTTP
wscat WSJSON resultcurl GraphQLGraphQLGraphQL result
eth_getTransactionReceipt
eth_getTransactionReceipt
Returns the receipt of a transaction by transaction hash. Receipts for pending transactions are not available.
If you enabled revert reason, the receipt includes available revert reasons in the response.
Parameters
transaction
: string - 32-byte hash of a transaction
Returns
result
: object - transaction receipt object, or null
when there is no receipt
Example
curl HTTP
wscat WSJSON resultcurl GraphQLGraphQLGraphQL result
eth_getUncleByBlockHashAndIndex
eth_getUncleByBlockHashAndIndex
Returns uncle specified by block hash and index.
Parameters
block
: string - 32-byte block hash
uncleIndex
: string - index of the uncle
Returns
result
: object - block object
Note
Uncles do not contain individual transactions.
Example
curl HTTP
wscat WSJSON resultcurl GraphQLGraphQLGraphQL result
eth_getUncleByBlockNumberAndIndex
eth_getUncleByBlockNumberAndIndex
Returns uncle specified by block number and index.
Parameters
blockNumber
: string - integer representing a block number or one of the string tagslatest
,earliest
, orpending
, as described in Block ParameteruncleIndex
: string - index of the uncle
Returns
result
: object - block object
Note
Uncles do not contain individual transactions.
Example
curl HTTP
wscat WSJSON resultcurl GraphQLGraphQLGraphQL result
eth_getUncleCountByBlockHash
eth_getUncleCountByBlockHash
Returns the number of uncles in a block from a block matching the given block hash.
Parameters
block
: string - 32-byte block hash
Returns
result
: string - integer representing the number of uncles in the specified block
Example
curl HTTP
wscat WSJSON resultcurl GraphQLGraphQLGraphQL result
eth_getUncleCountByBlockNumber
eth_getUncleCountByBlockNumber
Returns the number of uncles in a block matching the specified block number.
Parameters
blockNumber
: string - integer representing a block number or one of the string tags latest
, earliest
, or pending
, as described in Block Parameter
Returns
result
: string - integer representing the number of uncles in the specified block
Example
curl HTTP
wscat WSJSON resultcurl GraphQLGraphQLGraphQL result
eth_getWork
eth_getWork
Returns the hash of the current block, the seed hash, and the required target boundary condition.
Parameters
None
Returns
result
: array of strings - array with the following items:
header
: string - 32-byte hash of the current block header (PoW-hash)seed
: string - 32-byte seed hash used for the DAGtarget
: string - 32-byte required target boundary condition: 2^256 / difficultyblockNumber
: string - hexadecimal integer representing the current block number
Example
curl HTTP request
wscat WS requestJSON result
eth_hashrate
eth_hashrate
Returns the number of hashes per second with which the node is mining.
When the stratum server is enabled, this method returns the cumulative hashrate of all sealers reporting their hashrate.
Parameters
None
Returns
result
: string - number of hashes per second
Example
curl HTTP request
wscat WS requestJSON result
eth_mining
eth_mining
Whether the client is actively mining new blocks. Besu pauses mining while the client synchronizes with the network regardless of command settings or methods called.
Parameters
None
Returns
result
: boolean - indicates if the client is actively mining new blocks
Example
curl HTTP request
wscat WS requestJSON result
eth_newBlockFilter
eth_newBlockFilter
Creates a filter to retrieve new block hashes. To poll for new blocks, use eth_getFilterChanges
.
Parameters
None
Returns
result
: string - filter ID
Example
curl HTTP request
wscat WS requestJSON result
eth_newFilter
eth_newFilter
Creates a log filter. To poll for logs associated with the created filter, use eth_getFilterChanges
. To get all logs associated with the filter, use eth_getFilterLogs
.
Parameters
filterOptions
: object - filter options object
Note
fromBlock
and toBlock
in the filter options object default to latest
.
Returns
result
: string - filter ID
Example
curl HTTP request
wscat WS requestJSON result
eth_newPendingTransactionFilter
eth_newPendingTransactionFilter
Creates a filter to retrieve new pending transactions hashes. To poll for new pending transactions, use eth_getFilterChanges
.
Parameters
None
Returns
result
: string - filter ID
Example
curl HTTP request
wscat WS requestJSON result
eth_protocolVersion
eth_protocolVersion
Returns current Ethereum protocol version.
Parameters
None
Returns
result
: string - Ethereum protocol version
Example
curl HTTP
wscat WSJSON resultcurl GraphQLGraphQLGraphQL result
eth_sendRawTransaction
eth_sendRawTransaction
Sends a signed transaction. A transaction can send ether, deploy a contract, or interact with a contract. Set the maximum transaction fee for transactions using the --rpc-tx-feecap
CLI option.
You can interact with contracts using eth_sendRawTransaction
or eth_call
.
To avoid exposing your private key, create signed transactions offline and send the signed transaction data using eth_sendRawTransaction
.
Important
Besu does not implement eth_sendTransaction
.
EthSigner provides transaction signing and implements eth_sendTransaction
.
Parameters
Note
Creating and Sending Transactions includes examples of creating signed transactions using the web3.js library.
Returns
result
: string - 32-byte transaction hash
Example
curl HTTP
wscat WSJSON resultcurl GraphQLGraphQLGraphQL result
eth_submitHashrate
eth_submitHashrate
Submits the mining hashrate. This is used by mining software such as Ethminer.
Parameters
hashrate
: string - 32-byte hexadecimal string representation of the hashrateid
: string - 32-byte random hexadecimal ID identifying the client
Returns
result
: boolean - indicates if submission is successful
Example
curl HTTP request
wscat WS requestJSON result
eth_submitWork
eth_submitWork
Submits a proof of work (Ethash) solution. This is used by mining software such as Ethminer.
Parameters
nonce
: string - retrieved 8-byte nonceheader
: string - 32-byte hash of the block header (PoW-hash)digest
: string - 32-bytes mix digest
Returns
result
: boolean - indicates if the provided solution is valid
Example
curl HTTP request
wscat WS requestJSON result
eth_syncing
eth_syncing
Returns an object with data about the synchronization status, or false
if not synchronizing.
Note
Once the node reaches the head of the chain, eth_syncing
returns false, indicating that there is no active syncing target.
Parameters
None
Returns
result
: object or boolean - synchronization status data object with the following fields, or false
if not synchronizing:
startingBlock
: string - index of the highest block on the blockchain when the network synchronization startscurrentBlock
: string - index of the latest block (also known as the best block) for the current node (this is the same index thateth_blockNumber
returns.)highestBlock
: string - index of the highest known block in the peer network (that is, the highest block so far discovered among peer nodes. This is the same value ascurrentBlock
if the current node has no peers.)pulledStates
: string - if fast synchronizing, the number of state entries fetched so far, ornull
if this is not known or not relevant (if full synchronizing or fully synchronized, this field is not returned.)knownStates
: string - if fast synchronizing, the number of states the node knows of so far, ornull
if this is not known or not relevant (if full synchronizing or fully synchronized, this field is not returned.)
Example
curl HTTP
wscat WSJSON resultcurl GraphQLGraphQLGraphQL result
eth_uninstallFilter
eth_uninstallFilter
Uninstalls a filter with the specified ID. When a filter is no longer required, call this method.
Filters time out when not requested by eth_getFilterChanges
or eth_getFilterLogs
for 10 minutes.
Parameters
filterId
: string - filter ID
Returns
result
: boolean - indicates if the filter is successfully uninstalled
Example
curl HTTP request
wscat WS requestJSON result
IBFT
2.0 methods
IBFT
2.0 methodsThe IBFT
API methods provide access to the IBFT 2.0 consensus engine.
Note
The IBFT
API methods are not enabled by default for JSON-RPC. To enable the IBFT
API methods, use the --rpc-http-api
or --rpc-ws-api
options.
ibft_discardValidatorVote
ibft_discardValidatorVote
Discards a proposal to add or remove a validator with the specified address.
Parameters
address
: string - 20-byte address of proposed validator
Returns
result
: boolean - indicates if the proposal is discarded
Example
curl HTTP request
wscat WS requestJSON result
ibft_getPendingVotes
ibft_getPendingVotes
Returns votes cast in the current epoch.
Parameters
None
Returns
result
: map of strings to booleans - map of account addresses to corresponding boolean values indicating the vote for each account; if true
, the vote is to add a validator. If false
, the proposal is to remove a validator.
Example
curl HTTP request
wscat WS requestJSON result
ibft_getSignerMetrics
ibft_getSignerMetrics
Provides the following validator metrics for the specified range:
Number of blocks from each validator
Block number of the last block proposed by each validator (if any proposed in the specified range)
All validators present in the last block of the range
Parameters
fromBlockNumber
: string - integer representing a block number or the string tagearliest
as described in Block ParametertoBlockNumber
: string - integer representing a block number or one of the string tagslatest
orpending
, as described in Block Parameter
If you specify:
No parameters, the call provides metrics for the last 100 blocks, or all blocks if there are less than 100 blocks.
Only the first parameter, the call provides metrics for all blocks from the block specified to the latest block.
Returns
result
: array of objects - list of validator objects
Note
The proposer of the genesis block has address 0x0000000000000000000000000000000000000000
.
Example
curl HTTP
wscat WSJSON result
ibft_getValidatorsByBlockHash
ibft_getValidatorsByBlockHash
Lists the validators defined in the specified block.
Parameters
block
: string - 32-byte block hash
Returns
result
: array of strings - list of validator addresses
Example
curl HTTP request
wscat WS requestJSON result
ibft_getValidatorsByBlockNumber
ibft_getValidatorsByBlockNumber
Lists the validators defined in the specified block.
Parameters
blockNumber
: string - integer representing a block number or one of the string tagslatest
,earliest
, orpending
, as described in Block Parameter
Returns
result
: array of strings - list of validator addresses
Example
curl HTTP request
wscat WS requestJSON result
ibft_proposeValidatorVote
ibft_proposeValidatorVote
Proposes to add or remove a validator with the specified address.
Parameters
address
: string - account addressproposal
: boolean -true
to propose adding validator orfalse
to propose removing validator
Returns
result
: boolean - true
Example
curl HTTP request
wscat WS requestJSON result
MINER
methods
MINER
methodsThe MINER
API methods allow you to control the node’s mining operation.
Note
The MINER
API methods are not enabled by default for JSON-RPC. To enable the MINER
API methods, use the --rpc-http-api
or --rpc-ws-api
options.
miner_changeTargetGasLimit
miner_changeTargetGasLimit
Updates the target gas limit set using the --target-gas-limit
command line option.
Parameters
gasPrice
: number - target gas price in Wei
Returns
result
: string - Success
or error
Example
curl HTTP request
wscat WS requestJSON result
miner_start
miner_start
Starts the mining process. To start mining, you must first specify a miner coinbase using the --miner-coinbase
command line option.
Parameters
None
Returns
result
: boolean - true
if mining starts, or if the node is already mining
Example
curl HTTP request
wscat WS requestJSON result
miner_stop
miner_stop
Stops the mining process on the client.
Parameters
None
Returns
result
: boolean - true
if mining stops, or if the node is not mining
Example
curl HTTP request
wscat WS requestJSON result
NET
methods
NET
methodsThe NET
API methods provide network-related information.
net_enode
net_enode
Returns the enode URL.
Parameters
None
Returns
result
: string - enode URL of the node
Example
curl HTTP request
wscat WS requestJSON result
net_listening
net_listening
Whether the client is actively listening for network connections.
Parameters
None
Returns
result
: boolean - indicates if the client is actively listening for network connections
Example
curl HTTP request
wscat WS requestJSON result
net_peerCount
net_peerCount
Returns the number of peers currently connected to the client.
Parameters
None
Returns
result
: string - number of connected peers in hexadecimal
Example
curl HTTP request
wscat WS requestJSON result
net_services
net_services
Returns enabled services (for example, jsonrpc
) and the host and port for each service.
Note
The --nat-method
setting affects the JSON-RPC and P2P host and port values, but not the metrics host and port values.
Parameters
None
Returns
result
: object - enabled services
Example
curl HTTP request
wscat WS requestJSON result
net_version
net_version
Returns the network ID.
Parameters
None
Returns
result
: string - current network ID
Network ID | Chain | Network | Description |
---|---|---|---|
| ETH | Mainnet | Main Ethereum network |
| ETH | Ropsten | PoW test network |
| ETH | Rinkeby | PoA test network using Clique |
| ETH | Goerli | PoA test network using Clique |
| ETH | Dev | PoW development network |
| ETC | Classic | Main Ethereum Classic network |
| ETC | Mordor | PoW test network |
| ETC | Kotti | PoA test network using Clique |
| ETC | Astor | PoW test network |
Note
For almost all networks network ID and chain ID are the same.
The only networks in the table above with different network and chain IDs are Classic with a chain ID of 61
and Mordor with a chain ID of 63
.
Example
curl HTTP request
wscat WS requestJSON result for MainnetJSON result for Ropsten
PERM
(Permissioning) methods
PERM
(Permissioning) methodsThe PERM
API methods provide permissioning functionality. Use these methods for local permissioning only.
Important
The PERM
API methods are not enabled by default for JSON-RPC. To enable the PERM
API methods, use the --rpc-http-api
or --rpc-ws-api
CLI options.
perm_addAccountsToAllowlist
perm_addAccountsToAllowlist
Adds accounts (participants) to the accounts permission list.
Parameters
addresses
: array of strings - list of account addresses
Note
The parameters list contains a list which is why the account addresses are enclosed by double square brackets.
Returns
result
: string - Success
or error
(errors include attempting to add accounts already on the allowlist and including invalid account addresses.)
Example
curl HTTP request
wscat WS requestJSON result
perm_addNodesToAllowlist
perm_addNodesToAllowlist
Adds nodes to the nodes allowlist.
To use domain names in enode URLs, ensure you enable DNS support to avoid receiving a request contains an invalid node
error.
Warning
Enode URL domain name support is an experimental feature.
Parameters
enodes
: array of strings - list of enode URLs
Note
The parameters list contains a list which is why the enode URLs are enclosed by double square brackets.
Returns
result
: string - Success
or error
; errors include attempting to add nodes already on the allowlist or including invalid enode URLs.
Example
curl HTTP request
wscat WS requestJSON result
perm_getAccountsAllowlist
perm_getAccountsAllowlist
Lists accounts (participants) in the accounts permissions list.
Parameters
None
Returns
result
: array of strings - list of accounts (participants) in the accounts allowlist
Example
curl HTTP request
wscat WS requestJSON result
perm_getNodesAllowlist
perm_getNodesAllowlist
Lists nodes in the nodes allowlist.
Parameters
None
Returns
result
: array of strings - enode URLs of nodes in the nodes allowlist
Example
curl HTTP request
wscat WS requestJSON result
perm_reloadPermissionsFromFile
perm_reloadPermissionsFromFile
Reloads the accounts and nodes allowlists from the permissions configuration file.
Parameters
None
Returns
result
: string - Success
, or error
if the permissions configuration file is not valid
Example
curl HTTP request
wscat WS requestJSON result
perm_removeAccountsFromAllowlist
perm_removeAccountsFromAllowlist
Removes accounts (participants) from the accounts permissions list.
Parameters
addresses
: array of strings - list of account addresses
Note
The parameters list contains a list which is why the account addresses are enclosed by double square brackets.
Returns
result
: string - Success
or error
(errors include attempting to remove accounts not on the allowlist and including invalid account addresses.)
Example
curl HTTP request
wscat WS requestJSON result
perm_removeNodesFromAllowlist
perm_removeNodesFromAllowlist
Removes nodes from the nodes allowlist.
Parameters
enodes
: array of strings - list of enode URLs
Note
The parameters list contains a list which is why the enode URLs are enclosed by double square brackets.
Returns
result
: string - Success
or error
(errors include attempting to remove nodes not on the allowlist and including invalid enode URLs.)
Example
curl HTTP request
wscat WS requestJSON result
PLUGINS
methods
PLUGINS
methodsThe PLUGINS
API methods provide plugin-related functionality.
Note
The PLUGINS
API methods are not enabled by default for JSON-RPC. To enable the PLUGINS
API methods, use the --rpc-http-api
or --rpc-ws-api
options.
plugins_reloadPluginConfig
plugins_reloadPluginConfig
Reloads specified plugin configuration.
Parameters
plugin
: string - plugin
Returns
result
: string - Success
Example
curl HTTP request
wscat WS requestJSON result
PRIV
methods
PRIV
methodsThe PRIV
API methods provide functionality for private transactions and privacy groups.
Note
The PRIV
API methods are not enabled by default for JSON-RPC. To enable the PRIV
API methods, use the --rpc-http-api
or --rpc-ws-api
options.
priv_call
priv_call
Invokes a private contract function locally and does not change the privacy group state.
For private contracts, priv_call
is the same as eth_call
for public contracts.
Parameters
privacyGroupId
: string - 32-byte privacy Group IDcall
: object - transaction call objectblockNumber
: string - integer representing a block number or one of the string tagslatest
,earliest
, orpending
, as described in Block Parameter
Returns
result
: data - return value of the executed contract
Example
curl HTTP
wscat WSJSON resultcurl GraphQLGraphQLGraphQL result
priv_createPrivacyGroup
priv_createPrivacyGroup
Creates a group of nodes, specified by their Tessera public key.
Parameters
options
: object - request options object with the following fields:
addresses
: array of strings - list of nodes specified by Tessera public keysname
: string - (optional) privacy group namedescription
: string - (optional) privacy group description
Returns
result
: string - privacy group ID
Example
curl HTTP request
wscat WS requestJSON result
priv_debugGetStateRoot
priv_debugGetStateRoot
Returns the state root of the specified privacy group at the specified block.
Parameters
privacyGroupId
: string - 32-byte privacy Group IDblockNumber
: string - integer representing a block number or one of the string tagslatest
,earliest
, orpending
, as described in Block Parameter
Returns
result
: string - 32-byte state root
Example
curl HTTP
wscat WSJSON result
priv_deletePrivacyGroup
priv_deletePrivacyGroup
Deletes the specified privacy group.
Parameters
privacyGroupId
: string - privacy group ID
Returns
result
: string - deleted privacy group ID
Example
curl HTTP request
wscat WS requestJSON result
priv_distributeRawTransaction
priv_distributeRawTransaction
Distributes a signed, RLP encoded private transaction.
Tip
If you want to sign the Privacy Marker Transaction outside of Besu, use priv_distributeRawTransaction
instead of eea_sendRawTransaction
.
Parameters
transaction
: string - signed RLP-encoded private transaction
Returns
result
: string - 32-byte enclave key (the enclave key is a pointer to the private transaction in Tessera.)
Example
curl HTTP request
wscat WS requestJSON result
priv_findPrivacyGroup
priv_findPrivacyGroup
Returns a list of privacy groups containing only the listed members. For example, if the listed members are A and B, a privacy group containing A, B, and C is not returned.
Parameters
members
: array of strings - members specified by Tessera public keys
Returns
result
: array of objects - privacy group objects containing only the specified members; privacy groups are EEA-compliant or Besu-extended with types:
LEGACY
for EEA-compliant groups.PANTHEON
for Besu-extended groups.
Example
curl HTTP request
wscat WS requestJSON result
priv_getCode
priv_getCode
Returns the code of the private smart contract at the specified address. Compiled smart contract code is stored as a hexadecimal value.
Parameters
privacyGroupId
: string - 32-byte privacy Group IDaddress
: string - 20-byte contract addressblockNumber
: string - integer representing a block number or one of the string tagslatest
,earliest
, orpending
, as described in Block Parameter
Returns
result
: data - code stored at the specified address
Example
curl HTTP
wscat WSJSON result
priv_getEeaTransactionCount
priv_getEeaTransactionCount
Returns the private transaction count for the specified account and group of sender and recipients.
Important
If sending more than one transaction to be mined in the same block (that is, you are not waiting for the transaction receipt), you must calculate the private transaction nonce outside Besu instead of using priv_getEeaTransactionCount
.
Parameters
address
: string - account addresssender
: string - base64-encoded Tessera address of the senderrecipients
: array of strings - base64-encoded Tessera addresses of recipients
Returns
result
: string - integer representing the number of private transactions sent from the address to the specified group of sender and recipients
Example
curl HTTP request
wscat WS requestJSON result
priv_getFilterChanges
priv_getFilterChanges
Polls the specified filter for a private contract and returns an array of changes that have occurred since the last poll.
Filters for private contracts can only be created by priv_newFilter
so unlike eth_getFilterChanges
, priv_getFilterChanges
always returns an array of log objects or an empty list.
Parameters
privacyGroupId
: string - 32-byte privacy Group IDfilterId
: string - filter ID
Returns
result
: array of objects - list of log objects, or an empty list if nothing has changed since the last poll
Example
curl HTTP request
wscat WS requestJSON result
priv_getFilterLogs
priv_getFilterLogs
Returns an array of logs for the specified filter for a private contract.
For private contracts, priv_getFilterLogs
is the same as eth_getFilterLogs
for public contracts except there is no automatic log bloom caching for private contracts.
Note
priv_getFilterLogs
is only used for filters created with priv_newFilter
. To specify a filter object and get logs without creating a filter, use priv_getLogs
.
Parameters
privacyGroupId
: string - 32-byte privacy Group IDfilterId
: string - filter ID
Returns
result
: array of objects - list of log objects
Example
curl HTTP request
wscat WS requestJSON result
priv_getLogs
priv_getLogs
Returns an array of logs matching a specified filter object.
For private contracts, priv_getLogs
is the same as eth_getLogs
for public contracts except there is no automatic log bloom caching for private contracts.
Parameters
privacyGroupId
: string - 32-byte privacy Group IDfilterOptions
: object - filter options object
Returns
result
: array of objects - list of log objects
Example
curl HTTP
wscat WSJSON result
priv_getPrivacyPrecompileAddress
priv_getPrivacyPrecompileAddress
Returns the address of the privacy precompiled contract. The address is derived and based on the value of the privacy-flexible-groups-enabled
option.
Parameters
None
Returns
result
: string - address of the privacy precompile
Example
curl HTTP request
wscat WS requestJSON result
priv_getPrivateTransaction
priv_getPrivateTransaction
Returns the private transaction if you are a participant, otherwise, null
.
Parameters
transaction
: string - transaction hash returned by eea_sendRawTransaction
or eea_sendTransaction
.
Returns
result
: object - private transaction object, or null
if not a participant in the private transaction
Example
curl HTTP request
wscat WS requestJSON result
priv_getTransactionCount
priv_getTransactionCount
Returns the private transaction count for specified account and privacy group.
Important
If sending more than one transaction to be mined in the same block (that is, you are not waiting for the transaction receipt), you must calculate the private transaction nonce outside Besu instead of using priv_getTransactionCount
.
Parameters
address
: string - account addressprivacyGroupId
: string - privacy group ID
Returns
result
: string - integer representing the number of private transactions sent from the address to the specified privacy group
Example
curl HTTP request
wscat WS requestJSON result
priv_getTransactionReceipt
priv_getTransactionReceipt
Returns information about the private transaction after mining the transaction. Receipts for pending transactions are not available.
Parameters
transaction
: string - 32-byte hash of a transaction
Returns
result
: object - private Transaction receipt object, or null
if no receipt found
Example
curl HTTP request
wscat WS requestJSON result
priv_newFilter
priv_newFilter
Creates a log filter for a private contract. To poll for logs associated with the created filter, use priv_getFilterChanges
. To get all logs associated with the filter, use priv_getFilterLogs
.
For private contracts, priv_newFilter
is the same as eth_newFilter
for public contracts.
Parameters
privacyGroupId
: string - 32-byte privacy Group IDfilterOptions
: object - filter options object
Note
fromBlock
and toBlock
in the filter options object default to latest
.
Returns
result
: string - filter ID
Example
curl HTTP request
wscat WS requestJSON result
priv_uninstallFilter
priv_uninstallFilter
Uninstalls a filter for a private contract with the specified ID. When a filter is no longer required, call this method.
Filters time out when not requested by priv_getFilterChanges
or priv_getFilterLogs
for 10 minutes.
For private contracts, priv_uninstallFilter
is the same as eth_uninstallFilter
for public contracts.
Parameters
privacyGroupId
: string - 32-byte privacy Group IDfilterId
: string - filter ID
Returns
result
: boolean - indicates if the filter is successfully uninstalled
Example
curl HTTP request
wscat WS requestJSON result
QBFT
methods
QBFT
methodsThe QBFT
API methods provide access to the QBFT consensus engine.
Note
The QBFT
API methods are not enabled by default for JSON-RPC. To enable the QBFT
API methods, use the --rpc-http-api
or --rpc-ws-api
options.
qbft_discardValidatorVote
qbft_discardValidatorVote
Discards a proposal to add or remove a validator with the specified address.
Parameters
address
: string - 20-byte address of proposed validator
Returns
result
: boolean - indicates if the proposal is discarded
Example
curl HTTP request
wscat WS requestJSON result
qbft_getPendingVotes
qbft_getPendingVotes
Returns votes cast in the current epoch.
Parameters
None
Returns
result
: map of strings to booleans - map of account addresses to corresponding boolean values indicating the vote for each account; if true
, the vote is to add a validator. If false
, the proposal is to remove a validator.
Example
curl HTTP request
wscat WS requestJSON result
qbft_getSignerMetrics
qbft_getSignerMetrics
Provides the following validator metrics for the specified range:
Number of blocks from each validator
Block number of the last block proposed by each validator (if any proposed in the specified range)
All validators present in the last block of the range
Parameters
fromBlockNumber
: string - integer representing a block number or the string tagearliest
as described in Block ParametertoBlockNumber
: string - integer representing a block number or one of the string tagslatest
orpending
, as described in Block Parameter
If you specify:
No parameters, the call provides metrics for the last 100 blocks, or all blocks if there are less than 100 blocks.
Only the first parameter, the call provides metrics for all blocks from the block specified to the latest block.
Returns
result
: array of objects - list of validator objects
Note
The proposer of the genesis block has address 0x0000000000000000000000000000000000000000
.
Example
curl HTTP
wscat WSJSON result
qbft_getValidatorsByBlockHash
qbft_getValidatorsByBlockHash
Lists the validators defined in the specified block.
Parameters
block
: string - 32-byte block hash
Returns
result
: array of strings - list of validator addresses
Example
curl HTTP request
wscat WS requestJSON result
qbft_getValidatorsByBlockNumber
qbft_getValidatorsByBlockNumber
Lists the validators defined in the specified block.
Parameters
blockNumber
: string - integer representing a block number or one of the string tagslatest
,earliest
, orpending
, as described in Block Parameter
Returns
result
: array of strings - list of validator addresses
Example
curl HTTP request
wscat WS requestJSON result
qbft_proposeValidatorVote
qbft_proposeValidatorVote
Proposes to add or remove a validator with the specified address.
Parameters
address
: string - account addressproposal
: boolean -true
to propose adding validator orfalse
to propose removing validator
Returns
result
: boolean - true
Example
curl HTTP request
wscat WS requestJSON result
TRACE
methods
TRACE
methodsThe TRACE
API is a more concise alternative to the DEBUG
API.
Note
The TRACE
API methods are not enabled by default for JSON-RPC. To enable the TRACE
API methods, use the --rpc-http-api
or --rpc-ws-api
options.
trace_block
trace_block
Provides transaction processing of type trace
for the specified block.
Important
Your node must be an archive node (that is, synchronized without pruning or fast sync) or the requested block must be within the number of pruning blocks retained (by default, 1024).
Parameters
blockNumber
: string - integer representing a block number or one of the string tags latest
, earliest
, or pending
, as described in Block Parameter
Returns
result
: array of objects - list of calls to other contracts containing one object per call, in transaction execution order; if revert reason is enabled with --revert-reason-enabled
, the returned list items include the revert reason.
Example
curl HTTP request
wscat WS requestJSON result
trace_replayBlockTransactions
trace_replayBlockTransactions
Provides transaction processing tracing per block.
Important
Your node must be an archive node (that is, synchronized without pruning or fast sync) or the requested block must be within the number of pruning blocks retained (by default, 1024).
Parameters
blockNumber
: string - integer representing a block number or one of the string tagslatest
,earliest
, orpending
, as described in Block Parameteroptions
: array of strings - list of tracing options; tracing options aretrace
,vmTrace
, andstateDiff
. Specify any combination of the three options including none of them.
Returns
result
: array of objects - list of transaction trace objects containing one object per transaction, in transaction execution order; if revert reason is enabled with --revert-reason-enabled
, the trace
list items in the returned transaction trace object include the revert reason.
Example
curl HTTP request
wscat WS requestJSON result
trace_transaction
trace_transaction
Provides transaction processing of type trace
for the specified transaction.
Important
Your node must be an archive node (that is, synchronized without pruning or fast sync) or the requested transaction must be contained in a block within the number of pruning blocks retained (by default, 1024).
Parameters
transaction
: string - transaction hash
Returns
result
: array of objects - list of calls to other contracts containing one object per call, in the order called by the transaction; if revert reason is enabled with --revert-reason-enabled
, the returned list items include the revert reason.
Example
curl HTTP request
wscat WS requestJSON result
TXPOOL
methods
TXPOOL
methodsThe TXPOOL
API methods allow you to inspect the contents of the transaction pool.
Note
The TXPOOL
API methods are not enabled by default for JSON-RPC. To enable the TXPOOL
API methods, use the --rpc-http-api
or --rpc-ws-api
options.
txpool_besuPendingTransactions
txpool_besuPendingTransactions
Lists pending transactions that match the supplied filter conditions.
Parameters
numResults
: number - integer representing the maximum number of results to returnfields
: object - object of fields used to create the filter condition
Each field in the object corresponds to a field name containing an operator, and a value for the operator. A field name can only be specified once, and can only contain one operator. For example, you cannot query transactions with a gas price between 8 and 9 Gwei by using both the gt
and lt
operator in the same field name instance.
All filters must be satisfied for a transaction to be returned.
Field name | Value | Value type | Supported operators |
---|---|---|---|
from | Address of the sender. | Data, 20 bytes |
|
to | Address of the receiver, or | Data, 20 bytes |
|
gas | Gas provided by the sender. | Quantity |
|
gasPrice | Gas price, in wei, provided by the sender. | Quantity |
|
value | Value transferred, in wei. | Quantity |
|
nonce | Number of transactions made by the sender. | Quantity |
|
Supported operators:
eq
(equal to)lt
(less than)gt
(greater than)action
Note
The only supported action
is "contract_creation"
.
Returns
result
: array of objects - list of objects with details of the pending transaction
Example
curl HTTP request
wscat WS requestJSON result
txpool_besuStatistics
txpool_besuStatistics
Lists statistics about the node transaction pool.
Parameters
None
Returns
result
: object - transaction pool statistics object with the following fields:
maxSize
: number - maximum number of transactions kept in the transaction pool; use the--tx-pool-max-size
option to configure the maximum size.localCount
: number - number of transactions submitted directly to this noderemoteCount
: number - number of transactions received from remote nodes
Example
curl HTTP request
wscat WS requestJSON result
txpool_besuTransactions
txpool_besuTransactions
Lists transactions in the node transaction pool.
Parameters
None
Returns
result
: array of objects - list of transactions
Example
curl HTTP request
wscat WS requestJSON result
WEB3
methods
WEB3
methodsThe WEB3
API methods provide functionality for the Ethereum ecosystem.
web3_clientVersion
web3_clientVersion
Returns the current client version.
Parameters
None
Returns
result
: string - current client version
Example
curl HTTP request
wscat WS requestJSON result
web3_sha3
web3_sha3
Returns a SHA3 hash of the specified data. The result value is a Keccak-256 hash, not the standardized SHA3-256.
Parameters
data
: string - data to convert to a SHA3 hash
Returns
result
: string - SHA3 result of the input data
Example
curl HTTP request
wscat WS requestJSON result
Miscellaneous methods
rpc_modules
rpc_modules
Lists enabled APIs and the version of each.
Parameters
None
Returns
result
: map of strings to strings - enabled APIs and their versions
Last updated