Eth module
Returns current block number
Invocation |
---|
{"method":"eth_blockNumber","params":[]} |
Returned type | Description |
---|---|
Quantity | |
Example request of eth_blockNumber
Example response of eth_blockNumber
curl --data '{"method":"eth_blockNumber","params":[],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545
{
"jsonrpc": "2.0",
"result": 0x885480,
"id": 1
}
Executes a tx call (does not create a transaction)
Invocation |
---|
{"method":"eth_call","params":[transactionCall, blockParameter]} |
Parameter | Type | Description |
---|---|---|
transactionCall | TransactionForRpc object | |
blockParameter | BlockParameter object | |
Returned type | Description |
---|---|
String | |
Example request of eth_call
Example response of eth_call
Objects in eth_call
curl --data '{"method":"eth_call","params":[transactionCall, blockParameter],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545
{
"jsonrpc": "2.0",
"result": 0x,
"id": 1
}
TransactionForRpc
Field name | Type |
---|---|
Hash | Hash |
Nonce | Quantity |
BlockHash | Hash |
BlockNumber | Quantity |
TransactionIndex | Quantity |
From | Address |
To | Address |
Value | Quantity |
GasPrice | Quantity |
MaxPriorityFeePerGas | Quantity |
MaxFeePerGas | Quantity |
Gas | Quantity |
Data | Data |
Input | Data |
ChainId | Quantity |
Type | TxType object |
AccessList | AccessListItemForRpc[] object |
MaxFeePerDataGas | Quantity |
BlobVersionedHashes | Data |
V | Quantity |
S | Quantity |
R | Quantity |
YParity | Quantity |
TxType
AccessListItemForRpc[]
Field name | Type |
---|---|
Address | Address |
StorageKeys | Array |
BlockParameter
Field name | Type |
---|---|
Type | BlockParameterType object |
BlockNumber | Quantity |
BlockHash | Hash |
RequireCanonical | Boolean |
BlockParameterType
Quantity
orString
(latest, earliest, pending)
Returns ChainID
Invocation |
---|
{"method":"eth_chainId","params":[]} |
Returned type | Description |
---|---|
Quantity | |
Example request of eth_chainId
Example response of eth_chainId
curl --data '{"method":"eth_chainId","params":[],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545
{
"jsonrpc": "2.0",
"result": 0x4,
"id": 1
}
Hint: If your transaction has code executed, then you can generate transaction access list with eth_createAccessList. If you send it with your transaction then it will lower your gas cost on Ethereum
Invocation |
---|
{"method":"eth_createAccessList","params":[transactionCall, blockParameter, optimize]} |
Parameter | Type | Description |
---|---|---|
transactionCall | TransactionForRpc object | Transaction's details |
blockParameter | BlockParameter object | (optional) |
optimize | Boolean | (optional) |
Returned type | Description |
---|---|
AccessListForRpc object | |
Example request of eth_createAccessList
Example response of eth_createAccessList
Objects in eth_createAccessList
curl --data '{"method":"eth_createAccessList","params":[transactionCall, blockParameter, optimize],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545
{
"jsonrpc": "2.0",
"result": {"accessList":[{"address":"0xfffffffffffffffffffffffffffffffffffffffe","storageKeys":["0x0000000000000000000000000000000000000000000000000000000000000001","0x0000000000000000000000000000000000000000000000000000000000000002"]},{"address":"0x76e68a8696537e4141926f3e528733af9e237d69","storageKeys":[]}],"gasUsed":"0xf71b"},
"id": 1
}
TransactionForRpc
Field name | Type |
---|---|
Hash | Hash |
Nonce | Quantity |
BlockHash | Hash |
BlockNumber | Quantity |
TransactionIndex | Quantity |
From | Address |
To | Address |
Value | Quantity |
GasPrice | Quantity |
MaxPriorityFeePerGas | Quantity |
MaxFeePerGas | Quantity |
Gas | Quantity |
Data | Data |
Input | Data |
ChainId | Quantity |
Type | TxType object |
AccessList | AccessListItemForRpc[] object |
MaxFeePerDataGas | Quantity |
BlobVersionedHashes | Data |
V | Quantity |
S | Quantity |
R | Quantity |
YParity | Quantity |
TxType
AccessListItemForRpc[]
Field name | Type |
---|---|
Address | Address |
StorageKeys | Array |
BlockParameter
Field name | Type |
---|---|
Type | BlockParameterType object |
BlockNumber | Quantity |
BlockHash | Hash |
RequireCanonical | Boolean |
BlockParameterType
Quantity
orString
(latest, earliest, pending)
AccessListForRpc
Field name | Type |
---|---|
AccessList | AccessListItemForRpc[] object |
GasUsed | Quantity |
Executes a tx call and returns gas used (does not create a transaction)
Invocation |
---|
{"method":"eth_estimateGas","params":[transactionCall, blockParameter]} |
Parameter | Type | Description |
---|---|---|
transactionCall | TransactionForRpc object | |
blockParameter | BlockParameter object | |
Returned type | Description |
---|---|
Quantity | |
Example request of eth_estimateGas
Example response of eth_estimateGas
Objects in eth_estimateGas
curl --data '{"method":"eth_estimateGas","params":[transactionCall, blockParameter],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545
{
"jsonrpc": "2.0",
"result": 0x,
"id": 1
}
TransactionForRpc
Field name | Type |
---|---|
Hash | Hash |
Nonce | Quantity |
BlockHash | Hash |
BlockNumber | Quantity |
TransactionIndex | Quantity |
From | Address |
To | Address |
Value | Quantity |
GasPrice | Quantity |
MaxPriorityFeePerGas | Quantity |
MaxFeePerGas | Quantity |
Gas | Quantity |
Data | Data |
Input | Data |
ChainId | Quantity |
Type | TxType object |
AccessList | AccessListItemForRpc[] object |
MaxFeePerDataGas | Quantity |
BlobVersionedHashes | Data |
V | Quantity |
S | Quantity |
R | Quantity |
YParity | Quantity |
TxType
AccessListItemForRpc[]
Field name | Type |
---|---|
Address | Address |
StorageKeys | Array |
BlockParameter
Field name | Type |
---|---|
Type | BlockParameterType object |
BlockNumber | Quantity |
BlockHash | Hash |
RequireCanonical | Boolean |
BlockParameterType
Quantity
orString
(latest, earliest, pending)
Returns block fee history.
Invocation |
---|
{"method":"eth_feeHistory","params":[blockCount, newestBlock, rewardPercentiles]} |
Parameter | Type | Description |
---|---|---|
blockCount | Quantity | |
newestBlock | BlockParameter object | |
rewardPercentiles | Double[] object | |
Returned type | Description |
---|---|
FeeHistoryResults object | |
Example request of eth_feeHistory
Example response of eth_feeHistory
Objects in eth_feeHistory
curl --data '{"method":"eth_feeHistory","params":[blockCount, newestBlock, rewardPercentiles],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545
{
"jsonrpc": "2.0",
"result": {"baseFeePerGas": ["0x116c1cbb03", "0x10c3714c06"], "gasUsedRatio": [0.3487305666666667, 0.3], "oldestBlock": "0xc7e5ff", "reward": [["0x3b9aca00","0x3b9aca00"], ["0x0","0x3bb24dfa"]]},
"id": 1
}
BlockParameter
Field name | Type |
---|---|
Type | BlockParameterType object |
BlockNumber | Quantity |
BlockHash | Hash |
RequireCanonical | Boolean |
BlockParameterType
Quantity
orString
(latest, earliest, pending)
Double[]
FeeHistoryResults
Field name | Type |
---|---|
BaseFeePerGas | Array |
GasUsedRatio | Double[] object |
OldestBlock | Quantity |
Reward | UInt256[][] object |
UInt256[][]
Field name | Type |
---|---|
Length | Quantity |
LongLength | Quantity |
Rank | Quantity |
SyncRoot | Object |
IsReadOnly | Boolean |
IsFixedSize | Boolean |
IsSynchronized | Boolean |
Retrieves Accounts via Address and Blocknumber
Invocation |
---|
{"method":"eth_getAccount","params":[accountAddress, blockParameter]} |
Parameter | Type | Description |
---|---|---|
accountAddress | Address | |
blockParameter | BlockParameter object | |
Returned type | Description |
---|---|
AccountForRpc object | |
Example request of eth_getAccount
Objects in eth_getAccount
curl --data '{"method":"eth_getAccount","params":[accountAddress, blockParameter],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545
BlockParameter
Field name | Type |
---|---|
Type | BlockParameterType object |
BlockNumber | Quantity |
BlockHash | Hash |
RequireCanonical | Boolean |
BlockParameterType
Quantity
orString
(latest, earliest, pending)
AccountForRpc
Field name | Type |
---|---|
CodeHash | Hash |
StorageRoot | Hash |
Balance | Quantity |
Nonce | Quantity |
Returns account balance
Invocation |
---|
{"method":"eth_getBalance","params":[address, blockParameter]} |
Parameter | Type | Description |
---|---|---|
address | Address | |
blockParameter | BlockParameter object | |
Returned type | Description |
---|---|
Quantity | |
Example request of eth_getBalance
Example response of eth_getBalance
Objects in eth_getBalance
curl --data '{"method":"eth_getBalance","params":[address, blockParameter],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545
{
"jsonrpc": "2.0",
"result": 0x6c8ae945bfe6e,
"id": 1
}
BlockParameter
Field name | Type |
---|---|
Type | BlockParameterType object |
BlockNumber | Quantity |
BlockHash | Hash |
RequireCanonical | Boolean |
BlockParameterType
Quantity
orString
(latest, earliest, pending)
Retrieves a block by hash
Invocation |
---|
{"method":"eth_getBlockByHash","params":[blockHash, returnFullTransactionObjects]} |
Parameter | Type | Description |
---|---|---|
blockHash | Hash | |
returnFullTransactionObjects | Boolean | |
Returned type | Description |
---|---|
BlockForRpc object | |
Example request of eth_getBlockByHash
Example response of eth_getBlockByHash
Objects in eth_getBlockByHash
curl --data '{"method":"eth_getBlockByHash","params":[blockHash, returnFullTransactionObjects],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545
{
"jsonrpc": "2.0",
"result": {"author":"0x0000000000000000000000000000000000000000","difficulty":"0x1","extraData":"0x000000000000436f6e73656e5379732048797065726c656467657220426573754d3f7b71165a8266fcc569c96b6fcf9971ee4a8df59eeec4dcced0df8d778733429988e21d0124918859f988be9debf4b25fb5282ea41a2fc15f827f446ec93200","gasLimit":"0x1c9c364","gasUsed":"0x3aa87","hash":"0xf33507f93a046dbdbb80dee5f47b84283297f6c53f1b665adc3cb6fe4138aa84","logsBloom":"0x00000000000020000000000008000060000000000000000000000000000000000000000000000000201000020008000000000000000000000100000000200020000000000000000000000008000000000000000010000000000000000000000000000000000000000000080000000000000000000000002000000010000000000000000000000000000000000000000000040000001000000000000000020000020400000000000000000000000000000000000000000000000000010000000000000002080000000000000000020000000000000000000000000000000000000010020000000000000000000000000100000000000000000000010000000000","miner":"0x0000000000000000000000000000000000000000","mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000","nonce":"0x0000000000000000","number":"0x4e3d79","parentHash":"0x01dba3a7eb61dc6dba3f9663c8fb632f76f60a476f57df74c3e5bd9d0a246339","receiptsRoot":"0x70f3bd929735d8edeb953cd30a27e703e7dd3ec4af32cb74fe8ac302f9e7fb87","sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","size":"0x754","stateRoot":"0x71af7e25302d1baa4c988c267450eb2c7fa20938fac377809c8d77f8ff8108ac","totalDifficulty":"0x726275","timestamp":"0x60ec1218","baseFeePerGas":"0x7","transactions":["0xa65d391d8149ed0906fab923e870d2bc7f6d27c2be10fe1bcfc6f02869b38ef3","0x369a89354041b7a8cb40edce51c36ebb0ee6ffa4d8056f5a658d90f3bbe1a81a","0xf857daf60d03381b9a6ecb341b62798b424d20dc05763858e13955dd866b489d"],"transactionsRoot":"0x90115f8dc10c08e748675f52f3904615729a014461ca80d72c60239bf75ee209","uncles":[]},
"id": 1
}
BlockForRpc
Field name | Type |
---|---|
Author | Address |
Difficulty | Quantity |
ExtraData | Data |
GasLimit | Quantity |
GasUsed | Quantity |
Hash | Hash |
LogsBloom | Bloom Object |
Miner | Address |
MixHash | Hash |
Nonce | Data |
Number | Quantity |
ParentHash | Hash |
ReceiptsRoot | Hash |
Sha3Uncles | Hash |
Signature | Data |
Size | Quantity |
StateRoot | Hash |
Step | Quantity |
TotalDifficulty | Quantity |
Timestamp | Quantity |
BaseFeePerGas | Quantity |
Transactions | Array |
TransactionsRoot | Hash |
Uncles | Array |
Withdrawals | Array |
WithdrawalsRoot | Hash |
ExcessDataGas | Quantity |
Retrieves a block by number
Invocation |
---|
{"method":"eth_getBlockByNumber","params":[blockParameter, returnFullTransactionObjects]} |
Parameter | Type | Description |
---|---|---|
blockParameter | BlockParameter object | |
returnFullTransactionObjects | Boolean | |