Optimism API Documentation
eth_getBlockRange RPC Method
eth_getBlockRange
retrieves information about a range of blocks from the Ethereum blockchain.
eth_getBlockRange
method as it is depricated & not in use anymore. Use eth_getBlockByNumber
in a batch request instead.
eth_getBlockRange
method is only availible on Optimism.
Parameters
-
startBlock
- number or Tag - The starting block number from which to retrieve the block range. Can be given as a hexadecimal number or as one of the tagsearliest
for the earliest block orlatest
for the latest block -
endBlock
- number or Tag - The ending block number up to which to retrieve the block range. Hexadecimal number or one of the tagsearliest
for the earliest block orlatest
for the latest block -
fullTransactionObjects
- boolean - If set totrue
, the transactions in blocks will be returned as objects; iffalse
, only the transaction hashes will be returned.
Returns
-
Array
- An array of block objects, or an empty array if no blocks are found. Each block object contains the fields:-
number
- QUANTITY - The block number. null when its pending block. -
hash
- DATA, 32 Bytes - Hash of the block. null when its pending block. -
parentHash
- DATA, 32 Bytes - Hash of the parent block. -
nonce
- DATA, 8 Bytes - Hash of the generated proof-of-work. null when its pending block. -
sha3Uncles
- DATA, 32 Bytes - SHA3 of the uncles data in the block. -
logsBloom
- DATA, 256 Bytes - The bloom filter for the logs of the block. null when its pending block. -
transactionsRoot
- DATA, 32 Bytes - The root of the transaction trie of the block. -
stateRoot
- DATA, 32 Bytes - The root of the final state trie of the block. -
receiptsRoot
- DATA, 32 Bytes - The root of the receipts trie of the block. -
miner
- DATA, 20 Bytes - The address of the beneficiary to whom the mining rewards were given. -
difficulty
- QUANTITY - Integer of the difficulty for this block. -
totalDifficulty
- QUANTITY - Integer of the total difficulty of the chain until this block. -
extraData
- DATA - The "extra data" field of this block. -
size
- QUANTITY - Integer the size of this block in bytes. -
gasLimit
- QUANTITY - The maximum gas allowed in this block. -
gasUsed
- QUANTITY - The total used gas by all transactions in this block. -
timestamp
- QUANTITY - The unix timestamp for when the block was collated. -
transactions
- Array - Array of transaction objects, or 32 Bytes transaction hashes depending on the last given parameter. -
uncles
- Array - Array of uncle hashes.
-
Need RPC API keys?
Get 12.5M archival requests for free today.
Request
POST https://<network>.chainnodes.org/YOUR-API-KEY
Example
- HTTPS POST Request with a JSON RPC call in the body
- Replace YOUR-API-KEY with the API key from your CHAINNODES.ORG Dashboard
- You can use a different supported network by replacing
optimism-mainnet
curl https://optimism-mainnet.chainnodes.org/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"id": "1",
"jsonrpc":"2.0",
"method":"eth_getBlockRange",
"params": ["0x6B5DE7D",
"0x6B5DE74",
false]
}'
Result example
{"id":"1",
"jsonrpc":"2.0",
"error":{"code":-32601,
"message":"the method eth_getBlockRange does not exist\/is not available"}}
💡 Confusing?
Ask our experienced blockchain developers in Telegram
JSON-RPC Optimism API Documentation by CHAINNODES is based on Erigon node client. Contact us if you are interested in specific methods that are only available on geth, besu, Nethermind or reth