BNB Smart Chain

BNB Smart Chain

trace_filter

The other trace methods start from a single transaction or block. trace_filter works the other way around: you hand it search criteria, and it sweeps a range of BSC blocks for every trace that matches. Filter by sender or recipient address, set a from/to block window, and page through results with after and count. Query it on chain ID 56 at https://bsc.therpc.io/YOUR_API_KEY. The result is a flat array of every matching call, create, or self-destruct across all the blocks in range. BSC's ~3s blocks carry heavy BEP-20 and DeFi traffic, so that range can be enormous, which is why the call is heavy and depends on a trace-enabled archive node holding the full historical index.

Use cases

  • Find every internal BNB transfer sent to a contract across a block range, without scanning each transaction by hand.
  • Detect MEV bot activity by filtering for traces that originate from known bot addresses over a window of blocks.
  • Build an indexer that captures all calls into a specific DeFi protocol such as Venus or PancakeSwap.
  • Audit every interaction with a contract in the blocks before and after an exploit.

Parameters

#NameTypeRequiredDescription
1filterobjectYesFilter object with the following optional fields.

Response

TypeDescription
arrayFlat array of matching trace objects, each with the same shape as trace_transaction results: `{action, result, subtraces, traceAddress, transactionHash, transactionPosition, blockHash, blockNumber, type}`.

Example request

curl https://bsc.therpc.io/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "trace_filter",
"params": [{}],
"id": 1
}'

Try it live in the BNB Smart Chain playground.

Errors & troubleshooting

CodeMessageCause
-32601Method not foundtrace namespace not enabled or client does not support trace_filter.
-32602Invalid paramsFilter object contains invalid fields, or block range is too wide for the node's configured limit.
-32000query returned more than X resultsResult set exceeded the node's per-request limit; narrow the block range or use pagination.

Common pitfalls

  • Wide block ranges run slowly and providers may reject them outright, so keep the window tight and page through results.
  • A trace-enabled archive node is required, and most public endpoints either hide this method or gate it behind higher tiers.
  • Unlike eth_getLogs, traces are indexed only by address and block number, never by event topic, so you cannot filter on a log signature.

Supported networks

  • Mainnet — Chain ID: 56
  • Testnet — Chain ID: 97

See also

Parameters

Filter object with the following optional fields.

curl https://bsc.therpc.io/YOUR_API_KEY \
-X POST \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"trace_filter","params":[null]}'

Ready to call this in production?

Free tier covers personal projects. Pay-as-you-go scales without a card.