| .. | ||
| README.md | ||
| stack.yml | ||
lotus-node
Instructions for deploying a Lotus snap-synced node (for both mainnet and calibnet)
Prerequisite
Downloaded chain snapshot
-
For Mainnet
aria2c -o mainnet-snapshot.car.zst -x5 https://forest-archive.chainsafe.dev/latest/mainnet/ # or using wget wget -O mainnet-snapshot.car.zst https://forest-archive.chainsafe.dev/latest/mainnet/ -
For Calibration Testnet
aria2c -o calibnet-snapshot.car.zst -x5 https://forest-archive.chainsafe.dev/latest/calibnet/ # or using wget wget -O calibnet-snapshot.car.zst https://forest-archive.chainsafe.dev/latest/calibnet/
Clone the stack repo
$ laconic-so fetch-stack git.vdb.to/cerc-io/lotus-stack
Clone required repositories
$ laconic-so --stack ~/cerc/lotus-stack/stack-orchestrator/stacks/lotus-node setup-repositories
Build the Lotus containers
$ laconic-so --stack ~/cerc/lotus-stack/stack-orchestrator/stacks/lotus-node build-containers
Create a deployment
$ laconic-so --stack ~/cerc/lotus-stack/stack-orchestrator/stacks/lotus-node deploy init --map-ports-to-host any-same --output lotus-node.yml
$ laconic-so --stack ~/cerc/lotus-stack/stack-orchestrator/stacks/lotus-node deploy create --spec-file lotus-node.yml --deployment-dir lotus-node-deployment
Setup config
Inside deployment directory, open the config.env file and set following env variables:
-
For Mainnet
CERC_LOTUS_NETWORK=mainnet # File path of downloaded snapshot CERC_LOTUS_SNAPSHOT_PATH=/path-to-file/mainnet-snapshot.car.zst -
For Calibration
CERC_LOTUS_NETWORK=calibration # File path of downloaded snapshot CERC_LOTUS_SNAPSHOT_PATH=/path-to-file/calibnet-snapshot.car.zst
Start the container
$ laconic-so deployment --dir lotus-node-deployment up
Check status
-
Check if container is healthy
docker ps | grep lotusNOTE: Starting node for the first time takes time (~20 mins) as it imports the snapshot
-
To check whether Lotus node has synced till head
laconic-so deployment --dir lotus-node-deployment exec lotus "lotus sync wait" # lotus sync wait # Worker: 78534; Base: 2403099; Target: 2403099 (diff: 0) # State: message sync; Current Epoch: 2403099; Todo: 0 # Done!When the lotus sync wait command shows done you are fully synced with the chain
- Get latest block using CURL
curl -X POST \ -H "Content-Type: application/json" \ --data '{ "jsonrpc": "2.0", "method": "eth_getBlockByNumber", "params": ["latest", false], "id": 1 }' \ http://localhost:1234/rpc/v1
- Get latest block using CURL
Clean up
Stop all services running in the background:
$ laconic-so deployment --dir lotus-node-deployment down
To stop all services and also delete data:
# Stop the docker containers
$ laconic-so deployment --dir lotus-node-deployment down --delete-volumes
# Remove deployment directory (deployment will have to be recreated for a re-run)
$ rm -r lotus-node-deployment