go-ethereum icon indicating copy to clipboard operation
go-ethereum copied to clipboard

Supply delta live tracer

Open ziogaschr opened this issue 11 months ago • 2 comments

This PR is based on https://github.com/ethereum/go-ethereum/pull/24723 by @karalabe / @holiman (and the successor #25662) and uses the live chain tracing with hooks implementation https://github.com/ethereum/go-ethereum/pull/29189 by @s1na.

This PR adds a live tracer which stores the supply delta of each block during import of a block. For finding the supply for the whole chain, a fresh sync has to be started.

The tracer output for a single block is:

{
  "delta": 2000000000000000000,
  "reward": 2000000000000000000,
  "withdrawals": 0,
  "burn": 0,
  "blockNumber": 100,
  "hash": "0x928773c7a68f6f6d5c83c82928add3950c7b16c0c07ee5a79b6c5e6ec2fce4ef",
  "parentHash": "0xb5b797187484efab863919d9860f0192a4bd6a8cb0c531335c32405bd2aef3c4"
}

For using this tracer the CLI flag --vmtrace supply has to be set. Additional options for the tracer can be set as --vmtrace.config '{"path": "/tmp/supply_logs/"}'.

Currently the following options are supported:

path        Path to the directory where the tracer logs will be stored
maxSize     MaxSize is the maximum size in megabytes of the tracer log file before it gets rotated. It defaults to 100 megabytes.

The output of this tracer is stored in log rotated JSONL files in the configured directory, those exported files have to be analysed with another tool.

Example tracer output:

{"delta":320000001000000000000000000,"reward":0,"withdrawals":0,"burn":0,"blockNumber":0,"hash":"0x25a5cc106eea7138acab33231d7160d69cb777ee0c2c553fcddf5138993e6dd9","parentHash":"0x0000000000000000000000000000000000000000000000000000000000000000"}
{"delta":2000000000000000000,"reward":2000000000000000000,"withdrawals":0,"burn":0,"blockNumber":1,"hash":"0x696d95da6726a67afd5be2a37d3883e9be8008491b30d5bd1069ea5922fa2a41","parentHash":"0x25a5cc106eea7138acab33231d7160d69cb777ee0c2c553fcddf5138993e6dd9"}
{"delta":2000000000000000000,"reward":2000000000000000000,"withdrawals":0,"burn":0,"blockNumber":2,"hash":"0x89b977ffab1052f5f6f778e4680354a8a1a1e0f623db9b2f20beba9f36f68721","parentHash":"0x696d95da6726a67afd5be2a37d3883e9be8008491b30d5bd1069ea5922fa2a41"}
{"delta":2000000000000000000,"reward":2000000000000000000,"withdrawals":0,"burn":0,"blockNumber":3,"hash":"0x1970908e724ac37efbb0b3bf9f77ebdf04e1ccb3f9da1463bec00252cb3a701f","parentHash":"0x89b977ffab1052f5f6f778e4680354a8a1a1e0f623db9b2f20beba9f36f68721"}

ziogaschr avatar Mar 26 '24 09:03 ziogaschr

Linking the reader here for visibility: https://github.com/ziogaschr/supply-tracer-parser

s1na avatar Apr 16 '24 12:04 s1na

This needs a rebase

holiman avatar Apr 25 '24 06:04 holiman

0x34a9c05b638020a07bb153bf624c8763bf8b4a86

Pazibad avatar Jun 07 '24 16:06 Pazibad