Run an invariant check


To run an invariant check on your Lotus node, you need:

Run invariant check

  1. On your currently synced and running Lotus node, run:
lotus chain list --count 1 | awk -F '[:, ]+' '{print $1, $8}' | xargs -n2 sh -c 'echo -n "Chain Height: $1, ParentStateRoot: "; lotus chain get-block $2 | jq -r ".ParentStateRoot[\"/\"]"' sh
Chain Height: 4062673, ParentStateRoot: bafy2bzacebzxikpluchiv6by7gjnexh4cg3aojyimdtgcieiqs3loah76ejkm
  1. Stop the Lotus daemon
lotus daemon stop
  1. Run the invariant check
./lotus-shed check-invariants --repo=[path-to-your-.lotus-repo] [ParentStateRoot] [ChainHeight] > /path/to/saved/file/invariants

In the above command, replace [ParentStateRoot] and [ChainHeight] with the output from step 1. Running the invariant check command will take a while (up to two hours depending on your hardware).