Using Node Binary
As per instructions on the cloud guides, the host needs to open up port 9000 for blockchain consensus messages and port 6000 for blockchain state syncing. Other ports are NOT necessary for syncing and should NOT be opened to the internet if you are staking only.
  • 9000 port is used for blockchain consensus messages (base port)
  • 6000 port is used for blockchain state syncing (base port - 3000)
  • 9500 port is used for SDK RPC service (base port + 500)
  • 9800 port is used for Websocket service (base port + 800)
The 9500, 9800 ports are only listened by localhost by default.

1. Download Node Binary

Before we proceed to next steps we need to download the node binary first:
x86_64 (Mainnet)
x86_64 (Testnet)
arm64 (Mainnet)
curl -LO && mv binary harmony && chmod +x harmony
curl -LO && mv binary_testnet harmony && chmod +x harmony
curl -LO && mv binary-arm64 harmony && chmod +x harmony
Check the node binary version that was downloaded:
./harmony -V
The below explain the different method the node binary can be used. Option 1 is what being used when setting up systemd (at step 2).
If you choose another method make sure to use the correct command line
All the start options can be persisted and loaded from a single config file. To start a node, the following steps are also available**:**
  1. 1.
    Dump the default config.
  2. 2.
    Customize the config file.
  3. 3.
    Run harmony node with the config file.

Dump the Default Config File

./harmony config dump harmony.conf
./harmony config dump --network testnet harmony.conf
A file harmony.conf is created and the default node options are set in the file in TOML formatting. Here is an example:
Version = "2.1.0"
KMSConfigFile = ""
KMSConfigSrcType = "shared"
KMSEnabled = false
KeyDir = "./.hmy/blskeys"
KeyFiles = []
MaxKeys = 10
PassEnabled = true
PassFile = ""
PassSrcType = "auto"
SavePassphrase = false
Client = true
LegacySyncing = false
Port = 6000
Server = true
ServerPort = 6000
Zone = ""
DataDir = "./"
IsArchival = false
IsBeaconArchival = false
IsOffline = false
NoStaking = false
NodeType = "validator"
ShardID = -1
Enabled = true
IP = ""
Port = 9500
RosettaEnabled = false
RosettaPort = 9700
FileName = "harmony.log"
Folder = "./latest"
RotateSize = 100
Verbosity = 3
Config = false
BootNodes = ["/dnsaddr/"]
NetworkType = "mainnet"
IP = ""
KeyFile = "./.hmykey"
Port = 9000
Enabled = false
ListenAddr = ""
DebugEnabled = false
RateLimterEnabled = true
RequestsPerSecond = 1000
Concurrency = 6
DiscBatch = 8
DiscHardLowCap = 6
DiscHighCap = 128
DiscSoftLowCap = 8
Downloader = false
Enabled = false
InitStreams = 8
MinPeers = 6
BlacklistFile = "./.hmy/blacklist.txt"
Enabled = true
IP = ""
Port = 9800
The content of the config file can be modified for custom node start up command.
For example, to open the public HTTP RPCs, change the field IP under [HTTP] tag to "":
Enabled = true
IP = ""
Port = 9500
RosettaEnabled = false
RosettaPort = 9700
To run harmony internal nodes under legacy mode instead of staking mode, change the field NoStaking under [General] tag to true:
DataDir = "./"
IsArchival = false
IsBeaconArchival = false
IsOffline = false
NoStaking = true
NodeType = "validator"
ShardID = -1
To enable streamsync, modify the below two sections (Experimental)
Client = false
LegacySyncing = false
Port = 6000
Server = true
ServerPort = 6000
Zone = ""
Concurrency = 4
DiscBatch = 8
DiscHardLowCap = 4
DiscHighCap = 1024
DiscSoftLowCap = 4
Downloader = true
InitStreams = 4
MinPeers = 4
Stream Sync is the new harmony Syncing method allowing to get rid of the previous sync via DNS causing issue when the DNS node wasn't in sync.

Start the node with Config File

Harmony node binary is able to start with options provided by the config file:
./harmony -c harmony.conf
The values stored in the config file will be read and parsed to harmony as node start options.

Option 2: Setup Using Flag Parsing

You can run your node binary using flag parsing:
./harmony --network testnet
A full list of active flags as well as examples can be accessed through running the binary with --help option:
./harmony --help
Examples usage:
# start a validator node with default bls folder (default bls key files in ./.hmy/blskeys)
# start a validator node with customized bls key folder
./harmony --bls.dir [bls_folder]
# start a validator node with open RPC endpoints and customized ports
./harmony --http.ip= --http.port=[http_port] --ws.ip= --ws.port=[ws_port]
# start an explorer node
./harmony --run=explorer --run.archive --run.shard=[shard_id]
# start a harmony internal node on testnet
./harmony --run.legacy --network
harmony [flags]
harmony [command]
Available Commands:
dumpconfig dump the config file for harmony binary configurations
help Help about any command
version print version of the harmony binary
--bls.dir string directory for BLS keys (default "./.hmy/blskeys")
--bls.keys strings a list of BLS key files (separated by ,)
--bls.kms enable BLS key decryption with AWS KMS service (default true)
--bls.kms.config string json config file for KMS service (region and credentials)
--bls.kms.src string the AWS config source (region and credentials) for KMS service (shared, prompt, file) (default "shared")
--bls.pass enable BLS key decryption with passphrase (default true)
--bls.pass.file string the pass file used for BLS decryption. If specified, this pass file will be used for all BLS keys after input the BLS passphrase from console, whether to persist the input passphrases in .pass file
--bls.pass.src string source for BLS passphrase (auto, file, prompt) (default "auto")
--bootnodes strings a list of bootnode multiaddress (delimited by ,)
-c, --config string load node config from the config toml file.
--datadir string directory of chain database (default "./")
--dns.port int port of customized dns node (default 9000) string use customized peers from the zone for state syncing
-h, --help help for harmony
--http enable HTTP / RPC requests (default true)
--http.ip string ip address to listen for RPC calls. Use for public endpoint (default "")
--http.port int rpc port to listen for HTTP requests (default 9500)
--log.dir string directory path to put rotation logs (default "./latest")
--log.max-size int rotation log size in megabytes (default 100) string log file name (e.g. harmony.log) (default "harmony.log")
-v, --log.verb int logging verbosity: 0=silent, 1=error, 2=warn, 3=info, 4=debug, 5=detail (default 3)
-n, --network string network to join (mainnet, testnet, pangaea, localnet, partner, stressnet, devnet) (default "mainnet")
--p2p.keyfile string the p2p key file of the harmony node (default "./.hmykey")
--p2p.port int port to listen for p2p protocols (default 9000)
--pprof enable pprof profiling
--pprof.addr string listen address for pprof (default "")
--run string run node type (validator, explorer) (default "validator")
--run.archive run node in archive mode
--run.legacy whether to run node in legacy mode
--run.shard int run node on the given shard ID (-1 automatically configured by BLS keys) (default -1)
--txpool.blacklist string file of blacklisted wallet addresses (default "./.hmy/blacklist.txt")
-V, --version display version info
--ws enable websocket endpoint (default true)
--ws.ip string ip endpoint for websocket. Use for public endpoint (default "")
--ws.port int port for websocket endpoint (default 9800)
Use "harmony [command] --help" for more information about a command.

Option 3: Setup Using Flag Parsing and a Config file combined

If both config file and flag is provided, the node option stored in config file will be override by the values given in flag.
For example, In config file harmony.conf, HTTP server is enabled, and is open to public:
Enabled = true
IP = ""
Port = 9500
RosettaEnabled = false
RosettaPort = 9700
And a flag is also provided during the node start command to disable the HTTP server:
./harmony -c harmony.conf --http=false
In this case, the command line flags will override the settings in the config file and thus the HTTP server is disabled.
> curl localhost:9500
curl: (7) Failed to connect to localhost port 9500: Connection refused
The above steps would have you started the node, please CTRL+C, so you can continue with step 2.

Non-Validating/Explorer Nodes

A Non-validating Node is a node that runs in archival mode and does not join the consensus.
Check here for Explorer Node requirements.
Check here for instructions on how to sync your node in archival mode.
Keep in mind that the storage space used increases around ~50+ GB per month on s0 due to staking transaction being stored. Other shard should take around 25GB per month. Please plan your storage space accordingly.
The following steps assume the node is connected to mainnet on shard 0, which is required for all exchanges.
If you are using the config file, which is the recommended way to configure your node, change the settings to the ones below:
DataDir = "./"
IsArchival = true
IsBeaconArchival = false
IsOffline = false
NoStaking = true
NodeType = "explorer"
ShardID = 0
NoStaking = true will verify if the BLS keys in your .hmy/blskeys folder are part of the original FN keys. You will need add in the folder dummy empty files and remove all others
# remove all keys, save it before if necessary
rm -f .hmy/blskeys/*
# create dummy files
touch .hmy/blskeys/bls.key
touch .hmy/blskeys/bls.pass
IsBeaconArchival flag is applicable to explorer node only. For shard 1/2/3 the beacon shard 0 doesn't need to be in archival mode. So to save space, the recommendation is to set to false. For shard 0 explorer node, IsArchival flag will determine if the database is in archival mode or not.
DataDir (or --db_dir below for cli flag) is the folder where the blockchain data will be store (ie location of harmony_db_0)
Alternatively, you can also run it using flag parsing:
./harmony --run=explorer --run.archive --run.shard=0 --db_dir=./
Make sure to follow the upgrading Explorer DB schema process here afterwards. This fixes a critical issue on Explorer DB.

2. Setup Systemd

On this example, we will be installing the harmony daemon for user harmony on its home directory. Daemon will be configured with sudobut it will run with the harmonyuser at the end.
Create the harmony.service file:
sudo vi /etc/systemd/system/harmony.service
Add the content below to the file and save it. Change User to the local user you will be running the daemon and also WorkingDirectory to the home directory where you downloaded the harmony binary file previously. Parameter ExecStart needs to point to this same directory. On the example below we will be running the harmony binary using the harmony.conf file.
Description=Harmony daemon
ExecStart=/home/harmony/harmony -c harmony.conf
Give the necessary permissions to run the daemon service, enable it and start it:
sudo chmod 755 /etc/systemd/system/harmony.service
sudo systemctl enable harmony.service
sudo service harmony start
If you want to check the status of the daemon you can use:
sudo service harmony status
To restart, or stop the service daemon you can run:
sudo service harmony restart
sudo service harmony stop
To check your node follow instructions on Checking A Node.