Skip to content

Commit 9660f6e

Browse files
authored
Merge pull request #2312 from lanzafame/update-lite-node-tutorial
Update lite node tutorial
2 parents ab47c16 + 9daabb5 commit 9660f6e

File tree

1 file changed

+72
-54
lines changed

1 file changed

+72
-54
lines changed

nodes/lite-nodes/spin-up-a-lite-node.md

Lines changed: 72 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
---
22
description: >-
3-
Lite-nodes are a simplified node option that allow developers to perform
4-
lightweight tasks on a local node. This page covers how to spin-up a lite node
5-
on your local machine.
3+
Lite-nodes are a simplified node option that allows developers to perform lightweight tasks on a local node. This page covers how to spin up a lite node on your local machine.
64
---
75

86
# Spin up a lite-node
97

10-
In this guide, we’re going to use the [Lotus](../implementations/lotus.md) Filecoin implementation. We’ll show how to install a lite-node on MacOS and Ubuntu. For other Linux distributions, check out the [Lotus documentation](https://lotus.filecoin.io/lotus/install/linux/#building-from-source). To run a lite-node on Windows, install [WLS with Ubuntu](https://ubuntu.com/tutorials/install-ubuntu-on-wsl2-on-windows-10#1-overview) on your system and follow the _Ubuntu_ instructions below.
8+
In this guide, we will use the [Lotus](../implementations/lotus.md) Filecoin implementation to install a lite-node on MacOS and Ubuntu. For other Linux distributions, check out the [Lotus documentation](https://lotus.filecoin.io/lotus/install/linux/#building-from-source). To run a lite-node on Windows, install [WLS with Ubuntu](https://ubuntu.com/tutorials/install-ubuntu-on-wsl2-on-windows-10#1-overview) on your system and follow the _Ubuntu_ instructions below.
119

1210
## Prerequisites
1311

14-
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:
12+
Lite-nodes have relatively lightweight hardware requirements. Your machine should meet the following hardware requirements:
1513

1614
1. At least 2 GiB of RAM
1715
2. A dual-core CPU.
16+
3. At least 4 GiB of storage space.
1817

1918
To build the lite-node, you’ll need some specific software. Run the following command to install the software prerequisites:
2019

@@ -23,30 +22,30 @@ To build the lite-node, you’ll need some specific software. Run the following
2322
1. Ensure you have [XCode](https://developer.apple.com/xcode/) and [Homebrew](https://brew.sh/) installed.
2423
2. Install the following dependencies:
2524

26-
```sh
27-
brew install go bzr jq pkg-config hwloc coreutils rust
25+
```shell
26+
brew install go jq pkg-config hwloc coreutils rust
2827
```
2928

3029
{% endtab %}
3130
{% tab title="Ubuntu" %}
3231
1. Install the following dependencies:
3332

34-
```sh
33+
```shell
3534
sudo apt update -y
36-
sudo apt install mesa-opencl-icd ocl-icd-opencl-dev gcc git bzr jq pkg-config curl clang build-essential hwloc libhwloc-dev wget -y
35+
sudo apt install mesa-opencl-icd ocl-icd-opencl-dev gcc git jq pkg-config curl clang build-essential hwloc libhwloc-dev wget -y
3736
```
3837

3938
2. [Install Go](https://go.dev/doc/install) and add `/usr/local/go/bin` to your `$PATH` variable:
4039

41-
```sh
42-
wget https://go.dev/dl/go1.21.1.linux-amd64.tar.gz
43-
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.21.1.linux-amd64.tar.gz
40+
```shell
41+
wget https://go.dev/dl/go1.21.7.linux-amd64.tar.gz
42+
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.21.7.linux-amd64.tar.gz
4443
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc && source ~/.bashrc
4544
```
4645

47-
3. [Install Rust](https://www.rust-lang.org/tools/install) and source the `~/.cargo/env` config file:
46+
3. [Install Rust](https://www.rust-lang.org/tools/install), choose the standard installation option, and source the `~/.cargo/env` config file:
4847

49-
```sh
48+
```shell
5049
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
5150
source "$HOME/.cargo/env"
5251
```
@@ -56,52 +55,64 @@ To build the lite-node, you’ll need some specific software. Run the following
5655

5756
## Pre-build
5857

59-
Before we can build the Lotus binaries, there’s some setup we need to do. MacOS users should select their CPU architecture from the tabs:
58+
Before we can build the Lotus binaries, we need to follow a few pre-build steps. MacOS users should select their CPU architecture from the tabs:
6059

6160
{% tabs %}
6261
{% tab title="MacOS Intel" %}
63-
1. Clone the repository, and move into the `lotus` directory:
62+
1. Clone the repository and move into the `lotus` directory:
6463

65-
```sh
64+
```shell
6665
git clone https://github.com/filecoin-project/lotus.git
6766
cd lotus/
6867
```
6968

70-
2. Switch to the branch representing the network you want to use. Mainnet always uses the `releases` branch:
69+
2. Retrieve the latest Lotus release version:
70+
71+
```shell
72+
git tag -l 'v*' | grep -v '-' | sort -V -r | head -n 1
73+
```
74+
75+
This should output something like:
7176

72-
```sh
73-
git checkout releases
77+
```output
78+
v1.29.0
7479
```
7580

76-
Or you can checkout to the Calibration testnet release using the `ntwk/calibration` branch:
81+
3. Using the value returned from the previous command, checkout to the latest release branch:
7782

78-
```sh
79-
git checkout ntwk/calibration
83+
```shell
84+
git checkout v1.29.0
8085
```
8186

82-
3. Done! You can move on to the [Build](https://docs.filecoin.io/nodes/lite-nodes/spin-up-a-lite-node/#build-the-binary) section.
87+
4. Done! You can move on to the [Build](https://docs.filecoin.io/nodes/lite-nodes/spin-up-a-lite-node/#build-the-binary) section.
8388
{% endtab %}
8489
{% tab title="MacOS ARM" %}
85-
1. Clone the repository, and move into the `lotus` directory:
90+
1. Clone the repository and move into the `lotus` directory:
8691

87-
```sh
92+
```shell
8893
git clone https://github.com/filecoin-project/lotus.git
8994
cd lotus
9095
```
9196

92-
2. Switch to the branch representing the network you want to use. Mainnet always uses the `releases` branch:
97+
2. Retrieve the latest Lotus release version:
9398

94-
```sh
95-
git checkout releases
99+
```shell
100+
git tag -l 'v*' | grep -v '-' | sort -V -r | head -n 1
101+
```
102+
103+
This should output something like:
104+
105+
```output
106+
v1.29.0
96107
```
97108

98-
Or you can checkout to the Calibration testnet release using the `ntwk/calibration` branch:
109+
3. Using the value returned from the previous command, checkout to the latest release branch:
99110

100-
```sh
101-
git checkout ntwk/calibration
111+
```shell
112+
git checkout v1.29.0
102113
```
103114

104-
3. Create the necessary environment variables to allow Lotus to run on M1 architecture:
115+
4. Create the necessary environment variables to allow Lotus to run on M1 architecture:
105116

106117
```bash
107118
export LIBRARY_PATH=/opt/homebrew/lib
@@ -112,28 +123,34 @@ Before we can build the Lotus binaries, there’s some setup we need to do. MacO
112123
4. Done! You can move on to the [Build](https://docs.filecoin.io/nodes/lite-nodes/spin-up-a-lite-node/#build-the-binary) section.
113124
{% endtab %}
114125
{% tab title="Ubuntu" %}
115-
1. Clone the repository, and move into the `lotus` directory:
126+
1. Clone the repository and move into the `lotus` directory:
116127

117-
```sh
128+
```shell
118129
git clone https://github.com/filecoin-project/lotus.git
119130
cd lotus
120131
```
121132

122-
2. Switch to the branch representing the network you want to use. Mainnet always uses the `releases` branch:
133+
2. Retrieve the latest Lotus release version:
123134

124-
```sh
125-
git checkout releases
135+
```shell
136+
git tag -l 'v*' | grep -v '-' | sort -V -r | head -n 1
137+
```
138+
139+
This should output something like:
140+
141+
```output
142+
v1.29.0
126143
```
127144

128-
Or you can checkout to the Calibration testnet release using the `ntwk/calibration` branch:
145+
3. Using the value returned from the previous command, checkout to the latest release branch:
129146

130-
```sh
131-
git checkout ntwk/calibration
147+
```shell
148+
git checkout v1.29.0
132149
```
133150

134-
3. 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](https://docs.filecoin.io/nodes/lite-nodes/spin-up-a-lite-node/#build-the-binary).
151+
4. If your processor was released later than an AMD Zen or Intel Ice Lake CPU, enable SHA extensions by adding these two environment variables. If in doubt, ignore this command and move on to [the next section](https://docs.filecoin.io/nodes/lite-nodes/spin-up-a-lite-node/#build-the-binary).
135152

136-
```sh
153+
```shell
137154
export RUSTFLAGS="-C target-cpu=native -g"
138155
export FFI_BUILD_FROM_SOURCE=1
139156
```
@@ -170,7 +187,7 @@ The last thing we need to do to get our node setup is to build the package. The
170187
This will output something like:
171188

172189
```plaintext
173-
lotus version 1.19.1-dev+mainnet+git.94b621dd5
190+
lotus version 1.29.0+mainnet+git.1ff3b360b
174191
```
175192
{% endtab %}
176193
{% tab title="Calibration" %}
@@ -196,7 +213,7 @@ The last thing we need to do to get our node setup is to build the package. The
196213
This will output something like:
197214

198215
```plaintext
199-
lotus version 1.19.1-dev+calibrationnet+git.94b621dd5.dirty
216+
lotus version 1.29.0+calibnet+git.1ff3b360b
200217
```
201218

202219
{% endtab %}
@@ -211,7 +228,7 @@ Let's start the lite-node by connecting to a remote full-node. We can use the pu
211228
1. 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:
212229
213230
```shell
214-
FULLNODE_API_INFO=wss://wss.mainnet.node.glif.io/apigw/lotus lotus daemon --lite
231+
FULLNODE_API_INFO=wss://wss.node.glif.io/apigw/lotus lotus daemon --lite
215232
```
216233
217234
This will output something like:
@@ -245,7 +262,7 @@ Let's start the lite-node by connecting to a remote full-node. We can use the pu
245262
246263
## Expose the API
247264
248-
To send JSON-RPC requests to our lite-node we need to expose the API.
265+
To send JSON-RPC requests to our lite-node, we need to expose the API.
249266
250267
{% tabs %}
251268
{% tab title="Mainnet" %}
@@ -269,7 +286,7 @@ To send JSON-RPC requests to our lite-node we need to expose the API.
269286
3. In the same window, restart the lite-node:
270287
271288
```shell
272-
FULLNODE_API_INFO=wss://wss.mainnet.node.glif.io/apigw/lotus lotus daemon --lite
289+
FULLNODE_API_INFO=wss://wss.node.glif.io/apigw/lotus lotus daemon --lite
273290
```
274291
275292
This will output something like:
@@ -301,7 +318,7 @@ To send JSON-RPC requests to our lite-node we need to expose the API.
301318
```
302319
303320
2. Open the terminal window where your lite-node is running and press `CTRL` + `c` to close the daemon.
304-
3. In the same window restart the lite-node:
321+
3. In the same window, restart the lite-node:
305322
306323
```shell
307324
FULLNODE_API_INFO=wss://wss.calibration.node.glif.io/apigw/lotus lotus daemon --lite
@@ -382,30 +399,31 @@ Let's run a couple of commands to see if the JSON-RPC API is set up correctly.
382399
383400
```plaintext
384401
{
402+
"id": 1,
385403
"jsonrpc": "2.0",
386-
"result": "t1vuc4eu2wgsdnce2ngygyzuxky3aqijqe7gj5qqa",
387-
"id": 1
404+
"result": "f1vuc4eu2wgsdnce2ngygyzuxky3aqijqe7gj5qqa"
388405
}
389406
```
390407
391408
The result field is the public key for our address. The private key is stored within our lite-node.
392409
393-
3. Set the new address as the default wallet for our lite-node:
410+
3. Set the new address as the default wallet for our lite-node. Remember to replace the Bearer token with our auth key `eyJhbGc...` and the `"params"` value with the wallet address, `f1vuc4...`, returned from the previous command:
394411
395412
```shell
396413
curl -X POST '127.0.0.1:1234/rpc/v0' \
397414
-H 'Content-Type: application/json' \
398415
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBbGxvdyI6WyJyZWFkIiwid3JpdGUiLCJzaWduIiwiYWRtaW4iXX0.um-LqY7g-SDOsMheDRbQ9JIaFzus_Pan0J88VQ6ZLVE' \
399-
--data '{"jsonrpc":"2.0","id":1,"method":"Filecoin.WalletSetDefault","params":["t1vuc4eu2wgsdnce2ngygyzuxky3aqijqe7gj5qqa"]}' \
416+
--data '{"jsonrpc":"2.0","id":1,"method":"Filecoin.WalletSetDefault","params":["f1vuc4eu2wgsdnce2ngygyzuxky3aqijqe7gj5qqa"]}' \
400417
| jq
401418
```
402419
403420
This will output something like:
404421
405422
```plaintext
406423
{
424+
"id": 1,
407425
"jsonrpc": "2.0",
408-
"id": 1
426+
"result": null
409427
}
410428
```
411429
{% endcode %}

0 commit comments

Comments
 (0)