Trace Module
The trace_filter (opens new window)RPC implementation follows OpenEthereum's trace module guidelines (opens new window). The RPC method requires any of the following optional parameters:
fromBlock(uint blockNumber) — either block number (
hex
), earliest which is the genesis block orlatest
(default) best block available. Trace starting blocktoBlock(uint blockNumber) — either block number (
hex
), earliest which is the genesis block orlatest
best block available. Trace ending blockfromAddress(array addresses) — filter transactions done from these addresses only. If an empty array is provided, no filtering is done with this field
toAddress(array addresses) — filter transactions done from these addresses only. If an empty array is provided, no filtering is done with this field
after(uint offset) — default offset is 0. Trace offset (or starting) number
count(uint numberOfTraces) — number of traces to display in a batch
There are a couple default values that you should be aware of:
The maximum number of trace entries a single request of trace_filter is allowed to return is 500. A request exceeding this limit will return an error Blocks processed by requests are temporarily stored on cache for 300 seconds, after which they are deleted
To change the default values you can add Additional Flags when spinning up your tracing node.
Using the Tracing Module
For the trace_filter
call, you can make the following JSON RPC request in your terminal (in this case, the filter is from block 20000 to 25000, only for transactions where the recipient is 0x4E0078423a39EfBC1F8B5104540aC2650a756577, it will start with a zero offset and provide the first 20 traces):
curl http://127.0.0.1:9933 -H "Content-Type:application/json;charset=utf-8" -d \
'{
"jsonrpc":"2.0",
"id":1,
"method":"trace_filter", "params":[{"fromBlock":"0x4E20","toBlock":"0x5014","toAddress":["0x4E0078423a39EfBC1F8B5104540aC2650a756577"],"after":0,"count":20}]
}'
The node responds with the trace information corresponding to the filter (response was cropped as it is quite long).
Last updated