Geth Branch: https://github.com/jwasinger/go-ethereum/tree/bal-execution
-
Download a post-Cancun state snapshot (https://ethpandaops.io/data/snapshots/) and unzip the snapshot into the directory where you will have your datadir.
-
Full-sync as many blocks as you want, building the BALs for them (enable the
--experimentalbalflag) -
Use
geth exportto extract the blocks (with BALs embedded). -
Reset the datadir back to the snapshot block (or just delete it, unpack the snapshot archive back to that target location).
-
(Assuming you are on a cloud VM with a burstable disk) Set up to use a cgroup which will limit the IO throughput of geth:
# Create a new cgroup
sudo mkdir -p /sys/fs/cgroup/io_limit_group
# Set I/O limits (example: 9000 write operations per second)
echo "8:0 wiops=9000" | sudo tee /sys/fs/cgroup/io_limit_group/io.max
- Import the block range and collect metrics:
command_to_run="/path/to/go-ethereum/build/bin/geth \
--datadir /path/to/your/datadir \
--metrics \
--metrics.influxdb \
--metrics.influxdb.database=geth --metrics.influxdb.endpoint={{influxendpoint}} \
--metrics.influxdb.username=geth --metrics.influxdb.password={{influxpassword}} \
--metrics.influxdb.tags=host={{unique-host-name}} \
--experimentalbal \
import blocks_with_bals.rlp"
# Run the command with nohup, redirect output, run in background
nohup $command_to_run > import_output_bal.log 2>&1 &
# Capture the PID
pid=$!
# add pid to cgroup which will throttle the io reads to 9000 (prevent burstable disk from tainting the results)
echo $pid | sudo tee /sys/fs/cgroup/io_limit_group/cgroup.procs
Nice summary! Actually, --experimentalbal isn’t required during full sync; it only needs to be enabled when running geth export, right? The following cmd is more clear?
geth --experimentalbal --datadir ./xx export blocks_with_bals.rlp start+1 end