Run an API node

API node parameters

The hardware requirements for the API node depend on the traffic pointed to the individual node. It has to be able to stay synchronized and serve the requests at the same time. Therefore, you should scale it according to your expected load.

Minimum requirements for API node with all history (Q3 2022):

  • Cloud: AWS EC2 m5.xlarge with 4 vCPUs (3.1 GHz), 16 GB of memory and at least 8 TB of Amazon EBS General Purpose SSD (gp2) storage (or equivalent or better).

  • You will need at least 1TB of SSD storage for the full archive node.

  • We recommend at least 1 Gbps network bandwidth for a public API node.

  • Ubuntu Server 20.04 LTS (64-bit) or similar Linux/Unix based system.

What are we going to do?

  1. Setting up the Node

  2. Install Required Tools

  3. Build and run the API node

  4. Run transaction tracing API node

Setting up the node

Network Settings

Open up port 22 for SSH, as well as port 5050 for both TCP and UDP traffic for the node P2P network. Also if you plan to expose the API, then select a port that will serve the RPC API request. A custom port can be used with --port <port> flag for P2P and --http.port <port> flag for API when you run your node, more on that later in this article. Keep all other ports closed as the node doesn't need any other.

Set up Non-Root User

If there is already a non-root user with sudo rights 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 a 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 Neon.

First, install the required build tools:

# Install build-essential
$ sudo apt-get install -y build-essential

Install Go

# Install the latest Go compiler
$ wget https://go.dev/dl/go1.19.1.linux-amd64.tar.gz
$ sudo tar -xvf go1.19.1.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

# $ go version

Build and run your API node

For building neon from the source, please always check out the latest supported version.

# Install NEON Protocol
$ git clone https://github.com/neon-link/go-ethereum.git
$ cd go-ethereum/
$ make

Validate your Neon installation:

$./build/galaxy version

Version: 1.0.2

For running an API node, you need to download a genesis file and synchronize from this genesis state to present. On this page, you can download it according to your needs. For providing just the latest information with your API node, you can select the pruned ones, without historical data. In case you want to provide all historical data, then you have to select the genesis file with "Starting EVM history" filled with Full in the table.

For the first run with a genesis file, you have to provide a path to this file with the --genesis parameter. It is not needed once the genesis is processed and also it is not needed when running with the snapshot. With the parameter --datadir, you specify where your blockchain data will be stored. In the case of using a snapshot, you need to point a data-dir to the snapshot location.

# Start Neon node
$ nohup ./build/galaxy \
        --genesis=genesis.g \
        --datadir={DATA LOCATION} \
        --http.port=8080 \
        --http.api=eth,web3,net,txpool,neon &

You can check other parameters with the NEON Protocol help command. Note that HTTPS and WSS must not be enabled on a server that stores a wallet account.

Last updated