You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some JSONRPC methods return much data, like eth_getLogs, which will worsen as blockchains achieve more transaction throughput.
To overcome RPCs limitations, some Dapps/Indexers are doing eth_getLogs requests are made by chunks of blocks, but this is probably inefficient for the Dapps, as they have many useless requests to the JSONRPC endpoint.
Specification
Parameters:
Object
logLimit: [optional] Maximum number of logs to be returned
address: [optional] Contract address (20 bytes) or a list of addresses from which logs should originate.
fromBlock: [optional, default is "latest"] A hexadecimal block number, or one of the string tags latest, earliest, pending, safe, or finalized. See the default block parameter.
toBlock: [optional, default is "latest"] A hexadecimal block number, or one of the string tags latest, earliest, pending, safe, or finalized. See the default block parameter.
topics: [optional] Array of 32 bytes DATA topics. Topics are order-dependent.
blockhash: [optional] Restricts the logs returned to the single block referenced in the 32-byte hash blockHash. Using blockHash is equivalent to setting fromBlock and toBlock to the block number referenced in the blockHash. If blockHash is present in the filter criteria, then neither fromBlock nor toBlock are allowed.
As such, the SDK could automatically make the following request for the next iteration
"fromBlock": "earliest",
"toBlock": "0x429d3c",
Technical notes:
If the limit is 10000 logs, and the number of logs between block N and N+I excluded is 9999. But in block N+I there are 10 logs. Then we would return 9999 logs and put nextBlockResult: N+I
To make old code compatible, we should create an eth_getLogsV2
The text was updated successfully, but these errors were encountered:
Kriys94
changed the title
WIP - JSONRPC responses with cursor/paging
JSONRPC responses with cursor/paging
Jan 7, 2025
Motivation
Some JSONRPC methods return much data, like eth_getLogs, which will worsen as blockchains achieve more transaction throughput.
To overcome RPCs limitations, some Dapps/Indexers are doing eth_getLogs requests are made by chunks of blocks, but this is probably inefficient for the Dapps, as they have many useless requests to the JSONRPC endpoint.
Specification
Parameters:
logLimit
: [optional] Maximum number of logs to be returnedaddress
: [optional] Contract address (20 bytes) or a list of addresses from which logs should originate.fromBlock
: [optional, default is "latest"] A hexadecimal block number, or one of the string tags latest, earliest, pending, safe, or finalized. See the default block parameter.toBlock
: [optional, default is "latest"] A hexadecimal block number, or one of the string tags latest, earliest, pending, safe, or finalized. See the default block parameter.topics
: [optional] Array of 32 bytes DATA topics. Topics are order-dependent.blockhash
: [optional] Restricts the logs returned to the single block referenced in the 32-byte hash blockHash. Using blockHash is equivalent to setting fromBlock and toBlock to the block number referenced in the blockHash. If blockHash is present in the filter criteria, then neither fromBlock nor toBlock are allowed.Response:
nextBlockResult
: Block Number to get the next batch of responselogs
: List of logs matching the filter of the requestAs such, the SDK could automatically make the following request for the next iteration
Technical notes:
The text was updated successfully, but these errors were encountered: