In this extensive guide I will go through how to install and configure a Waves Platform full node and to configure the payout scripts for the payments to lessors. Also some known errors and workarounds will be discussed. Links to other documentation and guides are also included in the end of this article.
Chapter 1 – Installing and configuring a Waves Platform full node
Chapter 2 – Upgrading a Waves Platform full node to a newer version
Chapter 3 – Restoring a node from a fork or resyncing the blockchain
Chapter 1 – Installing and configuring a Waves Platform full node
Server and OS I used:
- Ubuntu 18 VPS
- 3 cores
- 4GB RAM
- 150GB SSD
All commands are issued as root. If you do not use your root account most commands would probably require ‘sudo’ to work. Eg. “sudo apt update”.
After installation of the Ubuntu OS is complete, login with the root account (or a user account and use sudo).
Commands
Step 1
Update all packages to the latest one.
Command:
apt update
Step 2
Add extra functionality and software to Ubuntu (it could already be installed on some occasions)
apt install -y software-properties-common
apt install -y build-essential
apt install -y nano
Step 3
Install Java development kit (I use openjdk but this one is recommended).
sudo add-apt-repository -y ppa:webupd8team/java
sudo apt update
sudo apt -y install oracle-java8-installer
Check if you have the latest version (openjdk 10.0.2 2018-07-17 at time of writing)
java –version
Step 4
Download the latest fullnode from Waves repository.
Link: https://github.com/wavesplatform/Waves/releases/
Command:
wget https://github.com/wavesplatform/Waves/releases/download/v0.14.4/waves_0.14.4_all.deb
Step 5
Install the downloaded .deb file:
dpkg -i waves_0.14.4_all.deb
Step 6
Create a new Waves wallet on;
https://waves.exchange You can encode your seed yourself by using a base58 encode tool or find it within the wallet.
Store credentials of your new wallet in a safe place.
Step 7
Open the Waves config file with an editor like nano or vim (usually /usr/share/waves/conf/waves.conf)
Command:
nano /usr/share/waves/conf/waves.conf
Step 8
Configure waves.conf
Remove the comment from node name by deleting the #
Example:
# Node name to send during handshake. Comment this string out to set random node name.
node-name = “waves.cryptin.eu”
Set the declared address to the external IP address of your node:
Example:
# String with IP address and port to send as external address during handshake. Could be set automatically if uPnP is enabled.
declared-address = “200.200.200.200:6868”
Set your wallet settings (set a local password and use the base58 string of your wallet.
# Wallet settings
wallet {
# Password to protect wallet file
password = “FILL_IN_LOCAL_PASSWORD_HERE”
# Wallet seed as BASE58 string
seed = “yourbase58stringofyourwallethere_thisis_a_very_long_string”
}
Set your node REST API.
Change “enable = no” to “enable = yes”
Set bind address to your IP (this could also be your internal IP if you’re not connecting from the outside)
Example:
# Node’s REST API settings
rest-api {
# Enable/disable node’s REST API
enable = yes
# Network address to bind to
bind-address = “200.200.200.200”
# Port to listen to REST API requests
port = 6869
# Hash of API key string
api-key-hash = “API KEY HASH HERE”
}
Set features you wish to support by voting for it (if there’s a vote ongoing).
features {
supported = [4, 5, 6, 8]
}
Step 9
Make sure the Waves node starts automically as the server boots
systemctl enable waves.service
Start the Waves node
service waves start
Watch the Wavesnode log live (press ctrl+c to cancel)
journalctl -u waves.service -f
The Waves node is now downloading the blockchain. This process could take quite some time. Once you see the Blockheight is the same as on https://wavesexplorer.com/ you are fully synced.
Check if your node is showing up at (use ctrl+f to find your IP)
http://dev.pywaves.org/nodes/
Step 10
Set api-key-hash. The password is the password you used in # Wallet settings. You can replace ‘localhost’ with your IP if the command is not working.
You can find your API key hash by issueing the following command:
curl -X POST –header ‘Content-Type: application/json’ –header ‘Accept: application/json’ -d ‘YOURPASSWORDHERE’ ‘http://localhost:6869/utils/hash/secure’
Open waves config and set API key hash:
nano /user/share/waves/conf/waves.conf
# Hash of API key string
api-key-hash = “API KEY HASH HERE”
}
Restart Waves node:
service waves restart
DONE! Your Waves Platform full node is up and running. I you want to better security for your node I encourage reading: https://medium.com/wavesgo-educationfund/how-to-configure-your-server-for-a-secure-waves-node-58558bec02f1
Starting, restarting, stopping or get the status of the node:
- service waves start
- service waves restart
- service waves stop
- service waves status
Setting up Waves Platform full node payout scripts
Step 1
Install nodejs and npm
apt install nodejs npm
Step 2
Create a node_module directory
mkdir node_modules
Step 3
Install npm and dependencies
npm install
Check nodejs and npm versions (I currently use nodejs v8.10.0 and npm 6.2.0)
nodejs -v
npm -v
Step 4
Getting the payout scripts
Hawky’s payout scripts
https://github.com/jansenmarc/WavesLPoSDistributer
W0utje’s fork of Hawky’s payout scripts (includes automated MRT distribution and generates html file)
https://github.com/w0utje/WavesLPoSDistributer
Plukkie’s fork from w0utje’s payout script (Lazy edition, easy to use. Only Waves as fee, other tokens (except MRT) no longer in payout and html file). The nice thing of this release is that you only fill out once some values and after that all values are modified automatically!
https://github.com/plukkie/WavesLPoSDistributer
Git clone the repository or download the scripts you wish to use.
You can use wget to get the link of the zip file by clicking Clone or download -> rightclick Download ZIP -> Copy linkaddress
Then issued the command:
wget (insert link of zipfile here)
Unzip the zipfile
unzip master.zip
Step 5
Now we need to setup the scripts for your node. There’s an extensive readme. You can open it with:
less README.md (press q to close again)
If you’re lazy or do not understand the readme this is the way to go (I used W0utje fork of Hawky’s scripts);
Open appng.js with
nano appng.js
- Set address to the address of your node
- Set startBlockHeight to the height of the block before you got your first lease.
- Set endBlock to the last block you wish to use for payout
- Set distributableMrtPerBlock to the amount of MRT you wish to payout per block mined
- NOTE: Waves only pays MRT for the first 70 blocks you mine. Check the payment before overpaying!
- Set filename to the filename you wish to give your payment file
- Set paymentid to the number of the payout it is (1, 2, 3 etc.)
- Set node to the IP address of your node (internal or external depends on settings in wave.conf)
- I commented out assetFeeId: by using // because this is no longer necessary with sponsored transactions. I also removed all lines with assetFeeId further along in the file but you can also just leave it here.
- Set feeAmount: 100000,
- Use a base58 encoder to set your payment attachment (message). Copy the base58 string of the message you want here.
- Set percentageOfFeesToDistribute to the amount of Waves (percentage) your wish to distribute to lessors
Example
var config = {
address: ‘yourWavesAddressofyournode’,
startBlockHeight: 1154538,
endBlock: 1164700,
distributableMrtPerBlock: 9.6, //MRT distribution
filename: ‘payment’, //.json added automatically
paymentid: “2”,
node: ‘http://200.200.200.200:6869’,
//assetFeeId: “5BK9HPKmSkxoMdqvDzneb2UaW2NzDRjoMpMvQWfB4NcK”,
feeAmount: 100000,
paymentAttachment: “mXtED5Hg4Lv6QMzeVeWA1NyQMWQj29GtxYstSRXEaujKnxRLVTArhfz77FdkkwV8kBHY6UgJnF2K57i”, // thx 4 leasing 2 cryptin.
percentageOfFeesToDistribute: 90
};
Step 7
You can now execute the script and generate a payment file with:
nodejs appng.js
Step 8
Check if the payment is correct by editting and running checkpayout.js.
Step 9
Run the payout by editting and running massPayment.js
In the file the “apiKey” should be the password you stated in waves.conf in plain text.
Known issues
If the scripts runs at fist but quits with an error its most likely because the server runs out of RAM. You can tackle this problem with several workarounds;
Workaround 1
Issue the nodejs command with some parameters. Increase stack size and issue 4096 MB of RAM to nodejs.
nodejs –stack-size=65536 –max-old-space-size=4096 appng.js
Workaround 2
Set startblockheight higher in appng.js (if you had no prior leases)
nano appng.js
Edit variable:
var currentStartBlock = 1146000;
Workaround 3
Configure more swapspace (not recommended because this slows down performance of node)
fallocate -l 4G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
swapon -s
echo “/swapfile none swap sw 0 0” >> /etc/fstab
Workaround 4
Stop your node to free up RAM and use another node to connect to for calculating the payout.
Edit appng.js config and set:
node: ‘http://OTHER_NODE_IP_HERE:6869’,
Chapter 2 – Upgrading a Waves Platform full node to a newer version
Step 1
You can either download the blockchain binary provided by Waves or resync the blockchain. I chose to download the blockchain binary to speed up the process.
Download blockchain binary (link is the one used for the 0.14.4 release)
wget http://blockchain.wavesnodes.com/mainnet-1164473
More Waves blockchain binaries can be found here: http://blockchain.wavesnodes.com/
Step 2
Get new Waves Node executables in deb file;
wget https://github.com/wavesplatform/Waves/releases/download/v0.14.4/waves_0.14.4_all.deb
Step 3
Make a backup of your waves config to your homefolder file just to be sure:
cd /usr/share/waves/conf
cp waves.conf ~
cd ~
Step 4
Stop Waves node:
service waves stop
Step 5
Install latest version of node:
dpkg -i waves_0.14.4_all.deb
If you need to resync the entire blockchain because this is mandatory (skip this step otherwise);
Another possibility is to resync the entire blockchain from scratch.
Step 6
Remove waves data folder;
rm -rdf /var/lib/waves/data
Move blockchain binary from where you downloaded it to to /usr/share/waves:
mv mainnet-1164473 /usr/share/waves/
Import blockchain to your Waves node:
sudo -u waves importer /etc/waves/waves.conf /usr/share/waves/mainnet-1164473
Remove blockchain binary file (;
rm /usr/share/waves/mainnet-[some height]
Step 7
Start Waves node
service waves start
Check if Waves node is running and syncing the last blocks;
journalctl -u waves.service -f
Chapter 3 – Restoring a node from a fork or resyncing the blockchain
Restoring the nodes blockchain after a fork or for any other reason can be done in several ways. In this guide we will cover four different ways.
- Rolling back the node through the API
- Resyncing the entire blockchain from scratch
- Importing the blockchain by using a binary file
- Restoring the state by unzipping a tar file with the latest state
Rolling back the node through the API
Step 1
Connect with your nodes API using your browser by going to:
http://YOUR_NODES_IP_ADDRESS:6869
If you changed the API port in your nodes settings (default 6869) you should also change it in the URL.
Step 2
Fill in your API key in the topright corner.
Step 3
Go to Debug ->Rollback and fill in the blockheight you wish to roll back to using the foillowing syntax:
{ “rollbackTo”: 1057490, “returnTransactionsToUtx”: false }
This only works if you’re out of sync less than 2000 blocks!
Resyncing the entire blockchain from scratch
Step 1
Stop your Waves node by using the following command:
service waves stop
Step 2
Remove waves data folder;
rm -rdf /var/lib/waves/data
Step 3
Remove peers.dat file
rm /var/lib/waves/peers.dat
Step 4
Start Waves node
service waves start
Check if Waves node is running and syncing the blocks;
journalctl -u waves.service -f
Importing the blockchain by using a binary file
The second option is removing your datafolder and known peers and resyncing from scratch.
Step 1
Stop your Waves node by using the following command:
service waves stop
Step 2
Download blockchain binary from: http://blockchain.wavesnodes.com/
The filename is mainnet-[blockchainheight]
Command:
wget http://blockchain.wavesnodes.com/mainnet-[height]
Step 3
Remove waves data folder;
rm -rdf /var/lib/waves/data
Step 4
Remove peers.dat file
rm /var/lib/waves/peers.dat
Step 5
Move blockchain binary from where you downloaded it to to /usr/share/waves:
mv mainnet-[some height] /usr/share/waves/
Step 6
Import blockchain to your Waves node:
sudo -u waves import /etc/waves/waves.conf /usr/share/waves/mainnet-[some height]
Step 7
Remove blockchain binary file (;
rm /usr/share/waves/mainnet-[some height]
Step 8
Start Waves node
service waves start
Check if Waves node is running and syncing the last blocks;
journalctl -u waves.service -f
Restoring the state by unzipping a tar file with the latest state
Step 1
Download last state export tar file
wget http://blockchain.wavesnodes.com/blockchain_last.tar
Step 2
Remove waves data folder;
rm -rdf /var/lib/waves/data
Step 3
Remove peers.dat file
rm /var/lib/waves/peers.dat
Step 4
Unpack the tar file
tar -xvf blockchain_last.tar
Step 5
Move the new data folder
mv data/* /var/lib/waves/data
Step 6
Start the node
service waves start
Check if Waves node is running and syncing;
journalctl -u waves.service -f
Links and documentation
Setting up a Waves Platform full node on digital ocean by the Applicationist
https://www.youtube.com/watch?v=CDmMeZlzKbk
Official Documentation
https://docs.wavesplatform.com/waves-full-node/how-to-install-a-node/how-to-install-a-node.html
https://docs.wavesplatform.com/waves-full-node/how-to-configure-a-node.html
Setting up additional security
https://medium.com/wavesgo-educationfund/how-to-configure-your-server-for-a-secure-waves-node-58558bec02f1
Waves explorer
https://wavesexplorer.com/
PYwaves
http://dev.pywaves.org/nodes/
Hawky’s payout scripts
https://github.com/jansenmarc/WavesLPoSDistributer
W0utje’s fork of Hawky’s payout scripts (includes automated MRT distribution and generates html file)
https://github.com/w0utje/WavesLPoSDistributer
Plukkie’s fork from w0utje’s payout script (Lazy edition, easy to use. Only Waves as fee, other tokens (except MRT) no longer in payout and html file).
The nice thing of this release is that you only fill out once some values and after that all values are modified automatically!
https://github.com/plukkie/WavesLPoSDistributer