Setting up Lotus and Powergate Localnet mode on Linux

Sharing my experience installing and syncing Lotus on testnet and Powergate’s Localnet mode.

Lotus

Minimal requirements and instructions are listed here: Lotus: install and setup | Filecoin Docs.

My setup:

  • Lenovo Thinkpad T480, purchased a few years ago
  • Ubuntu Mate 18.04
  • 1.70GHz (3.60 GHz turbo) i5-8350U Processor with 4 cores, 8 threads (recommended minimum is 8 cores)
  • 16 GiB RAM (recommended minimum is 32GiB)
  • Samsung 860 EVO hardrive in an external SSD enclosure

I decided to give syncing testnet (nerpa) a try to see if I would hit a wall without the recommended RAM.

I followed the Linux setup instructions with the Ubuntu/Debian option where called for. Install and build all went smoothly, and I checked out the ntwk-nerpa branch to sync with the Nerpa testnet.

I set LOTUS_PATH in my .bashrc to /media/thuselem/evo-1/nerpa where evo-1 is the name of the partition on the external SSD and nerpa is a directory in it. (See the Environment variables section in the Lotus docs.)

Despite not meeting the recommended requirements, everything was fine! At most, syncing consumed around 5GiB of RAM when performing block validations. I have synced about 9GiB of testnet so far. Starting and stopping picks up where it left off without any issues.

Powergate Localnet mode

The Powergate repository provides a local development environment called Localnet mode. From their README:

Having a fully synced Lotus node can take a considerable amount of time and effort to mantain. We have built lotus-devnet which runs a local network with a sectorbuilder mock. This provides a fast way to spinup a local network where the sealing process if mocked, but the rest of the node logic is the same as production The localnet supports both 2Kib and 512Kib sectors, and the speed of block production is configurable.

A simple docker-compose setup is available that will run Powergate connected to a Lotus local network with 512Mib sectors and allows to use the gRPC API or CLI without any extra config flags! Note: you will first need to install Docker compose in order to get started.

I started off with installing Docker Compose, which was basically downloading a binary and setting permissions to make it executable.

I cloned the Powergate repo and following their instructions:

cd docker
make localnet

Everything downloaded and built seamlessly. Per their docs, you want to see “the height of the chain increase in a regular cadence” which I observed in messages like

lotus_1      | 2021-02-18T22:24:27.341Z	INFO	chain	chain/sync.go:718	block validation	{"took": 0.007508651, "height": "67", "age": 359998012.3418192}

where the “height” increases monotonically.

Running Localnet mode barely consumes any memory, around 0.2GiB, and did not use much of my CPU capacity. Lotus seemed to use more, though I am making some rough comparisons from watching CPU bar charts dancing over time.

After syncing for a while longer, Lotus caught up to “now” and the total amount of space used turned out to be ~10.5GiB.

So our 2TB drives should be fine for a while :wink: