Masternode SetupThis guide will help you to setup a masternode on an Ubuntu 16.04 64bit Server.
Basic Requirements5.000 ONEX
A main wallet (We’ll use the Windows Wallet v.1.1.2)
Masternode Server (Ubuntu 16.04 that will be online 24/7)
(OPTIONAL) WinSCP (
https://winscp.net/eng/download.php)
(Please keep in mind that for security reasons you’re gonna need a single IP for each masternode you’re planning to run)
Getting the Ubuntu Server ready
UpdatingOnce you’ve logged in for the first time on your new Ubuntu Server you should always update your package lists from the repositories.
Installing needed librariesThe Onex-Daemon needs some basic libraries in order to run.
Let’s get them:
sudo apt-get install git automake build-essential libtool autotools-dev autoconf pkg-config libssl-dev libboost-all-dev software-properties-common
sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt-get update
sudo apt-get install libdb4.8-dev libdb4.8++-dev libminiupnpc-dev
Compiling the DaemonNow it’s time to decide. Do you want to compile the daemon on your own, or do you want to download a precompiled daemon which will save some time?
We are going to talk about both.
OPTION ONE - Compiling on your own
Getting the newest versiongit clone https://github.com/onexcash/onex-core.git
OR updating an existing onex
Compiling the sourcecd onex-core
./autogen.sh
./configure
make
Once your ONEX source is compiled without an error you can skip the following step “(OPTIONAL) Getting precompiled daemon”.
OPTION TWO - Precompiled files
If you don’t want to compile the source by yourself, this is where you’ll go.
mkdir onex
cd onex
wget https://onex.cash/wallets/linux/onexd && chmod +x onexd
wget https://onex.cash/wallets/linux/onex-cli && chmod +x onex-cli
Running the Daemon the first timeRunning the Daemon the first time will help us to create the basic folder structure and to check for errors.
IMPORTANT: The path is different for the ones who compiled on there own and the ones who downloaded the precompiled files!
/root/onex-core/src/onexd
(For the ones who compiled on their own server)
(For the ones who downloaded the precompiled daemon)
Editing the configsOnce you’ve run the Daemon for the first time - it will show you to setup a rpcuser and rpcpassword and close right after it - it has also created the folder structure where the blockchain and all config files are going to be.
We want to edit those files now slightly but we’ll come back later for the finishing touch.
The easiest way is to use WinSCP to edit your conf-files. If you are somehow don’t want to use WinSCP follow these steps:
Nano is a great console-based text-editor.
nano /root/.onexcore/onex.conf
Let’s open the onex.conf located in the .onexcore folder. This folder was created by the daemon on the first run!
What goes inside the config?
Your configuration files gets read by the ONEX-Daemon on startup.
There are a lot of things you can tweak, add or remove.
This is just a basic configuration for a simple masternode setup:
rpcuser={CHOOSE A RANDOM USER}
rpcpassword={CHOOSE A RANDOM PASSWORD}
rpcallowip=127.0.0.1
listen=1
server=1
daemon=1
logtimestamps=1
maxconnections=256
masternode=1
externalip={YOUR SERVER IP}
bind={YOUR SERVER IP}
Save the config and let’s get over to the main-wallet.
Main wallet setupIn order to get the masternodes to run, we need to send 5.000 ONEX to an address we are just going to create.
We use a system called “Cold-Wallet”. This system is meant for better security because actually your masternode won’t have any access to your wallet.
Masternode Priv-Key
As you might’ve saw we need a “masternodeprivkey” - this key indicates a private key that is used by your wallet and the masternode.
In your Wallet-App go to: Tools -> Debugconsole.
This will generate a private key - We need to add that key to the “masternodeprivkey”-field in the onex.conf on the Ubuntu server.
Generate a wallet-address
Each masternode needs it’s own address. We are going to send 5.000 ONEX to this address later.
You can change mn1 to whatever you want to name your masternode.
Save the address you’ve just generated for the next step.
Sending 5.000 ONEX to the address
Let’s send 5.000 ONEX to that address. Yes - make sure this is only 5.000 ONEX. No less, no more.)
Wait for the transaction to have at least 15 confirmations before continuing.
I won’t get further into sending ONEX.
Getting the transaction
For our local masternode-config we need to get the transaction id and following number.
Back into the main-wallets debugconsole enter:
It will display a list of valid masternode transactions. If this is your first masternode there will be only one for sure.
The list contains a longer number (transaction ID) and a following number.
Save both of these somewhere for the next step.
Local configs
We are almost there. Just a few lines to edit and we are able to start our masternode. onex.conf
Open your local onex.conf (Find it or use the “Edit config file” in the onex-qt client under “Tools”).
Make it look similiar to this:
rpcuser={CHOOSE A RANDOM USER}
rpcpassword={CHOOSE A RANDOM PASSWORD}
rpcallowip=127.0.0.1
masternode.conf
Open your local masternode.conf (You can find it or open it like you’ve opened the onex.conf via the Wallet-App)
{YOURMASTERNODENAME} {YOURIP}:18291 {YOURMASTERNODEPRIVKEY} {TRANSACTIONID} {TRANSACTION_FOLLOW_ID}
which should result in something like that:
mn1 1.2.3.4:18291 3Xgpvye4AEMviBBvybpbUJorN4NCs8Hqdznovo3Q2nWQxX2BkMY 897dd18650799053b912ec0d0ab685c5527cff24666c66f944fb20624e05fe5f 1
Starting everything upAfter editing all the files locally we need to get back to our Ubuntu Server and enter the “masternodeprivkey” and for sure start the daemon.
As I’ve told you in the step where we’ve created the privkey, we need to add that to the onex.conf on our server. Get back to that step if you are not sure how to open the config.
Starting the daemon on the Ubuntu server
After adding the “masternodeprivkey” in we want to start the daemon.
OR
/root/onex-core/src/onexd -daemon
(If you’ve compiled on your own)
The daemon should start minimzed. You’ll only see a message like this:
ONEX server starting
Remote-Start the masternode
Once you’ve restarted your Wallet-App get back into the debugconsole and enter:
masternode start-alias {YOURMASTERNODENAME}
Congratulations. You’ve successfully setup a masternode on your own.