Lite-nodes are a simplified node option that allow developers to perform lightweight tasks on a local node. This page covers how to spin-up a lite node on your local machine.
In this guide, we’re going to use the Lotus Filecoin implementation. We’ll show how to install a lite-node on MacOS and Ubuntu. For other Linux distributions, check out the Lotus documentation. To run a lite-node on Windows, install WLS with Ubuntu on your system and follow the Ubuntu instructions below.
Prerequisites
Lite-nodes have relatively lightweight hardware requirements – it’s possible to run a lite-node on a Raspberry Pi 4. Your machine should meet the following hardware requirements:
At least 2 GiB of RAM
A dual-core CPU.
To build the lite-node, you’ll need some specific software. Run the following command to install the software prerequisites:
Switch to the branch representing the network you want to use. Mainnet always uses the releases branch:
gitcheckoutreleases
Or you can checkout to the Calibration testnet release using the ntwk/calibration branch:
gitcheckoutntwk/calibration
If your processor was released later than an AMD Zen or Intel Ice Lake CPU, enable the use of SHA extensions by adding these two environment variables. If in doubt, ignore this command and move on to the next section.
The last thing we need to do to get our node setup is to build the package. The command you need to run depends on which network you want to connect to:
Remove or delete any existing Lotus configuration files on your system:
mv~/.lotus~/.lotus-backup
Make the Lotus binaries and install them:
makecleanallsudomakeinstall
Once the installation finishes, query the Lotus version to ensure everything is installed successfully and for the correct network:
lotus--version
This will output something like:
lotus version 1.19.1-dev+mainnet+git.94b621dd5
Remove or delete any existing Lotus configuration files on your system:
mv~/.lotus~/.lotus-backup
Make the Lotus binaries and install them:
makeclean&&makecalibrationnetsudomakeinstall
Once the installation finishes, query the Lotus version to ensure everything is installed successfully and for the correct network:
lotus--version
This will output something like:
lotus version 1.19.1-dev+calibrationnet+git.94b621dd5.dirty
Start the node
Let's start the lite-node by connecting to a remote full-node. We can use the public full-nodes from glif.io:
Create an environment variable called FULLNODE_API_INFO and set it to the WebSockets address of the node you want to connect to. At the same time, start the Lotus daemon with the --lite tag:
2023-01-26T11:18:54.251-0400 INFO main lotus/daemon.go:219 lotus repo: /Users/johnny/.lotus
2023-01-26T11:18:54.254-0400 WARN cliutil util/apiinfo.go:94 API Token not set and requested, capabilities might be limited.
...
The Lotus daemon will continue to run in this terminal window. All subsequent commands we use should be done in a separate terminal window.
Create an environment variable called FULLNODE_API_INFO and set it to the WebSockets address of the node you want to connect to. At the same time, start the Lotus daemon with the --lite tag:
2023-01-26T11:18:54.251-0400 INFO main lotus/daemon.go:219 lotus repo: /Users/johnny/.lotus
2023-01-26T11:18:54.254-0400 WARN cliutil util/apiinfo.go:94 API Token not set and requested, capabilities might be limited.
...
The Lotus daemon will continue to run in this terminal window. All subsequent commands we use should be done in a separate terminal window.
Expose the API
To send JSON-RPC requests to our lite-node we need to expose the API.
Open ~/.lotus/config.toml and uncomment ListenAddress on line 6:
2023-01-26T11:18:54.251-0400 INFO main lotus/daemon.go:219 lotus repo: /Users/johnny/.lotus
2023-01-26T11:18:54.254-0400 WARN cliutil util/apiinfo.go:94 API Token not set and requested, capabilities might be limited
...
The Lotus daemon will continue to run in this terminal window. All subsequent commands we use should be done in a separate terminal window.
Open ~/.lotus/config.toml and uncomment ListenAddress on line 6:
2023-01-26T11:18:54.251-0400 INFO main lotus/daemon.go:219 lotus repo: /Users/johnny/.lotus
2023-01-26T11:18:54.254-0400 WARN cliutil util/apiinfo.go:94 API Token not set and requested, capabilities might be limited.
...
The Lotus daemon will continue to run in this terminal window. All subsequent commands we use should be done in a separate terminal window.
The lite-node is now set up to accept local JSON-RPC requests! However, we don't have an authorization key, so we won't have access to privileged JSON-RPC methods.
Create a key
To access privileged JSON-RPC methods, like creating a new wallet, we need to supply an authentication key with our Curl requests.
Create a new admin token and set the result to a new LOTUS_ADMIN_KEY environment variable:
You should now have a local lite-node connected to a remote full-node with an admin API key! You can use this setup to continue playing around with the JSON-RPC, or start building your applications on Filecoin!