Skip to content

Erigon2 prototype

ledgerwatch edited this page Jan 16, 2022 · 12 revisions

How to run

After checking in the code from the desired branch, run the following commands:

make state
./build/bin/state erigon2 --datadir <your_datadir>

The directory referenced by the --datadir option needs to contain block headers, block bodies, and recovered senders downloaded and computed by a recent version of Erigon. All stages are not required, only first four: Headers, BlockHashes, Bodies, Senders.

The prototype starts replaying blocks and their transactions starting from genesis, and then block 1, block 2, and so on. Every 1000 blocks it prints the progress, like so:

INFO[01-16|20:12:15.536] Processed                                blocks=133000
INFO[01-16|20:12:15.848] Processed                                blocks=134000
INFO[01-16|20:12:16.162] Processed                                blocks=135000
INFO[01-16|20:12:16.914] Processed                                blocks=136000
INFO[01-16|20:12:17.233] Processed                                blocks=137000
INFO[01-16|20:12:17.561] Processed                                blocks=138000

It is possible to interrupt the prototype by pressing Ctrl-C on the console, or sending SIGTERM (-15) signal to a process on Unix. When this interruption happens, informations similar to the following is printed:

INFO[01-16|20:28:21.169] Processed                                blocks=956000
^CINFO[01-16|20:28:21.926] Got interrupt, shutting down...
INFO[01-16|20:28:21.926] Got interrupt, shutting down...
INFO[01-16|20:28:21.926] interrupted, please wait for cleanup, next time start with --block 956723

This information helps resume the prototype from the point it was interrupted, instead of starting from the beginning, like so (in our example):

./build/bin/state erigon2 --datadir <your_datadir> --block 956723

The replaying will resume from where it was interrupted, like so:

./build/bin/state erigon2 --datadir ~/mainnet --block 956723
INFO[01-16|20:28:59.088] Processed                                blocks=957000
INFO[01-16|20:28:59.833] Processed                                blocks=958000
INFO[01-16|20:29:05.028] Processed                                blocks=959000
INFO[01-16|20:29:05.729] Processed                                blocks=960000

Which files it creates and where

The prototypes creates and modifies files in two directories:

<your_datadir>\aggregator
<your_datadir>\statedb