Comment on page

API Method

The API Method allows you to interact with the Bitrock Blockchain.

ADMIN methods

admin_addPeer

If connections are timing out, ensure the node ID in the enode URL is correct.
Parameters
enode: - String = enode://1fd6bfa1ac606ab3cdbbbacef1b27a1e38b0ac54d5c1a361d07a27211b54b4817aa9b14e596f23c7020d[email protected]:30303
Returns
result: boolean - true if peer added or false if peer already a static node
  • curl HTTP request
  • wscat WS request
  • JSON result
curl -X POST --data '{"jsonrpc":"2.0","method":"admin_addPeer","params":["
enode://1fd6bfa1ac606ab3cdbbbacef1b27a1e38b0ac54d5c1a361d07a27211b54b4817aa9b14e596f23c7020d[email protected]:30303
"],"id":1}' https://connect.bit-rock.io

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 level
  • log_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
The following example changes the debug level for specified classes to DEBUG.
  • curl HTTP request
  • wscat WS request
  • JSON result
curl -X POST --data '{"jsonrpc":"2.0", "method":"admin_changeLogLevel", "params":["DEBUG", ["org.hyperledger.besu.ethereum.eth.manager","org.hyperledger.besu.ethereum.p2p.rlpx.connections.netty.ApiHandler"]], "id":1}' https://connect.bit-rock.io
The following example changes the debug level of all logs to WARN.
  • curl HTTP request
  • wscat WS request
  • JSON result
curl -X POST --data '{"jsonrpc":"2.0","method":"admin_changeLogLevel","params":["WARN"], "id":1}' https://connect.bit-rock.io

admin_generateLogBloomCache

Generates cached log bloom indexes for blocks. APIs such as eth_getLogs and eth_getFilterLogs use the cache for improved performance.
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 indexes
  • endBlock: string - block to stop generating indexes
Returns
result: object - log bloom index details:
  • startBlock: string - starting block for the last requested cache generation
  • endBlock: string - ending block for the last requested cache generation
  • currentBlock: string - most recent block added to the cache
  • indexing: boolean - indicates if indexing is in progress
  • boolean - indicates acceptance of the request from this call to generate the cache
  • curl HTTP request
  • wscat WS request
  • JSON result
curl -X POST --data '{jsonrpc":"2.0","method":"admin_generateLogBloomCache", "params":["0x0", "0x10000"], "id":1}' https://connect.bit-rock.io

admin_logsRemoveCache

Removes cache files for the specified range of blocks.
Parameters
  • fromBlock: string - integer representing a block number or one of the string tags latest, earliest, or pending, as described in block parameter
  • toBlock: string - integer representing a block number or one of the string tags latest, earliest, or pending, 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.
  • curl HTTP request
  • wscat WS request
  • JSON result
curl -X POST --data '{"jsonrpc":"2.0","method":"admin_logsRemoveCache","params":["1", "100"], "id":1}' https://connect.bit-rock.io

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
  • curl HTTP request
  • wscat WS request
  • JSON result
curl -X POST --data '{"jsonrpc":"2.0","method":"admin_logsRepairCache","params":["1200"], "id":1}' https://connect.bit-rock.io

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 node
  • listenAddr: string - host and port for the node
  • name: string - client name
  • id: string - node public key
  • ports: object - peer discovery and listening ports
  • protocols: 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.
  • curl HTTP request
  • wscat WS request
  • JSON result
curl -X POST --data '{"jsonrpc":"2.0","method":"admin_nodeInfo","params":[],"id":1}' https://connect.bit-rock.io

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 version
  • name: string - client name
  • caps: array of strings - list of Ethereum sub-protocol capabilities
  • network: object - local and remote addresses established at time of bonding with the peer (the remote address might not match the hex value for port; it depends on which node initiated the connection.)
  • port: string - port on the remote node on which P2P discovery is listening
  • id: string - node public key (excluding the 0x prefix, the node public key is the ID in the enode URL enode://<id ex 0x>@<host>:<port>.)
  • protocols: object - current state of peer including difficulty and head (head is the hash of the highest known block for the peer.)
  • enode: string - enode URL of the remote node
  • curl HTTP request
  • wscat WS request
  • JSON result
curl -X POST --data '{"jsonrpc":"2.0","method":"admin_peers","params":[],"id":1}' https://connect.bit-rock.io

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
  • curl HTTP request
  • wscat WS request
  • JSON result
curl -X POST --data '{"jsonrpc":"2.0","method":"admin_removePeer","params":["enode://f59c0ab603377b6ec88b89d5bb41b98fc385030ab1e4b03752db6f7dab364559d92c757c13116ae6408d2d33f0138e7812eb8b696b2a22fe3332c4b5127b22a3@127.0.0.1:30304"],"id":1}' https://connect.bit-rock.io

DEBUG methods

The 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. Where these APIs overlap, we recommend using the TRACE API for production use over the DEBUG API. Specifically, we recommend trace_block over debug_traceBlock, and trace_transaction over debug_traceTransaction.
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_accountAt

Returns account information at the specified index of the specified block.
Parameters
  • blockHashOrNumber: string - block hash or number at which to retrieve account information
  • txIndex: number - transaction index at which to retrieve account information
  • address: string - contract or account address for which to retrieve information
Returns
result: object - account details object with the following fields:
  • code: data - code for the account. Displays 0x0 if the address is an externally owned account.
  • nonce: quantity - number of transactions made by the account before this one
  • balance: quantity - balance of the account in Wei
  • codehash: data - code hash for the account
This example uses an externally owned account address for the address parameter.
  • curl HTTP request
  • wscat WS request
  • JSON result
curl -X POST --data '{"jsonrpc":"2.0","method":"debug_accountAt","params":["0xc8df1f061abb4d0c107b2b1a794ade8780b3120e681f723fe55a7be586d95ba6", 0, "0xbcde5374fce5edbc8e2a8697c15331677e6ebf0b"],"id":1}' https://connect.bit-rock.io
This example uses a contract address for the address parameter.
  • curl HTTP request
  • wscat WS request
  • JSON result
curl -X POST --data '{"jsonrpc":"2.0","method":"debug_accountAt","params":["0x2b76b3a2fc44c0e21ea183d06c846353279a7acf12abcc6fb9d5e8fb14ae2f8c", 0, "0x0e0d2c8f7794e82164f11798276a188147fbd415"],"id":1}' https://connect.bit-rock.io

debug_accountRange

Retesteth uses debug_accountRange to implement debugging.
Returns the accounts for a specified block.
Parameters
  • blockHashOrNumber: string - block hash or number at which to retrieve account information
  • txIndex: number - transaction index at which to retrieve account information
  • address: string - address hash from which to start
  • limit: 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 addresses
  • nextKey: string - hash of the next address if any addresses remain in the state, otherwise zero
  • curl HTTP request
  • wscat WS request
  • JSON result
curl -X POST --data '{"jsonrpc":"2.0","method":"debug_accountRange","params":["12345", 0, "0", 5],"id":1}' http://127.0.0.1:8545

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 array
  • success: boolean - indicates whether or not the transaction has been added to the transaction pool
  • errorMessage: string - (optional) error message
  • curl HTTP
  • wscat WS
  • JSON result
curl -X POST --data '{"jsonrpc":"2.0","method":"debug_batchSendRawTransaction","params":["0xf868808203e882520894627306090abab3a6e1400e9345bc60c78a8bef57872386f26fc10000801ba0ac74ecfa0e9b85785f042c143ead4780931234cc9a032fce99fab1f45e0d90faa02fd17e8eb433d4ca47727653232045d4f81322619c0852d3fe8ddcfcedb66a43","0x416","0xf868018203e882520894627306090abab3a6e1400e9345bc60c78a8bef57872386f26fc10000801ca0b24ea1bee8fe36984c36acbf80979a4509f23fc17141851e08d505c0df158aa0a00472a05903d4cd7a811bd4d5c59cc105d93f5943f3393f253e92e65fc36e7ce0","0xf868808203e882520894627306090abab3a6e1400e9345bc60c78a8bef5787470de4df820000801ca0f7936b4de04792e3c65095cfbfd1399d231368f5f05f877588c0c8509f6c98c9a01834004dead527c8da1396eede42e1c60e41f38a77c2fd13a6e495479c729b99"],"id":1}' https://connect.bit-rock.io

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
  • curl HTTP
  • wscat WS
  • JSON result
curl -X POST --data '{"jsonrpc":"2.0","method":"debug_getBadBlocks","params":[],"id":1}' https://connect.bit-rock.io

debug_getRawBlock

Returns the RLP encoding of 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 - RLP-encoded block object
  • curl HTTP request
  • wscat WS request
  • JSON result
curl -X POST --data '{"jsonrpc":"2.0","method":"debug_getRawBlock","params":["0x32026E"],"id":1}' https://connect.bit-rock.io
Returns the RLP encoding of the header of 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: string - RLP-encoded block header or error
  • curl HTTP request
  • wscat WS request
  • JSON result
curl -X POST --data '{"jsonrpc":"2.0","method":"debug_getRawHeader","params":["0x32026E"],"id":1}' https://connect.bit-rock.io

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
  • curl HTTP request
  • wscat WS request
  • JSON result
curl -X POST --data '{"jsonrpc":"2.0","method":"debug_metrics","params":[],"id":1}' https://connect.bit-rock.io

debug_replayBlock

Re-imports the block matching the specified block number, by rolling the head of the local chain back to the block right before the specified block, then importing 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: string - Success or error
  • curl HTTP request
  • wscat WS request
  • JSON result
curl -X POST --data '{"jsonrpc":"2.0","method":"debug_replayBlock","params":["0x1"],"id":1}' https://connect.bit-rock.io

debug_resyncWorldstate

Triggers a re-synchronization of the world state while retaining imported blocks. This is useful if there are world state database inconsistencies (for example, Bonsai database issues).
Parameters
None
Returns
result: string - Success or error
  • curl HTTP request
  • wscat WS request
  • JSON result
curl -X POST --data '{"jsonrpc":"2.0","method":"debug_resyncWorldstate","params":[],"id":1}' https://connect.bit-rock.io

debug_setHead

Sets the current head of the local chain to the 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 - Success or error
  • curl HTTP request
  • wscat WS request
  • JSON result
curl -X POST --data '{"jsonrpc":"2.0","method":"debug_setHead","params":["0x1"],"id":1}' https://connect.bit-rock.io

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
  • curl HTTP request
  • wscat WS request
  • JSON result
curl -X POST --data '{"jsonrpc":"2.0","method":"debug_standardTraceBlockToFile","params":["0x2dc0b6c43144e314a86777b4bd4f987c0790a6a0b21560671d221ed81a23f2dc", {
"txHash": "0x4ff04c4aec9517721179c8dd435f47fbbfc2ed26cd4926845ab687420d5580a6", "disableMemory": false}], "id":1}' https://connect.bit-rock.io

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
  • curl HTTP request
  • wscat WS request
  • JSON result
curl -X POST --data '{"jsonrpc":"2.0","method":"debug_standardTraceBadBlockToFile","params":["0x53741e9e94791466d117c5f9e41a2ed1de3f73d39920c621dfc2f294e7779baa"], "id":1}' https://connect.bit-rock.io

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 hash
  • txIndex: number - transaction index from which to start
  • address: string - contract address
  • startKey: string - start key
  • limit: number - number of storage entries to return
Returns
result: object - range object.
  • curl HTTP request
  • wscat WS request
  • JSON result
  • curl HTTP request
  • wscat WS request
  • JSON result
curl -X POST --data '{"jsonrpc":"2.0","method":"debug_storageRangeAt","params":["0x2b76b3a2fc44c0e21ea183d06c846353279a7acf12abcc6fb9d5e8fb14ae2f8c",0,"0x0e0d2c8f7794e82164f11798276a188147fbd415","0x0000000000000000000000000000000000000000000000000000000000000000",1], "id":1}' https://connect.bit-rock.io

debug_traceBlock

Returns full trace of all invoked opcodes of all transactions included in the block.
Parameters
  • block: string - RLP of the block
  • options: object - request options object with the following fields (all optional and default to false):
    • disableStorage: boolean - true disables storage capture.
    • disableMemory: boolean - true disables memory capture.
    • disableStack : boolean - true disables stack capture.
Returns
result: object - trace object
  • curl HTTP request
  • wscat WS request
  • JSON result
curl -X POST --data '{"jsonrpc":"2.0","method":"debug_traceBlock","params":["0xf90277f90208a05a41d0e66b4120775176c09fcf39e7c0520517a13d2b57b18d33d342df038bfca01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d4934794e6a7a1d47ff21b6321162aea7c6cb457d5476bcaa00e0df2706b0a4fb8bd08c9246d472abbe850af446405d9eba1db41db18b4a169a04513310fcb9f6f616972a3b948dc5d547f280849a87ebb5af0191f98b87be598a0fe2bf2a941abf41d72637e5b91750332a30283efd40c424dc522b77e6f0ed8c4b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000860153886c1bbd82b44382520b8252088455c426598b657468706f6f6c2e6f7267a0b48c515a9dde8d346c3337ea520aa995a4738bb595495506125449c1149d6cf488ba4f8ecd18aab215f869f86780862d79883d2000825208945df9b87991262f6ba471f09758cde1c0fc1de734827a69801ca088ff6cf0fefd94db46111149ae4bfc179e9b94721fffd821d38d16464b3f71d0a045e0aff800961cfce805daef7016b9b675c137a6a41a548f7b60a3484c06a33ac0"],"id":1}' https://connect.bit-rock.io

debug_traceBlockByHash

Returns full trace of all invoked opcodes of all transactions included in the block.
Parameters
  • blockHash: string - block hash
  • options: object - request options object with the following fields (all optional and default to false):
    • 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
  • curl HTTP request
  • wscat WS request
  • JSON result
curl -X POST --data '{"jsonrpc":"2.0","method":"debug_traceBlockByHash","params":["0xaceb3b2c9b25b0589230873921eb894b28722011b8df63977145517d754875a5"], "id":1}' https://connect.bit-rock.io

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 tags latest, earliest, or pending, as described in block parameter
  • options: object - request options object with the following fields (all optional and default to false):
    • 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
  • curl HTTP request
  • wscat WS request
  • JSON result
curl -X POST --data '{"jsonrpc":"2.0","method":"debug_traceBlockByNumber","params":["0x7224",{"disableStorage":true}], "id":1}' http://127.0.0.1:8545

ETH methods

The 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

Returns a list of account addresses a client owns.
Parameters
None
Returns
result: array of strings - list of 20-byte account addresses owned by the client
  • curl HTTP request
  • wscat WS request
  • JSON result
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_accounts","params":[],"id":53}' https://connect.bit-rock.io

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
  • curl HTTP
  • wscat WS
  • JSON result
  • curl GraphQL
  • GraphQL
  • GraphQL result
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":51}' curl -X POST --data '{"jsonrpc":"2.0","method":"eth_accounts","params":[],"id":53}' https://connect.bit-rock.io

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 or blockHash: string - integer representing a block number, block hash, 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
  • curl HTTP
  • wscat WS
  • JSON result
  • curl GraphQL
  • GraphQL
  • GraphQL result
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_call","params":[{"to":"0x69498dd54bd25aa0c886cf1f8b8ae0856d55ff13","value":"0x1"}, "latest"],"id":53}' curl -X POST --data '{"jsonrpc":"2.0","method":"eth_accounts","params":[],"id":53}' https://connect.bit-rock.io
Example of a simulated contract creation
The following example creates a simulated contract by not including the to parameter from the transaction call object in the call parameter. Besu simulates the data to create the contract.
  • curl HTTP
  • JSON result
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_call","params":[{"from":"0xfe3b557e8fb62b89f4916b721be55ceb828dbd73", "data":"0x6080604052336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555034801561005057600080fd5b5061021e806100606000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063445df0ac146100465780638da5cb5b14610064578063fdacd576146100ae575b600080fd5b61004e6100dc565b6040518082815260200191505060405180910390f35b61006c6100e2565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100da600480360360208110156100c457600080fd5b8101908080359060200190929190505050610107565b005b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146101ac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260338152602001806101b76033913960400191505060405180910390fd5b806001819055505056fe546869732066756e6374696f6e206973207265737472696374656420746f2074686520636f6e74726163742773206f776e6572a265627a7a7231582007302f208a10686769509b529e1878bda1859883778d70dedd1844fe790c9bde64736f6c63430005100032","gas":"0x439cf","gasPrice":"0x0"},"latest"],"id":53}' curl -X POST --data '{"jsonrpc":"2.0","method":"eth_accounts","params":[],"id":53}' https://connect.bit-rock.io

eth_chainId

Returns the chain ID.
Parameters
None
Returns
result: string - chain ID in hexadecimal
  • curl HTTP request
  • wscat WS request
  • JSON result
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":51}' curl -X POST --data '{"jsonrpc":"2.0","method":"eth_accounts","params":[],"id":53}' https://connect.bit-rock.io

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 Bitrock Scan. For example:
Example
besu --miner-coinbase="0xfe3b557e8fb62b89f4916b721be55ceb828dbd73" --rpc-http-enabled
Parameters
None
Returns
result: string - coinbase address
  • curl HTTP request
  • wscat WS request
  • JSON result
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_coinbase","params":[],"id":53}' curl -X POST --data '{"jsonrpc":"2.0","method":"eth_accounts","params":[],"id":53}' https://connect.bit-rock.io

eth_createAccessList

Creates an EIP-2930 access list that you can include in a transaction.
Parameters
transaction: object - transaction call object
blockNumber or blockHash: string - integer representing a block number, block hash, or one of the string tags latest, earliest, or pending, as described in block parameter.
Returns
result: object - access list object with the following fields:
  • accessList: array of objects - list of objects with the following fields:
    • address: string - addresses to be accessed by the transaction
    • storageKeys: array - storage keys to be accessed by the transaction
  • gasUsed: string - approximate gas cost for the transaction if the access list is included
  • curl HTTP
  • wscat WS
  • JSON result
curl -X POST --data '{"method":"eth_createAccessList","params":[{"from": "0xaeA8F8f781326bfE6A7683C2BD48Dd6AA4d3Ba63", "data": "0x608060806080608155"}, "pending"],"id":1,"jsonrpc":"2.0"}' curl -X POST --data '{"jsonrpc":"2.0","method":"eth_accounts","params":[],"id":53}' https://connect.bit-rock.io

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
The following example returns an estimate of 21000 wei (0x5208) for the transaction.
  • curl HTTP
  • wscat WS
  • JSON result
  • curl GraphQL
  • GraphQL
  • GraphQL result
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_estimateGas","params":[{"from":"0xFE3B557E8Fb62b89F4916B721be55cEb828dBd73","to":"0x44Aa93095D6749A706051658B970b941c72c1D53","value":"0x1"}],"id":53}' curl -X POST --data '{"jsonrpc":"2.0","method":"eth_accounts","params":[],"id":53}' https://connect.bit-rock.io
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
curl -X POST \
https://connect.bit-rock.io \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_estimateGas",
"params": [{
"from": "0x8bad598904ec5d93d07e204a366d084a80c7694e",
"data": "0x608060405234801561001057600080fd5b5060e38061001f6000396000f3fe6080604052600436106043576000357c0100000000000000000000000000000000000000000000000000000000900480633fa4f24514604857806355241077146070575b600080fd5b348015605357600080fd5b50605a60a7565b6040518082815260200191505060405180910390f35b348015607b57600080fd5b5060a560048036036020811015609057600080fd5b810190808035906020019092919050505060ad565b005b60005481565b806000819055505056fea165627a7a7230582020d7ad478b98b85ca751c924ef66bcebbbd8072b93031073ef35270a4c42f0080029"
}],
"id": 1
}'

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 or string - 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. Accepts hexadecimal or integer values.
  • newestBlock: string - Integer representing the highest number block of the requested range or one of the string tags latest, earliest, or pending, as described in block parameter.
  • array of integers - (optional) A monotonically increasing list of percentile values to sample from each block's effective priority fees per gas in ascending order, weighted by gas used.
Returns
result: object - Fee history results object.
  • curl HTTP
  • wscat WS
  • JSON result
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_feeHistory","params": ["0x5", "latest", [20,30]],"id":1}' https://connect.bit-rock.io

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
  • curl HTTP
  • wscat WS
  • JSON result
  • curl GraphQL
  • GraphQL
  • GraphQL result
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_gasPrice","params":[],"id":53}' https://connect.bit-rock.io

eth_getBalance

Returns the account balance of the specified address.
Parameters
  • address: string - 20-byte account address from which to retrieve the balance
  • blockNumber or blockHash: string - integer representing a block number, block hash, or one of the string tags latest, earliest, or pending, as described in block parameter
Returns
result: string - current balance, in Wei, as a hexadecimal value
  • curl HTTP
  • wscat WS
  • JSON result
  • curl GraphQL
  • GraphQL
  • GraphQL result