¶ Filecoin RPC endpoint detailsThis is a general guide on deploying an Filecoin RPC endpoint for your Chainlink Node(s). |
RPC Endpoint for Filecoin Node is
HTTPhttp://<your_ip_address>:1234
sudo apt install -y mesa-opencl-icd ocl-icd-opencl-dev gcc git bzr jq pkg-config curl clang build-essential libhwloc-dev
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Once the command complets, we can confirm installation by sourcing the env file and then checking the cargo version
source ~/.cargo/env
cargo --version
You should see the installed cargo version in the output
cargo <version> (<hash> <yyyy-mm-dd>)
Navigate to the official Go download page at go.dev/doc/install, and copy the link address for the download button.
Once you have the link, we'll use wget to download it.
Please remember that the below examples have <version> in lieu of the release that was applicable at the time of writing
wget https://go.dev/dl/go<version>.linux-amd64.tar.gz
This will download the tarball, which we will see is named go<version>.linux-amd64.tar.gz
.
To start, we'll want to extract the tarball
tar xvf go<version>.linux-amd64.tar.gz
Now that the packages has been extracted, we should have a new directory named, go
We'll adjust permissions on the directory, then relocate it to out /usr/local/ directory.
sudo chown -R root:root ./go
sudo mv go /usr/local/
And then, we'll modify our ~/.profile file and then force a reload of it.
nano ~/.profile
We'll want to add the following to the bottom of the ~/.profile file
export GOPATH=$HOME/go
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
Copy
Once those lines have been added to our profile, we need to force our TTY session to load it.
source ~/.profile
We'll know all is well when we check to see the path to the command and check to see what version of Go we have installed
which go
You should get /usr/local/go/bin/go as the path to the command
go version
We should see the newly installed verison, go version go<version> linux/amd64
Clone the Repo
git clone
https://github.com/filecoin-project/lotus.git
Navigate into the newly created directory
cd lotus
Checkout the latest release. The releases are available here. In the example below, we're going to checkout release v1.23.1-rc1
git checkout v1.23.1-rc1
Build and install to binary
make clean all
sudo make install
Once done, we can confirm installation by checking version.
lotus --version
Your output may vary based on version, but you should see something like below.
lotus version 1.23.1+mainnet+git.e8dcf9f83
With lotus installed, we'll next want to modify the configuration file to enable the RPC endpoint
We'll want to Lotus software to run automatically and as a background process.
To accomplish this, we'll run the following command to create a systemctl file.
make install-daemon-service
That should have created a file at the following path
/etc/systemd/system/lotus-daemon.service
The contents of the file should be similar to below:
[Unit]
Description=Lotus Daemon
After=network-online.target
Requires=network-online.target
[Service]
Environment=GOLOG_FILE="/var/log/lotus/daemon.log"
Environment=GOLOG_LOG_FMT="json"
ExecStart=/usr/local/bin/lotus daemon
Restart=always
RestartSec=10
MemoryAccounting=true
MemoryHigh=8G
MemoryMax=10G
LimitNOFILE=8192:10240
[Install]
WantedBy=multi-user.target
Before moving on, we need to initialize our local directories.
Simply run the following command and once it has run for a couple seconds hit Ctrl + c to stop it.
lotus daemon
This will create the necessary files at ~/.lotus/
We'll want to make some changes to the service file as well as the configuration file (located at /home/<username>/.lotus/config.toml
Please update the service file to match below, please be sure to update the username where specified.
[Unit]
Description=Lotus Daemon
After=network-online.target
Requires=network-online.target
[Service]
Type=Simple
User=$YOUR_USERNAME
#Environment=GOLOG_FILE="/var/log/lotus/daemon.log"
Environment=GOLOG_LOG_FMT="json"
ExecStart=/usr/local/bin/lotus daemon
Restart=always
RestartSec=10
MemoryAccounting=true
MemoryHigh=8G
MemoryMax=10G
LimitNOFILE=8192:10240
[Install]
WantedBy=multi-user.target
Then we'll want to make some changes to your configuration file as well
nano ~/.lotus/config.toml
[API]
# Binding address for the Lotus API
#
# type: string
# env var: LOTUS_API_LISTENADDRESS
ListenAddress = "/ip4/$YOUR_LOCAL_IP_ADDRESS/tcp/1234/http"
# type: string
# env var: LOTUS_API_REMOTELISTENADDRESS
RemoteListenAddress = "0.0.0.0"
# type: Duration
# env var: LOTUS_API_TIMEOUT
Timeout = "10s"
...truncated...
[Libp2p]
# Binding address for the libp2p host - 0 means random port.
# Format: multiaddress; see https://multiformats.io/multiaddr/
#
# type: []string
# env var: LOTUS_LIBP2P_LISTENADDRESSES
ListenAddresses = ["/ip4/0.0.0.0/tcp/9995", "/ip6/::/tcp/9995"]
# Addresses to explicitally announce to other peers. If not specified,
# all interface addresses are announced
# Format: multiaddress
#
# type: []string
# env var: LOTUS_LIBP2P_ANNOUNCEADDRESSES
AnnounceAddresses = ["/ip4/$YOUR_PUBLIC_IP_ADDRESS/tcp/9995", "/ip6/::/tcp/9995"]
With the above changes, we can now start our service.
sudo systemctl start lotus-daemon.service
We can check the logs via journalctl
sudo journalctl -f -u lotus-daemon.service