Skip to content

Node

How to set up and configure a full Ergo node

This page explains how to install and run a full Ergo node. It does not cover mining.

Prerequisites

To run an Ergo node you need a JDK/JRE version >= 9 installed on your system. We recommend either version 9 or 11. One way to do this is to install Oracle Java SE or SDKMAN for UNIX based systems.

Running the node for the first time

Create a dedicated folder (such as ~/ergo) for running the node.

mkdir ergo
cd ergo

Download the latest Ergo client release .jar

Create a configuration file ergo.conf

touch ergo.conf

with the following text

    ergo {
      node {
        mining = false
      }
    }

Then issue the following command to run the node for the first time (from within the ergo folder):

java -jar -Xmx3G ergo-<release>.jar --mainnet -c ergo.conf
# The -Xmx flag sets the max heap size for the jvm

The node will start syncing immediately after this. Wait for a few minutes for the API to start and go to the next step.

Note: You can use any name for the file instead of ergo.conf. All configuration parameters are to be passed through this file and you only need to rewrite parameters that you want to change from the default values. The above config file actually has the default values.

Compute the hash of your secret

We need to set a secret password to protect the API. In this example we'll use hello - but you must use a different and strong secret.

Go to 127.0.0.1:9053/swagger#/utils/hashBlake2b and call the API to compute the Blake2b hash of your secret.

Compute Hash of secret

Copy the hash response which we'll place back in the ergo.conf file.

response

Update config file with API key hash

Edit the config file ergo.conf and paste the hash copied in the previous step. The file should look as follows:

    ergo {
      node {
        mining = false
      }
    }

    scorex {
     restApi {
        ## Hex-encoded Blake2b256 hash of an API key. 
        ## Should be 64-chars long Base16 string.
        ## below is the hash of the string 'hello'
        ## replace with your actual hash 
        apiKeyHash = "324dcf027dd4a30a932c441f365a25e86b173defa4b8e58948253471b81b72cf"
      }
    }

Your node should now be syncing. If you'd like to initialise a wallet place see this page

Check if the node is synced

While the node is syncing, the panel will show "Active synchronization" (see the image below).

active synchronization

After the node is fully synced, the text will change to "Node is synced", as shown below.

synced

In the case of unexpected shutdowns the database may become corrupted and you need to resync.

To do so remove the following two folders and restart the node.

rm -rf .ergo/state
rm -rf .ergo/history

Deriving Addresses

Navigate to localhost:9053/swagger#/wallet/walletDeriveKey

click Try it out

"derivationPath": "m/44'/429'/0'/0/0" 

The wallet needs to be unlocked, and you need to authorize on top right on swagger click execute and check the address you get in the response

Node security

There are a few important aspects your wallet and money's safety depends on:

  • You should never make the ergo.conf file public.
  • Sensitive API methods require a security token, which should never be sent over untrusted channels.
  • Access to the Ergo REST API must be restricted to known hosts. In particular, the API must not be accessible from the Internet.

Compiling from source

Note that instead of downloading the precompiled Ergo jar, you can clone the repository and compile the jar from the source using the sbt assembly command.