Jump to content
DenariusTalk
Sign in to follow this  
buzzkillb

DNR Masternode Setup - Mainnet - Cold Wallet

Recommended Posts

How to setup Windows QT Wallet as the Main Wallet and Ubuntu Server 16.04 LTS for the VPS. Read through the guide first. Make sure to copy and paste keys and transactionhash to notepad or paper. For the VPS, I am using Vultr. Shilling the referral link. I plan to host in multiple datacenters to spread the masternodes around.

VPS

Dedicated

Server Discussions Lowendtalk https://lowendtalk.com/categories/offers

Setup QT Wallet

1. Make sure your wallet is fully synced before proceeding further. Using the QT wallet, enter the debug console (Help > Debug window). This step will generate a masternode private key, please note this down and this will be required later. Type the following command:

masternode genkey

2. Get masternode address for your masternode. Replace masternodename with your desired masternode name.

getaccountaddress masternodename

3. Send from your wallet exactly 5,000 DNR to the address you generated from step 2. Ensure you get 20 confirmation before proceeding.

4. Get the outputs of the transaction of the 5,000 DNR send to your masternode address. The long hash is your Transaction Hash and the number after is the Transaction Index. Please note this down and this will be required later.

masternode outputs

5. Navigate to your users Roaming folder. Copy and paste %AppData% This should show you the Roaming folder and find Denarius folder.

6. In the denarius folder we will create a denarius.conf file, if it is has not been created already. Copy and paste the configuration below to your denarius.conf file.

staking=0

addnodes to the bottom of the denarius.conf above.

7. Create and save another configuration file called masternode.conf in the same location as denarius.conf.

<Alias name of your choice> <VPS IP address>:9999 <Private Key from step 1> <TransactionHash from step 4> <Transaction Index from step 4>

Example: MNDNR 31.14.125.27:9999 DF92WPpkqbr7s6Si4fdsfssjjapuFzAXwETCrpPJubnrmU6aKzh c8f4965ea57a68d0e6dd384324dfd28cfbe0c801015b973e7331db8ce018716999 1

8. Ensure you close or restart your main wallet.

How to use Putty for Windows to login to your VPS
https://www.vultr.com/docs/connecting-to-your-server-with-ssh-via-putty-on-windows

Ubuntu VPS Masternode Server Setup

Change root password
For security reasons you should change the root password with a strong and randomly generated password that you
store somewhere safe.
passwd root
Input your new password twice and continue.

Add User and Change User Permissions
To take additional security measures, we will create a new user under which we will run the masternode.
Use the following command to add a user and replace (name) with the name of your choice.

adduser <name>

Input a password for your user when prompted.
Next we need to give this user administrative permissions with the following command:

usermod -aG sudo <name>

Update Linux and Install Security Features
Use the following commands install updates for Ubuntu:

apt-get update && apt-get upgrade -y

Press “Y” and Enter when prompted to continue.
Next we will install a firewall with the following command:

apt install ufw python virtualenv git unzip pv make nano

Press “Y” and Enter when prompted to continue.

SSH Key
SSH keys are a safer way to login. If you are not interested in SSH keys, skip to the next part of the tutorial.
Use the following Vultr Doc to make an SSH key: How Do I Generate SSH Keys?
After you get your public key, login with your new user again.

su username
mkdir ~/.ssh; nano ~/.ssh/authorized_keys

Copy the public key directly from the PuTTY key generator into the terminal 

Save the file, then change the permissions of that file.

sudo chmod 700 -R ~/.ssh && chmod 600 ~/.ssh/authorized_keys

Return to the root user.

exit

SSH configuration

Now we will make the SSH daemon more secure. Let's start with the config file:

nano /etc/ssh/sshd_config
Disable root ssh login
This step will disable root login through SSH, it is entirely optional but highly recommended.
Find this line:
PermitRootLogin yes

... and change it to:

PermitRootLogin no

image.png.0e7ad04ed2dafbab13c7c455791d9c3e.png

Find the line that specifies PasswordAuthentication, uncomment it by deleting the preceding #, then change its value to "no". It should look like this after you have made the change:

sshd_config — Disable password authentication
PasswordAuthentication no
image.png.cd0506dcce476de9cddd55170a8610e1.png
This will make the server more secure against bots that try brute force and/or common passwords with user root and port 22
Restart SSH daemon

Now that we made the changes to secure the SSH Login, restart the SSH service:

service ssh restart

This will restart and reload the server settings

Firewall Settings
note: port 33339 is P2P port for Denarius

ufw allow ssh/tcp
ufw allow 9999/tcp
ufw allow 33339
ufw allow 19999
ufw logging on
ufw enable

press "Y" and Enter when prompted to continue

Create Swapfile

fallocate -l 4G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
nano /etc/fstab

Add the code below at the end of the file, then press “Ctrl + X” to close the editor, then “Y” and Enter to save the file.
*Separate the words and numbers with a TAB.

/swapfile none swap sw 0 0

Fail2Ban Install
Finally we will install an optional security feature called “Fail2Ban”. This feature bans malicious IP addresses by
scanning log files for failed login attempts.

apt-get install fail2ban

Press “Y” and Enter when prompted to continue.

If you want to dig into fail2ban some more -> https://linode.com/docs/security/using-fail2ban-for-security/#configure-fail2ban

Reboot Server
Now we will finalize the updates by rebooting the server.

reboot now

You will be disconnected and the server will reboot automatically. From this point on, you will login to your server and
run the masternode from the user you created previously.

Install Masternode Dependencies
Log into your VPS as the user you previously created.
Terminal: Replace <username> with your username
ssh <username>@xxx.xxx.xxx.xxx
PuTTY:
Follow the steps at the start of this guide to connect to the VPS. When prompted for “login as” use your user name
instead of “root”
Input the follow commands to install the required dependencies. Enter your password if prompted.

sudo apt-get install build-essential libssl-dev libboost-all-dev libminiupnpc-dev libqrencode-dev
sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt-get update
sudo apt-get -y install libdb4.8++-dev

If you get an error above run this first

sudo apt-get install software-properties-common

Install Denarius Mainnet master Branch:
Input the following commands to install the mainnet masternode branch.

git clone https://github.com/carsenk/denarius
cd denarius
git checkout master
cd src
make -f makefile.unix

It will take about 10 minutes while your server processes and installs the masternode files.
★ If your VPS gets hung up for an extended period throughout the process you may need to upgrade to a VPS
with more RAM. 2GB is recommended.
You will know that the process is complete when you see the following:
<username>@<servername>:~/denarius/src$
This means the VPS is ready for further commands and that you are currently in the “~/denarius/src” directory.
From here we will enter the command that is used to start the Denarius Server Deamon 

./denariusd

It won’t start up now because we have not configured the denarius.conf file, but we need some information the
output provides.
Copy the lines (as shown above) that start with code below and save it.
rpcuser=
rpcpassword=

We will then create a denarius.conf file and add these lines to the file. To create and edit the config file use the
command below:

nano ~/.denarius/denarius.conf

Copy in your rpcuser and rpc password at the top, Copy and paste the configuration below to your denarius.conf file. Make sure to replace the values that are unique to your node without “< >”. Ensure that rpcuser and rpcpassword are different than you had specified in the main wallet.

rpcuser=<rpc_user>
rpcpassword=<rpc_password>
rpcallowip=127.0.0.1
daemon=1
staking=0
listen=1
logtimestamps=1
maxconnections=256
port=9999
masternode=1
masternodeprivkey=<private key generated in step 1>

Addnodes to the bottom of the above denarius.conf file.

Add chaindata

cd ~/.denarius
rm -rf database txleveldb smsgDB
wget https://gitlab.com/denarius/chaindata/raw/master/chaindata.zip
unzip chaindata.zip

If it asks to overwrite type A for all.

Start your Denarius daemon.

cd ~/denarius/src
./denariusd

image.png.7224d8dd24164b6cd3a60e13202a902c.png

Wait for sync to finish.

To check if you are fully synced type

./denariusd getinfo

And wait for the current block to show up.

Start masternode remotely - QT wallet

From your main computer, go to the debug console and verify masternode.conf file is setup properly

masternode list-conf

Make sure the data output here matches the information entered in the masternode.conf file. If not, edit the file and correct the data. You will have to restart the main wallet, if you update the masternode.conf file. If the masternode configuration matches then we can finally start the masternode.

Start the masternode by executing the following (wallet needs to be unlocked):

masternode start-alias <alias name specified in masternode.conf>

If the output says “masternode is stopped” then run the following command:

masternode start

Verify on VPS masternode - VPS wallet

To ensure the masternode is running properly you can use the debug and status commands:

./denariusd masternode debug

If there are no issues, there should be a message returned with no problems found.

./denariusd masternode status

You should get a status 9 if the masternode is active and there is no issue!

How to read debug log on VPS wallet.

tail -f ~/.denarius/debug.log

You can see if your masternode is listed on the QT wallet - Masternode Icon > Denarius Network tab. If it does not appear straight away, give it 30mins and restart the wallet to check if your masternode shows up on the list

If you watch the debug.log while you run masternode start-alias masternodename from the QT wallet, you might be able to catch the screenshot below.

shut-down-cold-daemon.PNG.b082ec1191cbc4e1af06009658814f4a.PNG

Masternode Status Codes

MASTERNODE_NOT_PROCESSED: 0 
MASTERNODE_IS_CAPABLE: 1 
MASTERNODE_NOT_CAPABLE: 2 
MASTERNODE_STOPPED: 3
MASTERNODE_INPUT_TOO_NEW: 4
MASTERNODE_PORT_NOT_OPEN: 6
MASTERNODE_PORT_OPEN: 7
MASTERNODE_SYNC_IN_PROCESS: 8
MASTERNODE_REMOTELY_ENABLED: 9

Thanks to @Ragtag for clearly writing how the cold wallet works for testnet.

  • Like 3
  • Thanks 1

Share this post


Link to post
Share on other sites

Good tutorial, will try it in a couple of days.. One note though, you should always have

rpcallowip=127.0.0.1

in your denarius.conf unless you have a really good reason not to have it there. This limits which IPs can connect to your wallet to run commands on it. In my example, only localhost (the computer the wallet is running on) can send commands.

  • Like 2

Share this post


Link to post
Share on other sites
1 hour ago, KawaiiCrypto said:

Good tutorial, will try it in a couple of days.. One note though, you should always have

rpcallowip=127.0.0.1

in your denarius.conf unless you have a really good reason not to have it there. This limits which IPs can connect to your wallet to run commands on it. In my example, only localhost (the computer the wallet is running on) can send commands.

Should that be on the VPS too? Funny enough I always have that on my QT wallet, but I didn't put that on the guide. :o

  • Like 1

Share this post


Link to post
Share on other sites

How to use chaindata.zip

May have to change the full zipname below when this updates.

cd ~/.denarius
rm -rf database txleveldb smsgDB
wget https://gitlab.com/denarius/chaindata/raw/master/chaindata.zip
unzip https://gitlab.com/denarius/chaindata/raw/master/chaindata.zip

If it asks to overwrite type A for all.

image.png.e6de9c828605d89bb2f4ec5c8375f429.png

image.png.cfb15c5a4e21a55e057f1c3b65384009.png

Edited by buzzkillb
  • Like 1

Share this post


Link to post
Share on other sites

work in progress how to make TOR masternode, not hiding IP in debug.log

1. First, add the tor repository:

$ sudo nano /etc/apt/sources.list

Add a line as follows, changing the distro name to your current distro.

Better yet, review this page at the tor project site to identify your distro and appropriate sources.list.

deb http://deb.torproject.org/torproject.org xenial main
deb-src http://deb.torproject.org/torproject.org xenial main

 


2. Next add the gpg keys as follows with these commands:

$ gpg --keyserver keys.gnupg.net --recv 886DDD89

$ gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add -

 


3. Next:

$ sudo apt-get update

This keeps the tor project key updated:

$ sudo apt-get install deb.torproject.org-keyring

And finally install tor:

$ sudo apt-get install tor

 


4. Upon installing tor, it starts immediately. First stop tor so we can make some changes.

$ sudo /etc/init.d/tor stop
$ sudo nano /etc/tor/torrc

Uncomment and set the following options in that config file:

image.png.63205b86748d306c07738368c614c1d0.png

Quote

HiddenServiceDir /var/lib/tor/hidden_service/
HiddenServicePort 9999 127.0.0.1:9999

sudo service tor start
sudo cat /var/lib/tor/hidden_service/hostname

This will give your onion address to connect to in the QT wallet.

Change denarius .conf on VPS to broadcast the address from above

externalip=onionaddress.onion

Change the IP address in masternode.conf on the QT side to this onion address, restart QT, then go to debug and run

masternode start-alias <masternodename>

 

  • Like 1

Share this post


Link to post
Share on other sites

When I do  make -f makefile.unix   

 

I get this:

 

/bin/sh ../share/genbuild.sh obj/build.h

g++ -c -O2  -pthread -Wall -Wextra -Wno-ignored-qualifiers -Wno-format -Wno-unused-parameter -Wno-literal-suffix -g -DBOOST_SPIRIT_THREADSAFE -I/home/dnrmn1/denarius/src -I/home/dnrmn1/denarius/src/obj -I/home/dnrmn1/denarius/src/json -DIS_ARCH_64 -DUSE_UPNP=1 -I/home/dnrmn1/denarius/src/leveldb/include -DUSE_LEVELDB -I/home/dnrmn1/denarius/src/leveldb/helpers -DHAVE_BUILD_INFO -fno-stack-protector -fstack-protector-all -Wstack-protector -D_FORTIFY_SOURCE=2  -MMD -MF obj/db.d -o obj/db.o db.cpp

In file included from db.cpp:6:0:

db.h:14:20: fatal error: db_cxx.h: No such file or directory

compilation terminated.

makefile.unix:203: recipe for target 'obj/db.o' failed

make: *** [obj/db.o] Error 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×