eth_getLogs

Network: Arc · Mainnet · Chain ID 5042 (0x13b2)

Data: full node. Old-block state is not available on Arc; query recent blocks.

Counts as 1 request. See Request Counting.

Returns an array of all logs matching a given filter object. This is one of the most commonly used methods for indexing and monitoring smart contract events.

Parameters

  1. Object — Filter options:
    FieldTypeDescription
    fromBlockQUANTITY|TAGStart block (default: "latest")
    toBlockQUANTITY|TAGEnd block (default: "latest")
    addressDATA|ArrayContract address(es) to filter
    topicsArrayTopic filters (indexed event params)
    blockHashDATARestricts to a single block

Returns

Array — Array of log objects:

FieldTypeDescription
addressDATAContract that emitted the log
topicsArray<DATA>Indexed event parameters
dataDATANon-indexed event parameters
blockNumberQUANTITYBlock number
transactionHashDATATransaction hash
logIndexQUANTITYLog index in block

Request

{ "jsonrpc": "2.0", "method": "eth_getLogs", "params": [ { "fromBlock": "0x134E800", "toBlock": "0x134E810", "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", "topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"] } ], "id": 1 }

The example filters ERC-20 Transfer events for one token contract. Replace address and the block range with values on Arc.

The topic 0xddf252ad... is the keccak-256 hash of Transfer(address,address,uint256).

Code Examples

curl -X POST https://arc-rpc.blockreq.com/v1/rpc/public \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","method":"eth_getLogs","params":[{"fromBlock":"0x134E800","toBlock":"0x134E810","address":"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}],"id":1}'

Try It