eth_getLogs
Returns an array of event logs matching the given filter criteria. This is the primary method for querying contract events such as ERC20 transfers, approvals, and other on-chain activity.
Parameters
| # | Type | Description |
|---|---|---|
| 1 | object | Filter object. |
The filter object supports these fields:
| Field | Type | Required | Description |
|---|---|---|---|
fromBlock | string | No | Start block (hex or tag). Defaults to "latest". |
toBlock | string | No | End block (hex or tag). Defaults to "latest". |
address | string or array | No | Contract address or array of addresses to filter by. |
topics | array | No | Array of topic filters. Each element is a topic hash or null for a wildcard. |
Returns
array -- An array of log objects. Each log contains:
| Field | Type | Description |
|---|---|---|
address | string | The contract address that emitted the event. |
topics | array | Array of 32-byte topic hashes. topics[0] is the event signature hash. |
data | string | ABI-encoded non-indexed event parameters. |
blockNumber | string | Block number where the log was emitted (hex). |
transactionHash | string | Hash of the transaction that emitted the log. |
transactionIndex | string | Transaction index within the block (hex). |
blockHash | string | Hash of the block. |
logIndex | string | Log index within the block (hex). |
removed | boolean | true if the log was removed due to a chain reorganization. |
Example
Fetch ERC20 Transfer events from the WPLS contract for a recent block range:
curl -s -X POST https://rpc.pulsechain.box \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getLogs",
"params": [{
"fromBlock": "0x18b7000",
"toBlock": "0x18b7064",
"address": "0xA1077a294dDE1B09bB078844df40758a5D0f9a27",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
]
}],
"id": 1
}'
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"address": "0xa1077a294dde1b09bb078844df40758a5d0f9a27",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x000000000000000000000000sender_address_here________________",
"0x000000000000000000000000receiver_address_here_______________"
],
"data": "0x00000000000000000000000000000000000000000000003635c9adc5dea00000",
"blockNumber": "0x18b7032",
"transactionHash": "0xabc123...",
"transactionIndex": "0x0",
"blockHash": "0xdef456...",
"logIndex": "0x0",
"removed": false
}
]
}
Notes
- The
topics[0]for the ERC20Transfer(address,address,uint256)event is0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. This is the keccak256 hash of the event signature. - Topics support positional filtering. For example, to find transfers from a specific address, set
topics[1]to the zero-padded sender address. Set a position tonullto match any value. - Querying large block ranges without an
addressfilter can be very slow and may time out. Always scope your queries as narrowly as possible. - The node may impose a maximum block range or result count. If the response is too large, narrow the
fromBlock/toBlockrange. - On an archive node, you can query logs from any historical block.
- Common event signatures:
Transfer(address,address,uint256)--0xddf252ad...Approval(address,address,uint256)--0x8c5be1e5...Swap(address,uint256,uint256,uint256,uint256,address)(Uniswap V2) --0xd78ad95f...
eth_createAccessList
Creates an EIP-2930 access list for a transaction. An access list specifies which addresses and storage slots the transaction will access, allowing for gas savings by pre-declaring state accesses.
eth_getBlockReceipts
Returns all transaction receipts for a given block. This is more efficient than calling eth_getTransactionReceipt individually for each transaction in a block.
