eth_getLogs — BNB Smart Chain JSON-RPC

Status: Available

Return event logs matching a filter.

POSThttps://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].

filterobjectrequired
Wide block ranges are split automatically; the primary heavy class accepts up to 50,000 blocks per request. An address filter is recommended.
addressstring or array<string>optional
Contract address or non-empty address list. Part of the BSC pool requires it.
blockHashstring (hash)optional
Match one block. Must not be combined with fromBlock.
fromBlockstring (block tag or hex quantity)optional
Inclusive start of the block range.
toBlockstring (block tag or hex quantity)optional
Inclusive end of the block range.
topicsarrayoptional
Up to four positional topic selectors; each is null, 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>
Matching log entries.
result[].addressstring
Contract address that emitted the log.
result[].datastring
Unindexed event data as hex bytes.
result[].topicsarray<string>
Indexed event topics.
result[].blockHashstring
Containing block hash when supplied.
result[].blockNumberstring
Containing block number as a hex quantity when supplied.
result[].transactionHashstring
Containing transaction hash when supplied.
result[].transactionIndexstring
Transaction index as a hex quantity when supplied.
result[].logIndexstring
Log index as a hex quantity when supplied.
result[].removedboolean
Whether the log was removed by a reorganization when supplied.

Errors

Errors use the standard JSON-RPC error envelope. See BSC errors for network-specific classification and the linked shared reference.

CodeMeaningWhen it happens
-32602Invalid paramsA required positional parameter is missing or a value does not match the OpenRPC schema.
-32000Upstream request failureInterpret the message with the code: header not found means a missing block; pruned/unsupported state text means unavailable historical state.
-32005 or upstream errorLog query limitThe 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.
401UnauthorizedThe x-token API key is missing or invalid.
429Rate limitedThe 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 address whenever possible and page very large scans by block range.
  • Real-time log streaming is available over WebSocket at /ws/bsc (eth_subscribe logs), 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.