Now that we have installed Lotus we can download a lightweight chain snapshot and start syncing the chain.
Download the most recent lightweight snapshot for the mainnet:
aria2c -x5 https://snapshots.mainnet.filops.net/minimal/latest.zst
Now that we have downloaded a recent snapshot we can import the snapshot to Lotus and start the daemon process.
Import snapshot and start the Lotus daemon
lotus application runs as a daemon and a client to control and interact with that daemon. A daemon is a long-running program that is usually run in the background.
During the first run, Lotus will:
- Set up its data folder at
- Download the necessary proof parameters. This is a few gigabytes of data that is downloaded once.
If you do not want the chain data folder at the default
~/.lotus location, you can specify its location by exporting the environment variable
LOTUS_PATH=path/to/.lotus. If you want this environment variable to persist across sessions, you need to export the variable from the user’s profile script.
Import the snapshot:
# Replace the filename for the `.car` file based on the snapshot you downloaded. lotus daemon --import-snapshot path/to/1419120_2022_10_24T18_00_00Z.car.zst --halt-after-import
With this command Lotus will import the snapshot and halt after the import process has finished. After the process has halted we can start the daemon and sync the remaining blocks.
Start the Lotus daemon
nohup lotus daemon > ~/lotus.log 2>&1 &
This command makes the daemon run in the background and log messages to
~/lotus.log. You can change the path of the lotus.log file if you want the logs to be logged elsewhere.
Check syncing status
After the Lotus daemon has been running for a few minutes, use
lotus sync wait to check the sync status of your lotus node.
lotus sync wait
lotus sync wait Worker: 78534; Base: 2403099; Target: 2403099 (diff: 0) State: message sync; Current Epoch: 2403099; Todo: 0 Done!
lotus sync wait command shows done you are fully synced with the chain.
Watch the logs
watch tail -30 ~/lotus.log
Interact with the daemon
lotus command allows you to interact with a running Lotus daemon. The
lotus-worker commands work in the same way.
Lotus comes with built-in CLI documentation.
lotus - chain: Interact with filecoin blockchain - client: Make deals, store data, retrieve data - wallet: Manage wallet - net: Manage P2P Network - sync: Inspect or interact with the chain syncer ... # Show general help lotus --help # Show help for the "client" to make deals, store data, retrieve data lotus client --help
You can use the
lotus net peers to check the number of other peers that it is connected to in the Filecoin network.
lotus net peers
12D3KooWSDqWSDNZtpJae15FBGpJLeLmyabUfZmWDWEjqEGtUF8N, [/ip4/18.104.22.168/tcp/33425] 12D3KooWRTQoDUhWVZH9z5u9XmaFDvFw14YkcW7dSBFJ8CuzDHnu, [/ip4/22.214.171.124/tcp/10906]
Or check the current version of your Lotus node as well as network.
Daemon: 1.23.0+mainnet+git.d1d4b35ad+api1.5.0 Local: lotus version 1.23.0+mainnet+git.d1d4b35ad
Stop the Lotus daemon
To gracefully stop the running lotus daemon (required when restarting the daemon to update Lotus), use the following command:
lotus daemon stop ## When running with systemd do: # systemctl stop lotus-daemon