Skip to content

Call tracking mode

vukasin gostovic edited this page Aug 4, 2023 · 2 revisions

The call tracking mode is used to note the changes of the output of eth_call over time. eth_call is a JSON-RPC method that allows you to simulate a transaction and see its output. As an example, we can use the call tracking mode to query historical chainlink oracle prices over time:

Example

sothis --mode call_track --source_rpc http://localhost:8545 --contract_address 0x1c479675ad559DC151F6Ec7ed3FbF8ceE79582B6 --origin_block 17799350 --calldata 0x06f13056 --decimal

Sothis will iterate from block 17799350 to the current head, calling the ETH/USD price feed with the calldata for getLatestData()(0x06f13056).

The resulting output will look like this:

{
   "address":"0x1c479675ad559DC151F6Ec7ed3FbF8ceE79582B6",
   "calldata":"116469846",
   "state_changes":[
      {
         "block_number":"17799350",
         "value":"295577"
      },
      {
         "block_number":"17799357",
         "value":"295578"
      },
      {
         "block_number":"17799365",
         "value":"295579"
      },
...

Usage

  • --mode call_track: Used to denote we are using the tracking mode.
  • --source_rpc: RPC of the node we are getting data from.
  • --contract_address: Address of the contract we are reading storage from.
  • --calldata: Calldata we're calling the contract with.
  • --origin_block: The block from which we start tracking.

To stop tracking prematurely, either send a SIGTERM or a SIGINT(ctrl-c) to the process.

Optional parameters

  • --terminal_block: Final block sothis will track. If not specified, sothis will track until terminated.
  • --decimal: Output block numbers and values as decimals. Note: If the values are too large for u64, you might get overflows or other undefined behaviour.
  • --filename: Name of our output file. The default filename is formatted as: address-{}-slot-{}-timestamp-{}.json.
  • --path: Path to our output file. The default path is the current directory.

FAQ and troubleshooting

Please see the dedicated FAQ section on the sidebar.