Skip to main content

eth_getLogs

POST

Returns all event logs that match the given conditions.

📘 On GreatVoyage-v4.8.2 and later, each log includes blockTimestamp.

On gateways that have not been upgraded yet, this field may be omitted.

By default the queryable block range is limited to 5,000 blocks, configured by the node's node.jsonrpc.maxBlockRange

setting. The address array allows up to 1,000 entries, and topics allows up to 4 positions.

param[0]
filterOptionsobjectrequired
The filter object that specifies the log query conditions.When blockHash is used, fromBlock and toBlock must not be specified together.
fromBlockstring
The block to start searching from. Pass a hexadecimal block number or the latest, earliest or finalized tag.pending and safe are not supported. When omitted, latest is applied.
toBlockstring
The block to stop searching at. It accepts the same tags as fromBlock, and latest is applied when omitted.
addressoneOf
The contract address that emitted the logs. Pass a single address or an array of addresses.By default the array allows up to 1,000 entries; exceeding that returns a -32602 error.The contract address.
topicsarray
The list of topics to query. Their order is significant, and up to 4 positions can be specified.Each position may contain null (matches any value) or an array for OR conditions, andby default each position allows up to 1,000 OR candidates.
blockHashstring
A 32-byte block hash that restricts the query to a single block.When this value is given, fromBlock and toBlock must not be specified together.
Responses
addressstring
The address of the contract that emitted the log.
topicsarray
The list of log topics. The first entry is the event signature hash.
datastring
The ABI-encoded data for the non-indexed event arguments.
blockNumberstring
The number of the block containing the log.
blockHashstring
The hash of the block containing the log.
blockTimestampstring
The creation time of the block containing the log, in UNIX epoch seconds, hex-encoded.It is returned on GreatVoyage-v4.8.2 and later, and may be omitted on gateways that have not been upgraded yet.
transactionHashstring
The hash of the transaction that emitted the log.
transactionIndexstring
The transaction index within the block.
logIndexstring
The log index within the block.
removedboolean
Whether the log was removed by a chain reorganization.
codestringrequired
Code identifying the cause of the failed request.
messagestringrequired
Detailed message including the name and value of the invalid parameter.
{
"code": "ERROR_CODE",
"message": "Unauthorized"
}
cURL
curl -X POST 'https://tron-mainnet.nodit.io' \
-H 'Content-Type: application/json' \
-H 'X-API-KEY: nodit-demo' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_getLogs",
"params": [
{
"fromBlock": "0x3e8a920",
"toBlock": "0x3e8a984",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x0000000000000000000000001975fbea3496424a88de2a147d76baa34a3d1b93",
"0x000000000000000000000000c3abfbceb364febe625662a9af6add366df58f81"
]
}
]
}'