eth_getLogs - Celo
Example code for the eth_getLogs JSON-RPC method. Complete guide on how to use eth_getLogs JSON-RPC in GetBlock Web3 documentation.
Parameters
Parameter
Type
Required
Description
Filter Object
Field
Type
Required
Description
Request Example
curl -X POST https://go.getblock.io/<ACCESS-TOKEN>/ \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": "getblock.io",
"method": "eth_getLogs",
"params": [
{
"fromBlock": "0x1d9f000",
"toBlock": "latest",
"address": "0x765DE816845861e75A25fCA122bb6898B8B1282a",
"topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]
}
]
}'const axios = require('axios');
const url = 'https://go.getblock.io/<ACCESS-TOKEN>/';
// Track cUSD Transfer events
const payload = {
jsonrpc: '2.0',
id: 'getblock.io',
method: 'eth_getLogs',
params: [
{
fromBlock: '0x1d9f000',
toBlock: 'latest',
address: '0x765DE816845861e75A25fCA122bb6898B8B1282a', // cUSD contract
topics: ['0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'] // Transfer event
}
]
};
axios.post(url, payload, {
headers: { 'Content-Type': 'application/json' }
})
.then(response => console.log(response.data))
.catch(error => console.error(error));Response Example
Response Definition
Field
Type
Description
Use Cases
Error Handling
Error Code
Description
SDK Integration
Last updated
Was this helpful?