Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update lite node tutorial #2312

Merged
merged 10 commits into from
Sep 12, 2024
53 changes: 27 additions & 26 deletions nodes/lite-nodes/spin-up-a-lite-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ To build the lite-node, you’ll need some specific software. Run the following
2. Install the following dependencies:

```sh
brew install go bzr jq pkg-config hwloc coreutils rust
brew install go jq pkg-config hwloc coreutils rust
```

{% endtab %}
Expand All @@ -33,18 +33,18 @@ To build the lite-node, you’ll need some specific software. Run the following

```sh
sudo apt update -y
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
sudo apt install mesa-opencl-icd ocl-icd-opencl-dev gcc git jq pkg-config curl clang build-essential hwloc libhwloc-dev wget -y
```

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

```sh
wget https://go.dev/dl/go1.21.1.linux-amd64.tar.gz
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.21.1.linux-amd64.tar.gz
wget https://go.dev/dl/go1.21.7.linux-amd64.tar.gz
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.21.7.linux-amd64.tar.gz
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc && source ~/.bashrc
Copy link
Collaborator

@smagdali smagdali Sep 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For a while, when I had more time, do a global replace whenever there was a new lotus release, or a go update Should we (outside of github), set up some kind of alert to keep us doing this...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a workflow over in IPFS Docs that does this. Might be as easy as copying-and-pasting into this repo: https://github.com/ipfs/ipfs-docs/blob/main/.github/workflows/update-on-new-ipfs-tag.yml

```

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

```sh
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Expand All @@ -67,16 +67,16 @@ Before we can build the Lotus binaries, there’s some setup we need to do. MacO
cd lotus/
```

2. Switch to the branch representing the network you want to use. Mainnet always uses the `releases` branch:
2. Checkout the latest release branch. First retrieve the latest release version:

```sh
git checkout releases
git tag -l 'v*' | grep -v '-' | sort -V -r | head -n 1
```

Or you can checkout to the Calibration testnet release using the `ntwk/calibration` branch:
Using the value returned from the previous command, i.e. v1.29.0, and checkout that branch:

```sh
git checkout ntwk/calibration
git checkout v1.29.0
```

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.
Expand All @@ -89,16 +89,16 @@ Before we can build the Lotus binaries, there’s some setup we need to do. MacO
cd lotus
```

2. Switch to the branch representing the network you want to use. Mainnet always uses the `releases` branch:
2. Checkout the latest release branch. First retrieve the latest release version:

```sh
git checkout releases
git tag -l 'v*' | grep -v '-' | sort -V -r | head -n 1
```

Or you can checkout to the Calibration testnet release using the `ntwk/calibration` branch:
Using the value returned from the previous command, i.e. v1.29.0, and checkout that branch:

```sh
git checkout ntwk/calibration
git checkout v1.29.0
```

3. Create the necessary environment variables to allow Lotus to run on M1 architecture:
Expand All @@ -119,16 +119,16 @@ Before we can build the Lotus binaries, there’s some setup we need to do. MacO
cd lotus
```

2. Switch to the branch representing the network you want to use. Mainnet always uses the `releases` branch:
2. Checkout the latest release branch. First retrieve the latest release version:

```sh
git checkout releases
git tag -l 'v*' | grep -v '-' | sort -V -r | head -n 1
```

Or you can checkout to the Calibration testnet release using the `ntwk/calibration` branch:
Using the value returned from the previous command, i.e. v1.29.0, and checkout that branch:

```sh
git checkout ntwk/calibration
git checkout v1.29.0
```

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).
Expand Down Expand Up @@ -170,7 +170,7 @@ The last thing we need to do to get our node setup is to build the package. The
This will output something like:

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

```plaintext
lotus version 1.19.1-dev+calibrationnet+git.94b621dd5.dirty
lotus version 1.29.0+calibnet+git.1ff3b360b
```

{% endtab %}
Expand All @@ -211,7 +211,7 @@ Let's start the lite-node by connecting to a remote full-node. We can use the pu
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:

```shell
FULLNODE_API_INFO=wss://wss.mainnet.node.glif.io/apigw/lotus lotus daemon --lite
FULLNODE_API_INFO=wss://wss.node.glif.io/apigw/lotus lotus daemon --lite
```

This will output something like:
Expand Down Expand Up @@ -269,7 +269,7 @@ To send JSON-RPC requests to our lite-node we need to expose the API.
3. In the same window, restart the lite-node:

```shell
FULLNODE_API_INFO=wss://wss.mainnet.node.glif.io/apigw/lotus lotus daemon --lite
FULLNODE_API_INFO=wss://wss.node.glif.io/apigw/lotus lotus daemon --lite
```

This will output something like:
Expand Down Expand Up @@ -382,30 +382,31 @@ Let's run a couple of commands to see if the JSON-RPC API is set up correctly.

```plaintext
{
"id": 1,
"jsonrpc": "2.0",
"result": "t1vuc4eu2wgsdnce2ngygyzuxky3aqijqe7gj5qqa",
"id": 1
"result": "f1vuc4eu2wgsdnce2ngygyzuxky3aqijqe7gj5qqa"
}
```

The result field is the public key for our address. The private key is stored within our lite-node.

3. Set the new address as the default wallet for our lite-node:
3. Set the new address as the default wallet for our lite-node, reminder to replace the Bearer token with our auth key `eyJhbGc...` and the `"params"` value with the wallet address, `f1vuc4...`, returned from the previous command:

```shell
curl -X POST '127.0.0.1:1234/rpc/v0' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBbGxvdyI6WyJyZWFkIiwid3JpdGUiLCJzaWduIiwiYWRtaW4iXX0.um-LqY7g-SDOsMheDRbQ9JIaFzus_Pan0J88VQ6ZLVE' \
--data '{"jsonrpc":"2.0","id":1,"method":"Filecoin.WalletSetDefault","params":["t1vuc4eu2wgsdnce2ngygyzuxky3aqijqe7gj5qqa"]}' \
--data '{"jsonrpc":"2.0","id":1,"method":"Filecoin.WalletSetDefault","params":["f1vuc4eu2wgsdnce2ngygyzuxky3aqijqe7gj5qqa"]}' \
| jq
```

This will output something like:

```plaintext
{
"id": 1,
"jsonrpc": "2.0",
"id": 1
"result": null
}
```
{% endcode %}
Expand Down
Loading