Part of [Create stack for lotus mainnet and calibration](https://www.notion.so/Create-stack-for-lotus-mainnet-and-calibration-700b4903f2004a4fb440ebb6922da954) - This PR is based on stack [mainnet-lotus](https://git.vdb.to/cerc-io/stack-orchestrator/src/branch/lotus-stack/stack_orchestrator/data/stacks/mainnet-lotus) in SO branch [lotus-stack](https://git.vdb.to/cerc-io/stack-orchestrator/src/branch/lotus-stack) - Use manually downloaded snapshot for running Lotus node with `DOCKER_LOTUS_IMPORT_SNAPSHOT` env - Support running Lotus node for Calibration network - Use `cerc-io/lotus` release [v1.27.0-rc3-interal-0.0.1](https://git.vdb.to/cerc-io/lotus/releases/tag/v1.27.0-rc3-interal-0.0.1) - Add Lotus node config params with default values - `LOTUS_FEVM_ENABLEETHRPC`: true - [Enables eth_rpc](https://git.vdb.to/cerc-io/lotus/src/tag/v1.27.0-rc3-interal-0.0.1/documentation/en/default-lotus-config.toml#L248) - `LOTUS_EVENTS_ENABLEACTOREVENTSAPI`: true - [Enables the Actor events API that enables clients to consume events](https://git.vdb.to/cerc-io/lotus/src/tag/v1.27.0-rc3-interal-0.0.1/documentation/en/default-lotus-config.toml#L279) - `LOTUS_INDEX_ENABLEMSGINDEX`: true - [Enables indexing of messages on chain](https://git.vdb.to/cerc-io/lotus/src/tag/v1.27.0-rc3-interal-0.0.1/documentation/en/default-lotus-config.toml#L325) - Should be the fix for incorrect `eth_call` behaviour - `LOTUS_CHAINSTORE_ENABLESPLITSTORE`: true - [Enable the splitstore](https://git.vdb.to/cerc-io/lotus/src/tag/v1.27.0-rc3-interal-0.0.1/blockstore/splitstore#splitstore-an-actively-scalable-blockstore-for-the-filecoin-chain) - `LOTUS_FEVM_ETHTXHASHMAPPINGLIFETIMEDAYS`: 0 - [Delete mappings that have been stored for more than x day in transaction hash lookup database](https://git.vdb.to/cerc-io/lotus/src/tag/v1.27.0-rc3-interal-0.0.1/documentation/en/default-lotus-config.toml#L255) - LOTUS_FVM_CONCURRENCY: 4 - [Adjust the amount of threads used for more concurrent FMV execution](https://git.vdb.to/cerc-io/lotus/src/tag/v1.27.0-rc3-interal-0.0.1/CHANGELOG.md?display=source#L1179) - LOTUS_SKIP_APPLY_TS_MESSAGE_CALL_WITH_GAS: 0 - [If node is a Storage Provider and is pushing many messages within a short period of time, then set to 1](https://git.vdb.to/cerc-io/lotus/src/tag/v1.27.0-rc3-interal-0.0.1/CHANGELOG.md?display=source#L1179) - Some config params that were set previously but no longer used in release [v1.27.0-rc3-interal-0.0.1](https://git.vdb.to/cerc-io/lotus/releases/tag/v1.27.0-rc3-interal-0.0.1) - `LOTUS_FEVM_EVENTS_MAXFILTERHEIGHTRANGE` - `LOTUS_FEVM_EVENTS_FILTERTTL` - `ALLOWED_DELAY` - `LOTUS_FEVM_ENABLEETHHASHTOFILECOINCIDMAPPING` Reviewed-on: #1 Reviewed-by: ashwin <ashwin@noreply.git.vdb.to> Reviewed-by: David Boreham <dboreham@noreply.git.vdb.to> Co-authored-by: Nabarun <nabarun@deepstacksoft.com> Co-committed-by: Nabarun <nabarun@deepstacksoft.com> |
||
|---|---|---|
| .. | ||
| 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 --branches git.vdb.to/cerc-io/lotus@v1.27.0-rc3-interal-0.0.1
Build the Lotus containers
$ laconic-so --stack ~/cerc/lotus-stack/stack-orchestrator/stacks/lotus-node build-containers
Create a deployment
-
Create deployment spec file
-
For Mainnet
$ laconic-so --stack ~/cerc/lotus-stack/stack-orchestrator/stacks/lotus-node deploy init --map-ports-to-host any-same --output lotus-node.yml --config CERC_LOTUS_NETWORK=mainnet,CERC_LOTUS_SNAPSHOT_PATH=/path-to-file/mainnet-snapshot.car.zst -
For Calibration
$ laconic-so --stack ~/cerc/lotus-stack/stack-orchestrator/stacks/lotus-node deploy init --map-ports-to-host any-same --output lotus-node.yml --config CERC_LOTUS_NETWORK=calibration,CERC_LOTUS_SNAPSHOT_PATH=/path-to-file/calibnet-snapshot.car.zst
NOTE: In commands above, set
CERC_LOTUS_SNAPSHOT_PATHto the absolute file path of the downloaded snapshot (Prerequisite) -
-
Create deployment directory
$ 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
Environment variables for Lotus node can be configured by setting them in config.env inside deployment directory
-
Check compose file for configured environment variables
-
Refer to default Lotus config
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