Run Read-Only Node
Last updated 24 May 2023
You can either run a node on your own hardware or use a cloud provider. We would recommend choosing one of the big cloud providers, e.g. Amazon AWS.
We recommend the following or better:
- AWS m5.xlarge with 4 vCPUs (3.1 GHz), 16GB of memory, up to 10 Gbps network bandwidth.
AWS m6i.2xlarge, c6i.4xlarge can provide better performance. Bare metal with equivalent or higher specs are even better.
- We would recommend going with Ubuntu Server 22.04 LTS (64-bit).
1 TB is sufficient if you're running using a no-history genesis in snapsync mode (and then get it synced to the latest block).
2 TB is sufficient if you're running using a pruned datadir.
11 TB is needed if you'd like to run with a full size (non-pruned) datadir.
Available snapshots for download: link.
Open up port 22 for SSH, as well as port 5050 for both TCP and UDP traffic. A custom port can be used with "--port <port>" flag when run your opera node.
If there is already a non-root user available, you can skip this step.
# SSH into your machine
(local)$ ssh root@{IP_ADDRESS}
# Update the system
$ sudo apt-get update && sudo apt-get upgrade -y
# Create a non-root user
$ USER={USERNAME}
$ sudo mkdir -p /home/$USER/.ssh
$ sudo touch /home/$USER/.ssh/authorized_keys
$ sudo useradd -d /home/$USER $USER
$ sudo usermod -aG sudo $USER
$ sudo chown -R $USER:$USER /home/$USER/
$ sudo chmod 700 /home/$USER/.ssh
$ sudo chmod 644 /home/$USER/.ssh/authorized_keys
Make sure to paste your public SSH key into the authorized_keys file of the newly created user in order to be able to log in via SSH.
# Enable sudo without password for the user
$ sudo vi /etc/sudoers
Add the following line to the end of the file:
{USERNAME} ALL=NOPASSWD: ALL
Now close the root SSH connection to the machine and log in as your newly created user:
# Close the root SSH connection
$ exit
# Log in as new user
(local)$ ssh {USERNAME}@{IP_ADDRESS}
You are still logged in as the new user via SSH. Now we are going to install Go and Opera.
First, install the required build tools:
# Install build-essential
$ sudo apt-get install -y build-essential
Install Go
# Install go
$ wget https://go.dev/dl/go1.19.3.linux-amd64.tar.gz
$ sudo tar -xvf go1.19.3.linux-amd64.tar.gz
$ sudo mv go /usr/local
Export the required Go paths:
# Export go paths
$ vi ~/.bash_aliases
# Append the following lines
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
Run your read node:
You can run your read node using go-opera 1.1.2-rc.5 (either
snap
or full
sync mode). Note that https and ws must not be enabled on a server that stores wallet account.# Install Opera
(read)$ git clone https://github.com/Fantom-foundation/go-opera.git
(read)$ cd go-opera/
(read)$ git checkout release/1.1.2-rc.5
(read)$ make
Validate your Opera installation:
$./build/opera help
VERSION:
1.1.2-rc.5
db.preset
When using version 1.1.2 you need to add db.preset argument for starting opera command. You can see options for this parameters with
opera help
command. For standard conditions, please use this option:- db.preset=ldb-1
You can use different db presets, either
--db.preset ldb-1
OR --db.preset legacy-db
OR --db.preset pbl-1
. Note that, ldb-1 is recommended.# Start opera node
$ cd build/
$ wget https://download.fantom.network/mainnet-109331-pruned-mpt.g
$ nohup ./opera --genesis mainnet-109331-pruned-mpt.g --nousb \
--db.preset ldb-1 &
You can start a node with a syncmode flag. There are two possible options:
- "--syncmode snap", and
- "--syncmode full" (by default).
You may use no-history genesis file and sync with "--syncmode snap".
# Start opera node
$ cd build/
$ wget https://download.fantom.network/mainnet-109331-no-history.g
$ nohup ./opera --genesis mainnet-109331-no-history.g \
--syncmode snap --nousb \
--db.preset ldb-1 &
Snapsync will sync much faster, compared to other genesis files. Though it may take 8 hours to a couple of days (depending on your machine configs). Once it's fully synced, it will automatically switch to the full syncmode.
For archive node, you should use "full" syncmode.
For validator node, you should use "full" syncmode, or use "snap" syncmode but wait til it is switched to fullsync mode.
Once it's run, you should wait till it's synced up to the latest block before proceeding to the next step.
You may query the latest block number of your node:
./opera attach --exec ftm.blockNumber
Then you can compare with the latest block shown on the explorer (ftmscan.com or explorer.fantom.network).
Last modified 22d ago