Base — eth
API reference for Base. All methods ->
eth_getUncleByBlockHashAndIndex
Returns information about an uncle of a block by hash and uncle index position.
Parameters
-
id(integer; required): a request ID (example: 1). -
jsonrpc(string; required): a JSON RPC spec used (example: 2.0). -
method(string; required): a method used for the request. -
params(array; required):<string>(data, 32 bytes): the hash of a block.<string>(quantity): the uncle's index position.
Returns
<object>: a block object, or null when no block was found:number(string; quantity): the block number; null when it's a pending block.hash(string; data, 32 bytes): the hash of the block; null when it's a pending block.parentHash(string; data, 32 bytes): the hash of the parent block.nonce(string; data, 8 bytes): the hash of the generated proof-of-work; null when it's a pending block.sha3Uncles(string; data, 32 bytes): SHA3 of the uncles data in the block.logsBloom(string; data, 256 bytes): the bloom filter for the logs of the block. null when its pending block.transactionsRoot(string; data, 32 bytes): the root of the transaction trie of the block.stateRoot(string; data, 32 bytes): the root of the final state trie of the block.receiptsRoot(string; data, 32 bytes): the root of the receipts trie of the block.miner(string; data, 20 bytes): the address of the beneficiary to whom the mining rewards were given.difficulty(string; quantity): the difficulty for this block.totalDifficulty(string; quantity): the total difficulty of the chain until this block.extraData(string; data): the extra data field of this block.size(string; quantity): the size of this block in bytes.gasLimit(string; quantity): the maximum gas allowed in this block.gasUsed(string; quantity): the total used gas by all transactions in this block.timestamp(string; quantity): the unix timestamp for when the block was collated.transactions(array of strings): an array of transaction objects, or 32 bytes transaction hashes depending on the last given parameter.uncles(array of strings): an array of uncle hashes.
Request example
curl -X POST https://rpc.ankr.com/base/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getUncleByBlockHashAndIndex",
"params": ["0xf54b65b1c0ba67b2fb64add9151df5a5f2ee6366e16c3e6f01adb4c9a2e58bdf", "0x0"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"difficulty": "0x4ea3f27bc",
"extraData": "0x476574682f4c5649562f76312e302e302f6c696e75782f676f312e342e32",
"gasLimit": "0x1388",
"gasUsed": "0x0",
"hash": "0xdc0818cf78f21a8e70579cb46a43643f78291264dda342ae31049421c82d21ae",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"miner": "0xbb7b8287f3f0a933474a79eae42cbca977791171",
"mixHash": "0x4fffe9ae21f1c9e15207b1f472d5bbdd68c9595d461666602f2be20daf5e7843",
"nonce": "0x689056015818adbe",
"number": "0x1b4",
"parentHash": "0xe99e022112df268087ea7eafaf4790497fd21dbeeb6bd7a1721df161a6657a54",
"receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"size": "0x220",
"stateRoot": "0xddc8b0234c2e0cad087c8b389aa7ef01f7d79b2570bccb77ce48648aa61c904d",
"timestamp": "0x55ba467c",
"totalDifficulty": "0x78ed983323d",
"transactions": [],
"transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"uncles": []
}
}
eth_getUncleByBlockNumberAndIndex
Returns information about an uncle of a block by number and uncle index position.
Parameters
-
id(integer; required): a request ID (example: 1). -
jsonrpc(string; required): a JSON RPC spec used (example: 2.0). -
method(string; required): a method used for the request. -
params(array; required):<string>(quantity|tag): either the hex value of a block number or one of the following block tags:earliest: the lowest numbered block available on the client.finalized: the most recent crypto-economically secure block; cannot be re-orged outside of manual intervention driven by community coordination.safe: the most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions.latest: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.pending: a sample next block built by the client on top of thelatestand containing the set of transactions usually taken from local mempool. In other words, it is the block that has not been mined yet.
<string>(quantity): the uncle's index position.
Returns
<object>: a block object, or null when no block was found:number(string; quantity): the block number; null when it's a pending block.hash(string; data, 32 bytes): the hash of the block; null when it's a pending block.parentHash(string; data, 32 bytes): the hash of the parent block.nonce(string; data, 8 bytes): the hash of the generated proof-of-work; null when it's a pending block.sha3Uncles(string; data, 32 bytes): SHA3 of the uncles data in the block.logsBloom(string; data, 256 bytes): the bloom filter for the logs of the block. null when its pending block.transactionsRoot(string; data, 32 bytes): the root of the transaction trie of the block.stateRoot(string; data, 32 bytes): the root of the final state trie of the block.receiptsRoot(string; data, 32 bytes): the root of the receipts trie of the block.miner(string; data, 20 bytes): the address of the beneficiary to whom the mining rewards were given.difficulty(string; quantity): the difficulty for this block.totalDifficulty(string; quantity): the total difficulty of the chain until this block.extraData(string; data): the extra data field of this block.size(string; quantity): the size of this block in bytes.gasLimit(string; quantity): the maximum gas allowed in this block.gasUsed(string; quantity): the total used gas by all transactions in this block.timestamp(string; quantity): the unix timestamp for when the block was collated.transactions(array of strings): an array of transaction objects, or 32 bytes transaction hashes depending on the last given parameter.uncles(array of strings): an array of uncle hashes.
Request example
curl -X POST https://rpc.ankr.com/base/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getUncleByBlockNumberAndIndex",
"params": ["latest", "0x0"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"difficulty": "0x57f117f5c",
"extraData": "0x476574682f76312e302e302f77696e646f77732f676f312e342e32",
"gasLimit": "0x1388",
"gasUsed": "0x0",
"hash": "0x932bdf904546a2287a2c9b2ede37925f698a7657484b172d4e5184f80bdd464d",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"miner": "0x5bf5e9cf9b456d6591073513de7fd69a9bef04bc",
"mixHash": "0x4500aa4ee2b3044a155252e35273770edeb2ab6f8cb19ca8e732771484462169",
"nonce": "0x24732773618192ac",
"number": "0x299",
"parentHash": "0xa779859b1ee558258b7008bbabff272280136c5dd3eb3ea3bfa8f6ae03bf91e5",
"receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"size": "0x21d",
"stateRoot": "0x2604fbf5183f5360da249b51f1b9f1e0f315d2ff3ffa1a4143ff221ad9ca1fec",
"timestamp": "0x55ba4827",
"totalDifficulty": "0xc46826a2c6a",
"transactions": [],
"transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"uncles": []
}
}
eth_getLogs
Returns an array of all logs matching a given filter object.
Parameters
-
id(integer; required): a request ID (example: 1). -
jsonrpc(string; required): a JSON RPC spec used (example: 2.0). -
method(string; required): a method used for the request. -
params(array; required):-
object: the filter options:-
fromBlock(string; quantity|tag; optional; default: "latest"): either the block number or one of the following block tags:latest: for the last mined block.earliest: for the lowest numbered block available on the client.pending: for not yet mined transactions.
-
toBlock(string; quantity|tag; optional; default: "latest"): either the block number or one of the following block tags:latest: for the last mined block.earliest: for the lowest numbered block available on the client.pending: for not yet mined transactions.
-
address(array of strings; data, 20 bytes; optional): a contract address or a list of addresses from which logs should originate. -
topics(array of strings; data; optional): an array of 32 bytes data topics. Topics are order-dependent. Each topic can also be an array of data with "or" options. -
blockhash(string; data, 32 bytes; optional; future): with the addition of EIP-234,blockHashwill be a new filter option which restricts the logs returned to the single block with the 32-byte hash blockHash. Using blockHash is equivalent tofromBlock = toBlock = the blocknumber with hash blockHash. IfblockHashis present in the filter criteria, then neitherfromBlocknortoBlockare allowed.
-
-
Returns
removed(string; tag):truewhen the log was removed, due to a chain reorganization;falseif it's a valid log.logIndex(string; quantity): the log index position in the block; null when it's a pending log.transactionIndex(string; quantity): the transactions index position log was created from; null when it's a pending log.transactionHash(string; data, 32 bytes): a hash of the transactions this log was created from; null when it's a pending log.blockHash(string; data, 32 bytes): a hash of the block containing the log; null when it's pending; null when it's a pending log.blockNumber(string; quantity): the number of the block containing the log; null when it's pending; null when it's a pending log.address(string; data, 20 bytes): an address from which this log originated.data(string; data): contains one or more 32 bytes non-indexed arguments of the log.topics(array of strings; data): an array of 0 to 4 32 bytes data of indexed log arguments. (In solidity: The first topic is the hash of the signature of the event (e.g. Deposit(address,bytes32,uint256)), except you declared the event with the anonymous specifier.)
Request example
curl -X POST https://rpc.ankr.com/base/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getLogs",
"params": [{"address": "0x647830A95A754BDFf41a75ff8786392760f17Fc4"}],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x0000000000000000000000009acbb72cf67103a30333a32cd203459c6a9c3311",
"0x000000000000000000000000994871e1103c5da4be270365fa62771ea4525520"
],
"data": "0x000000000000000000000000000000000000000000000000000000001ec39aa0",
"blockNumber": "0xf6289d",
"transactionHash": "0xc7ed73c9b219d4243872e5993ad2950c8ea87d15af28562d33b0c05d46a90cee",
"transactionIndex": "0x1e",
"blockHash": "0x1e12377f0357320c0e5cfcadc2dfbc9c75fc339be668e118c34e4333f835ef31",
"logIndex": "0x13",
"removed": false
},
{
"address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x0000000000000000000000005879975799597392c031f10b6eff282cb7974ac8",
"0x0000000000000000000000006d52ab66340f3f78d0c1007bec484268876b5948"
],
"data": "0x0000000000000000000000000000000000000000000000000000000000000000",
"blockNumber": "0xf6289d",
"transactionHash": "0x0118499f7be4c3510bd60fe3a3aee5f5f316743b6cc13a8cb0528d784f962aec",
"transactionIndex": "0x20",
"blockHash": "0x1e12377f0357320c0e5cfcadc2dfbc9c75fc339be668e118c34e4333f835ef31",
"logIndex": "0x14",
"removed": false
}
]
}
eth_getBlockByNumber
Use the
pendingtag to retrieve the latest Flashblock.
Parameters
-
id(integer; required): a request ID (example: 1). -
jsonrpc(string; required): a JSON RPC spec used (example: 2.0). -
method(string; required): a method used for the request. -
params(array; required):<string>(tag; required): use thependingtag to retrieve the latest Flashblock.<boolean>(required): iftrue— returns the full transaction objects, iffalse— only the hashes of the transactions.
Returns
Retrieves the latest Flashblock object.
Request example
curl -X POST https://rpc.ankr.com/base/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBlockByNumber",
"params": ["pending", false],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"hash": "0x644a1a48e50bd435aad25937b21deff4de85e2309cc985118a1e3ec793242702",
"parentHash": "0x945900ddc4a6e02b9d3ac1ea9d888e7ad4d9e7345ed1f275974906c8ca9529cc",
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"miner": "0x4200000000000000000000000000000000000011",
"stateRoot": "0x72ac5384d9655594d36ce6ff3c855494cf13dc150321ba9d9a741c5cf7988754",
"transactionsRoot": "0x717fc55e978778557c5f7ebb7ef2cd82f6402db9852e8c3420ca9ab6c875f900",
"receiptsRoot": "0xfe0b80a42048813c3bf9604af7c70983ffd2f924336834ee039c6311c2d570e4",
"logsBloom": "0x12a37759df470838b0ab9272ae9fabe07c748764ba519647ff4414392160efaf25edcfd878071368de52df73972e778f8dd7d8399c6165cb27b20f946cbcf1c2c5e59cdd3b751e383fb516fbe1cac5a673cef5b700fc333ce986c0a9d366a2413bc4c06c8e8f9fc42548be2b6d0f3ea99d4b5f261e343fb9dff2b5bdc1cbb6a3a531f2d9dbed5f98457bc773884fef23cd8397f95eedc07f36ba43fe0fe1911f8e481f998a98fde5b77195c350328cd33e496a1bd61a9dde85c31f3f10e0c7abea4784ab66f9acddd957fb8cf27ff2cf8f7dd0cf36fda6d6c10437a2773ae94d5cfff849074dec8b7a74aab83f5335f585839701a5fe0e762e47face29838fc2",
"difficulty": "0x0",
"number": "0x212569b",
"gasLimit": "0x8f0d180",
"gasUsed": "0x33ebb21",
"timestamp": "0x68af0a19",
"extraData": "0x000000003200000003",
"mixHash": "0x33e69310dcf1126f078ecb8f5c53b97b12dec80b94b967553d19bf5b7fa66636",
"nonce": "0x0000000000000000",
"baseFeePerGas": "0x2615e00",
"withdrawalsRoot": "0x1aa45fb269b554ebdb203695ad59ad99a753aa6117dafbff40c42e81b9a6f458",
"blobGasUsed": "0x0",
"excessBlobGas": "0x0",
"parentBeaconBlockRoot": "0x3a4854cb45bcbde7a8071e87b739a300d0c3586b02ea305c0bc32ecee4f6c747",
"requestsHash": "0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"size": "0x2ed2c",
"uncles": [],
"transactions": [
"0x16175d34cd1f9819ded6c9e1c630d05fd0c9f67a3373bfb26c5283e0f2f1fb25",
"0xa557335163d512fed8926a25c0862a02b551795b5a01ff8acc337e2c7511e83b",
"0xaf29ec8573ec61a9e5e9a7249576333c5a0cfa5804c57c63a7248518eeb445e5",
"0xfadfd79be42e585371184be82d6b98c56231ead2da90583b87946688df843d72" ],
"withdrawals": []
}
}
eth_getTransactionReceipt
Retrieves the receipts for preconfirmed transactions.
Parameters
-
id(integer; required): a request ID (example: 1). -
jsonrpc(string; required): a JSON RPC spec used (example: 2.0). -
method(string; required): a method used for the request. -
params(array; required):<hash>(string; required): the transaction hash.
Returns
Returns preconfirmation-aware receipt data if the transaction is already included in a Flashblock.
Request example
curl -X POST https://rpc.ankr.com/base/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getTransactionReceipt",
"params": ["0x16175d34cd1f9819ded6c9e1c630d05fd0c9f67a3373bfb26c5283e0f2f1fb25"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"type": "0x7e",
"status": "0x1",
"cumulativeGasUsed": "0xb44c",
"logs": [],
"depositNonce": "0x212569d",
"depositReceiptVersion": "0x1",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"transactionHash": "0x16175d34cd1f9819ded6c9e1c630d05fd0c9f67a3373bfb26c5283e0f2f1fb25",
"transactionIndex": "0x0",
"blockHash": "0x644a1a48e50bd435aad25937b21deff4de85e2309cc985118a1e3ec793242702",
"blockNumber": "0x212569b",
"gasUsed": "0xb44c",
"effectiveGasPrice": "0x0",
"from": "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001",
"to": "0x4200000000000000000000000000000000000015",
"contractAddress": null,
"l1GasPrice": "0x671d09ca",
"l1GasUsed": "0x6da",
"l1Fee": "0x0",
"l1BaseFeeScalar": "0x8dd",
"l1BlobBaseFee": "0x1",
"l1BlobBaseFeeScalar": "0x101c12"
}
}
eth_getBalance
Use the
pendingtag to retrieve the address balance in the latest Flashblock.
Parameters
-
id(integer; required): a request ID (example: 1). -
jsonrpc(string; required): a JSON RPC spec used (example: 2.0). -
method(string; required): a method used for the request. -
params(array; required):<string>(required): the address to check the balance for.<string>(tag; required): use thependingtag to retrieve the address balance in the latest Flashblock.
Returns
The account balance in wei (hex-encoded string).
Request example
curl -X POST https://rpc.ankr.com/base/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBalance",
"params": ["0x742d35Cc6634C0532925a3b844Bc454e4438f44e", "pending"],
"id": 1
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": "0x64c9dd3ba4625"
}
eth_getTransactionCount
Use the
pendingtag to retrieve the address nonce in the latest Flashblock.
Parameters
-
id(integer; required): a request ID (example: 1). -
jsonrpc(string; required): a JSON RPC spec used (example: 2.0). -
method(string; required): a method used for the request. -
params(array; required):<string>(required): the account address to query.<string>(tag; required): usependingto retrieve the nonce including the latest Flashblock state.
Returns
The transaction count (nonce) of the given address, returned as a hex-encoded integer.
Request example
curl -X POST https://rpc.ankr.com/base/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getTransactionCount",
"params": ["0x22d1b96d8EbA60BBd2e59573223eA650941Dd43D", "pending"],
"id": 1
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": "0x2"
}
eth_getTransactionByHash
Retrieves preconfirmed transactions by hash.
Parameters
-
id(integer; required): a request ID (example: 1). -
jsonrpc(string; required): a JSON RPC spec used (example: 2.0). -
method(string; required): a method used for the request. -
params(array; required):<string>(required): the hash of the transaction to retrieve.
Returns
The transaction object if found (including when present in a Flashblock preconfirmation); null if the transaction is unknown.
Request example
curl -X POST https://rpc.ankr.com/base/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getTransactionByHash",
"params": ["0x16175d34cd1f9819ded6c9e1c630d05fd0c9f67a3373bfb26c5283e0f2f1fb25"],
"id": 1
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"type": "0x7e",
"sourceHash": "0x27da63a8ebe6b50bd7848cacad5b86358e86d31d34ff12023a7941bd70ecef93",
"from": "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001",
"to": "0x4200000000000000000000000000000000000015",
"mint": "0x0",
"value": "0x0",
"gas": "0xf4240",
"input": "0x098999be000008dd00101c1200000000000000020000000068af095f000000000162811000000000000000000000000000000000000000000000000000000000671d09ca0000000000000000000000000000000000000000000000000000000000000001076c7bd697aeb085221315e39c6748a7e7f1ed7e73961cf883c80452f07c30290000000000000000000000005050f69a9786f081509234f1a7f4684b5e5b76c9000000000000000000000000",
"hash": "0x16175d34cd1f9819ded6c9e1c630d05fd0c9f67a3373bfb26c5283e0f2f1fb25",
"r": "0x0",
"s": "0x0",
"yParity": "0x0",
"v": "0x0",
"blockHash": "0x644a1a48e50bd435aad25937b21deff4de85e2309cc985118a1e3ec793242702",
"blockNumber": "0x212569b",
"transactionIndex": "0x0",
"depositReceiptVersion": "0x1",
"gasPrice": "0x0",
"nonce": "0x212569d"
}
}