(This is guest post written mostly by Ilya Oskin. Thanks, Ilya!)
This tutorial explains how to install and configure Ergo node.
Pre-requisites
Before jumping into configurations and commands related to setting up a node, It is important to be grounded in a few basics:
- Ergo full node security modes
- Node security aspects
Ergo node types
Full ergo node can operate in multiple security modes, in this document only modes allowing to perform mining are covered:
- Full — downloads and stores all the blocks, keeps track of all transactions performed on the network
- Full pruned — same as full mode but only
n
last blocks are downloaded and stored - Full NiPoPow bootstrapped (will be released soon) — same as full pruned but headers will be synced using NiPoPow security protocol
Node security
There are few important aspects of node usage your wallet and money safety depends on:
- Ergo node requires storing of security-critical parameters in configuration file. You should never make the file public.
- Ergo node provides interface for interacting with built-in wallet through REST API. It requires API security token by default.
Setting up environment
To run Ergo node you need the JRE version >= 8 to be installed. Mac OS X users can install the latest Oracle JRE from Homebrew through Cask.
Now simply run brew cask install Caskroom/cask/java
to install latest Java version. For Linux installation notes, visit the Oracle website.
To check JRE version run Terminal.app and execute command java -version
.
The output should looks like:
> java version "1.8.0_74"
Java(TM) SE Runtime Environment (build 1.8.0_74-b02)
Java HotSpot(TM) 64-Bit Server VM (build 25.74-b02, mixed mode)
Setting up an Ergo node
When environment is ready itʼs time to download latest Ergo node release and create configuration file.
Letʼs create new directory for that purpose:
$ mkdir ergo
$ mv ~/Downloads/ergo-assembly-1.9.0.jar ~/Desktop/ergo
$ nano ergo.conf
To fill ergo.conf we can use default configuration file as a reference.
Letʼs now take a look at few important parameters:
1)
# Number of last blocks to keep with transactions and ADproofs, for all other blocks only header will be stored.
# Keep all blocks from genesis if negative
ergo.node.blocksToKeep = -1
— default value corresponds to full node mode, in order do decrease synchronization time we can set it to some positive number (>= 8192 is recommended) of latest blocks node would download and store.
2) Next, the most important parameter is wallet seed:
# Seed the wallet private keys are derived from
ergo.wallet.seed = "C8FABEC17697FAF29E9887F716BB5004"
To generate new seed it is strongly recommended to use secure random generator like one that is used in this script. Run the script and paste the output hex-string into your config file. (Since Ergo does not yet support configs encryption it is recommended not to store it on your machine, so youʼd better deleting it when the node is running. Donʼt forget to save your seed in some secure place before deleting config).
3) The last two parameters refer to node REST API
scorex.restApi.bindAddress = "0.0.0.0:9052"
scorex.restApi.apiKeyHash = "1111"
I recommend to set scorex.restApi.bindAddress = "127.0.0.1:9052"
. If you plan to use built-in wallet API then you should generate secret/hash pair and set scorex.restApi.apiKeyHash = "<your_secret_hash>"
, you can use this script for that purpose, leave it unchanged otherwise.
Running Ergo node
To run the weʼve just configured cd
to the directory where ergo.jar
and ergo.conf
are resided and execute:
$ java -jar ergo.jar ergo.conf
To make sure node is running open 127.0.0.1:9052
in your browser:
To access wallet api routes protected with api_key
you should provide the secret youʼve configured earlier.