Links

Run Read-Only Node

Last updated 16 Oct 2023

What are we going to do?

Launch cloud instance

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.

Node specifications

We recommend the following or better: m6i.2xlarge General Purpose Instance with 4 vCPUs (3.5 GHz), 32GB of memory, up to 10 Gbps network bandwidth, and at least 2.5 TB of gp2 SSD. Bare metal with equivalent or higher specs are even better. Lower spec like AWS m5.xlarge can work, but no longer recommended. - We would recommend going with Ubuntu Server 22.04 LTS (64-bit).

Storage

2.5 TB is sufficient if you're running using a pruned datadir. 13 TB is needed if you'd like to run with a full size (non-pruned) datadir. 1 TB is sufficient if you're running using a no-history genesis in snapsync mode (and then wait till it get synced to the latest block). Available snapshots for download: link.

Network settings

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.

Set up non-root user

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}

Install required tools

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

Validate your Go installation

Run your read node:
You can run your read node using go-opera 1.1.3-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.3-rc.5
(read)$ make
Validate your Opera installation:
$./build/opera help
VERSION:
1.1.3-rc.5
Download a genesis file from this list of genesis files.
db.preset
When using version 1.1.3 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.

Running with pruned genesis file

# 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).

Running with no-history genesis file

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.

Syncing progress

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).
For trouble shooting your node, please check this.
© 2024 Fantom Foundation