eth_getLogs - Tron
Example code for the eth_getLogs JSON_RPC method. Complete guide on how to use eth_getLogs JSON_RPC method in GetBlock Web3 documentation.
Parameters
Parameter
Type
Required
Description
Request
curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/jsonrpc' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "eth_getLogs",
"params": [{"fromBlock": "0x40d2900", "toBlock": "0x40d2a00", "address": "0x41a614f803b6fd780986a42c78ec9c7f77e6ded13c", "topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}],
"id": "getblock.io"
}'const axios = require('axios');
const response = await axios.post('https://go.getblock.io/<ACCESS-TOKEN>/jsonrpc', {
jsonrpc: '2.0',
method: 'eth_getLogs',
params: [{"fromBlock": "0x40d2900", "toBlock": "0x40d2a00", "address": "0x41a614f803b6fd780986a42c78ec9c7f77e6ded13c", "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>/jsonrpc',
headers={'Content-Type': 'application/json'},
json={
'jsonrpc': '2.0',
'method': 'eth_getLogs',
'params': [{"fromBlock": "0x40d2900", "toBlock": "0x40d2a00", "address": "0x41a614f803b6fd780986a42c78ec9c7f77e6ded13c", "topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}],
'id': 'getblock.io'
}
)
print(response.json())Response
{
"jsonrpc": "2.0",
"id": "getblock.io",
"result": [
{
"address": "0x41a614f803b6fd780986a42c78ec9c7f77e6ded13c",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x000000000000000000000000f0cc5a2a84cd0f68ed1667070934542d673acbd8"
],
"data": "0x00000000000000000000000000000000000000000000000000000000000f4240",
"blockNumber": "0x40d2980",
"transactionHash": "0xd5ec749ecc2a615399d8a6c864ea4c74ff9f523c2be0e341ac9be5d47d7c2d62",
"logIndex": "0x0"
}
]
}Response Parameters
Parameter
Type
Description
Log Object
Field
Type
Description
Use Cases
Error Handling
Error Code
Message
Description
Was this helpful?