Skip to main content
POST
trace_filter
curl --request POST \
  --url https://rpc.testnet.tempo.xyz/ \
  --header 'Content-Type: application/json' \
  --data '
{
  "jsonrpc": "2.0",
  "method": "trace_filter",
  "params": [
    {
      "fromBlock": "0x564000",
      "toBlock": "0x565000",
      "toAddress": [
        "0x20c0000000000000000000000000000000000000"
      ],
      "count": 10
    }
  ],
  "id": 1
}
'
{
  "jsonrpc": "<string>",
  "id": 123,
  "result": [
    {}
  ]
}
Tempo API method that returns execution traces matching specific filter criteria. This is useful for finding all interactions with a specific contract or address across multiple blocks.

Parameters

  • filterObject — the filter object:
    • fromBlock — (optional) starting block number (hex)
    • toBlock — (optional) ending block number (hex)
    • fromAddress — (optional) array of sender addresses to filter
    • toAddress — (optional) array of recipient addresses to filter
    • after — (optional) offset for pagination
    • count — (optional) maximum number of traces to return

Response

  • result — array of trace objects matching the filter:
    • action — the action object:
      • from — sender address
      • to — recipient address
      • callType — type of call
      • gas — gas provided
      • input — call data
      • value — value transferred
    • blockHash — hash of the block
    • blockNumber — block number
    • result — the result object
    • subtraces — number of child traces
    • traceAddress — position in the trace tree
    • transactionHash — hash of the transaction
    • transactionPosition — index in the block
    • type — trace type

trace_filter code examples

The following example finds all calls to the pathUSD token contract:
const ethers = require('ethers');
const NODE_URL = "CHAINSTACK_NODE_URL";
const provider = new ethers.JsonRpcProvider(NODE_URL);

// pathUSD token address
const PATHUSD = "0x20c0000000000000000000000000000000000000";

const traceFilter = async () => {
    const currentBlock = await provider.getBlockNumber();
    const fromBlock = "0x" + (currentBlock - 1000).toString(16);
    const toBlock = "0x" + currentBlock.toString(16);

    const traces = await provider.send("trace_filter", [{
      fromBlock: fromBlock,
      toBlock: toBlock,
      toAddress: [PATHUSD],
      count: 20
    }]);

    console.log(`Found ${traces.length} traces to pathUSD`);

    for (const trace of traces) {
      console.log(`Block ${trace.blockNumber}: ${trace.action.from} -> ${trace.action.to}`);
      console.log(`  Call type: ${trace.action.callType}`);
      console.log(`  Tx: ${trace.transactionHash}`);
    }
  };

traceFilter();

Body

application/json
jsonrpc
string
default:2.0
method
string
default:trace_filter
params
any[]

Filter object with block range and address filters

id
integer
default:1

Response

200 - application/json

Array of matching traces

jsonrpc
string
id
integer
result
object[]

Array of trace objects matching the filter