eth_getLogs - Sonic
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
curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "eth_getLogs",
"params": [{"fromBlock": "0x1e8400", "toBlock": "0x1e8480", "address": "0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38", "topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}],
"id": "getblock.io"
}'const axios = require('axios');
const response = await axios.post('https://go.getblock.io/<ACCESS-TOKEN>/', {
jsonrpc: '2.0',
method: 'eth_getLogs',
params: [{"fromBlock": "0x1e8400", "toBlock": "0x1e8480", "address": "0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38", "topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}],
id: 'getblock.io'
}, {
headers: { 'Content-Type': 'application/json' }
});
console.log(response.data.result);import requests
response = requests.post(
'https://go.getblock.io/<ACCESS-TOKEN>/',
headers={'Content-Type': 'application/json'},
json={
'jsonrpc': '2.0',
'method': 'eth_getLogs',
'params': [{"fromBlock": "0x1e8400", "toBlock": "0x1e8480", "address": "0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38", "topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}],
'id': 'getblock.io'
}
)
print(response.json())Response
Response Parameters
Parameter
Type
Description
Log Object
Field
Type
Description
Use Cases
Error Handling
Error Code
Message
Description
Web3 Integration
Was this helpful?