eth_getLogs — BNB Smart Chain JSON-RPC
Return event logs matching a filter.
https://triport.io/rpc/bsc- Network
- BNB Smart Chain
- Scope
- bsc:rpc
- Auth
- x-token: $TRIPORT_API_KEY
- Rate limit
- bsc_read_rpc_heavy - 15 / 20 / 100 / 250 RPS sustained · short burst 30 / 40 / 200 / 500 (free / basic / pro / business) (plan policy); enterprise unlimited; Burst capacity
Endpoint and plans: BNB Smart Chain RPC endpoint.
Terms on this page: JSON-RPC.
eth_getLogs returns BNB Smart Chain event logs matching one address/topic filter and either a block range or a block hash.
Use it for bounded event indexing and contract-event lookups. Topics are positional and support a hash, null, or an array of hashes per position. blockHash must not be combined with fromBlock according to the OpenRPC schema.
Recent-block ranges are served from the BSC logs engine's receipts-derived window; deeper ranges are split and routed across the pool's archive-capable upstreams, so getLogs is no longer bottlenecked on a single public node. Per-node range ceilings in the expanded pool are higher than the earlier 25/100-block classes: the primary heavy class accepts up to 50,000 blocks and up to 50,000 logs per response, while a secondary class is chunked at 10,000 blocks. Wide ranges are split automatically. A result set that would exceed the logs ceiling is rejected (with an upstream limit error) rather than silently truncated, so page large scans by block range and keep an address filter where possible.
Parameters
JSON-RPC params is a positional array: [filter].
filterobjectrequiredaddress filter is recommended.addressstring or array<string>optionalblockHashstring (hash)optionalfromBlock.fromBlockstring (block tag or hex quantity)optionaltoBlockstring (block tag or hex quantity)optionaltopicsarrayoptionalnull, one hash, or an array of hashes.Response
The response below is the checked fixture for this method; it is reproduced without changing its fields or values.
resultarray<object>result[].addressstringresult[].datastringresult[].topicsarray<string>result[].blockHashstringresult[].blockNumberstringresult[].transactionHashstringresult[].transactionIndexstringresult[].logIndexstringresult[].removedbooleanErrors
Errors use the standard JSON-RPC error envelope. See BSC errors for network-specific classification and the linked shared reference.
| Code | Meaning | When it happens |
|---|---|---|
-32602 | Invalid params | A required positional parameter is missing or a value does not match the OpenRPC schema. |
-32000 | Upstream request failure | Interpret the message with the code: header not found means a missing block; pruned/unsupported state text means unavailable historical state. |
-32005 or upstream error | Log query limit | The result set exceeds the per-response log ceiling, or the selected node rejects the requested range or requires an address filter. Narrow the range or add an address filter. |
401 | Unauthorized | The x-token API key is missing or invalid. |
429 | Rate limited | The request exceeds the configured category RPS for the caller's tier. |
Examples
JavaScript (fetch)
const response = await fetch("https://triport.io/rpc/bsc", {
method: "POST",
headers: {
"x-token": process.env.TRIPORT_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
"jsonrpc": "2.0",
"id": 1,
"method": "eth_getLogs",
"params": [
{
"fromBlock": "latest",
"toBlock": "latest",
"address": "0x0000000000000000000000000000000000000000"
}
]
}),
});
const payload = await response.json();
console.log(payload.result);Notes
- Wide ranges are split and spread across archive-capable upstreams; the primary heavy class reaches up to 50,000 blocks and 50,000 logs per response, with a secondary class chunked at 10,000 blocks. Include
addresswhenever possible and page very large scans by block range. - Real-time log streaming is available over WebSocket at
/ws/bsc(eth_subscribelogs), where the HTTP block-range limits do not apply. - The BSC categories use configured defaults of 15 / 20 / 100 / 250 RPS; they are marked unmeasured in the tier matrix.
- Related methods:
eth_getBlockReceipts,eth_getTransactionReceipt,eth_getBlockByNumber.