Masternode setup Guide for a VPS (LINUX OS)The purpose of this guide is to setup a masternode on a VPS.
Requirements - crave
wallet running on your local computer
with at least 500 cravecoins - the software
Putty to connect and send commands through SSH
- the software
WinSCP to see your VPS's folders, it will ease the configuration
- a VPS running a linux distribution (Ubuntu (16.04 LTS) / Debian are recommended or Raspbian (Jessie Lite) for a Raspberry PI)
STEP 1 : Compiling the Crave wallet on your VPSConnecting to the VPS - Make sure SSH is enabled on your VPS.
- Start Putty and enter the VPS ip address. If your are running a VPS on your local network you need to put the local ip instead.
- Enter your username and you password.
#################################################################################################################################################You can skip the entire STEP 1 by downloading the compiled
wallet (tar.gz file), if you are using a Raspberry PI with Raspbian, download the ARM 32 bit version. In this case, open WinSCP, go into the /home/ folder and drag crave.tar.gz.
In Putty you have to run the following commands to extract then delete the archive, if the file is in the /home/ directory :
cd /home/
sudo tar xzvf CRAVE_BUILD_YOU_DLED.tar.gz
sudo rm -r CRAVE_BUILD_YOU_DLED.tar.gz
The crave folder will be created with everything in. The file "craved" is located in /home/crave/src :
You can now directly follow STEP 2.
#################################################################################################################################################If you dont want to skip then lets start :
Compiling the wallet - You need to gitclone the crave repositery :
sudo apt-get install git
git clone https://github.com/CooleRRSA/crave.git
A Crave folder will be created. To make a verification, open WinSCP and check your VPS files. You'll need to know the path of your crave folder for the next steps.
- You need to install dependencies :
sudo apt-get -y update && sudo apt-get -y install build-essential libssl-dev libdb++-dev libboost-all-dev libcrypto++-dev libqrencode-dev libminiupnpc-dev libgmp-dev libgmp3-dev autoconf autogen automake libtool
- You need to enter your Crave folder, use WinSCP to find the path. For exemple if the path is /home/crave , you need to use this command :
Now you can run this to start compiling :
cd src
sudo make -f makefile.unix
Your VPS will start compiling the wallet. It can take more than 1 hour on a Raspberry PI so be patient.
If your VPS lacks of RAM to compile, follow
this guide to add memory using a swap file
- If everything went well, you should have a new file in your crave/src folder :
If there is a file named "craved", then your wallet is ready.
STEP 2 : Starting and configuring the wallet - To start the wallet, you need to enter the src folder and simply type :
You should get "Crave server starting". When you start the wallet for the first time a new folder is created with the chain, the conf file and so in. This folder is located in the same repositery as the crave one.
For exemple if your crave folder path is /home/crave , then the new folder path is /home/.crave (sometimes its located in the /root folder). You won't see it in WinSCP so you need to make hidden folders visible by clicking on the small icon at the bottom right of WinSCP.
- Now you need to configure your wallet, first we need to close the wallet and edit the conf file :
./craved stop
cd ..
cd ..
cd .crave
sudo nano crave.conf
The nano command allow you to edit the conf.file. If you are lazy, you can simply create the crave.conf on your desktop and send it in the .crave folder through WinSCP.
The file should look something like that :
rpcuser=XXXXXXXXXXXXX
rpcpassword=XXXXXXXXXXXXXXXXXXXXXXXXXXXX
rpcallowip=127.0.0.1
#----
listen=1
server=1
daemon=1
staking=0
#--------------------
To save the file, press CTRL X, then YES, then ENTER to save.
- Now we restart the wallet and we wait it the get fully synced
cd ..
cd crave/src
./craved
It should take some time to sync so be patient again.
To check the last block synced you can run :
Now you have the choice between two methods of running the masternode. The first named A will allow you to control your MN remotely and will be cold wallet style. The second named B just shows you how the run the MN on your VPS without remote control. I recommend you to use the first method, its easier and safer. METHOD A : Sending coins and setting up the Masternode - Open your Windows wallet, go into the console and type :
Copy this string in a txt file, its your masternode priv key.
- We create a new address to receive your 500 cravecoins, type in the console :
You can call it whatever you want (mn1 or 0 or abcd...). Copy the address printed in the txt file also.
- Now
send exactly 500 cravecoins to the address you just received and wait for 10 confirmations. You have to close the wallet now, we will reopen it later. Dont forget to backup your wallet.
- You got some time to spare so we gonna edit your crave.conf. For Windows users the file is located in C:\Users\your_name\AppData\Roaming\Crave. To see this folder you need to make hidden folders visible. If you do not have the crave.conf file in your folder, create a txt file name "crave.txt" then change the extension to crave.conf. We need to edit this file, just copy :
rpcuser=SomeRandomString
rpcpassword=EvenLongerRandomString
rpcallowip=127.0.0.1
listen=1
server=1
daemon=1
staking=0
logtimestamps=1
- Now we gonna edit your VPS conf file again but before the VPS wallet must be closed and fresh (no transaction), the command is :
- Now use WinSCP to navigate through your folders. The conf file is located in the .crave folder, i told you before. You can edit directly with WinSCP. The file has to be like this :
rpcuser=SomeRandomString
rpcpassword=EvenLongerRandomString
rpcallowip=127.0.0.1
listen=1
server=1
daemon=1
staking=0
logtimestamps=1
port=9999
masternode=1
masternodeaddr=XXX.XXX.XXX.XXX:9999
masternodeprivkey=XXXXXXXXXXXXXXXXXXXXXXXXXX
This one must be exactly the same as the Windows one but we added 4 more lines.
Port : select an open port, I recommend you to use 9999
masternodeaddr : you have to put your VPS ip and the port.
masternodeprivkey : its the string you got from the "masternode genkey" command before.
Save the file. In the same folder, delete your wallet.dat (if it's an empty wallet there is no problem, else backup it then delete), the txlvldb folder and the blk00001.dat using WinSCP.
Keep WinSCP open, we gonna copy some files. Go back to your Windows crave folder where you edited the first crave.conf and drag the txlvldb folder and the blk00001.dat file to your .crave VPS folder. It will take 3-4 minutes to copy. When its done, we can start again the VPS wallet. If your VPS crave folder path is /home/crave then :
cd /home/crave/src
./craved
The server is starting. You can now close Putty and WinSCP.
- Now open you Windows wallet again, you should have your 10 confirmations now. Go into the console and type :
A string will be printed, something like that : "aa7c6c173f7b691e5a070a37aeazd23557636ad1b4b43680ace39d522e1d4493" "1" . The first part is your transaction hash, the "1" is the index.
Save them in your txt file.
- Now we gonna create the masternode.conf file. In you wallet, click on the "Masternode" tab, you will see the list of active masternodes. Click on My masternode and on Create.
A box appears :
Alias : its name of your masternode, type mn01
Address : its the IP and the port you used in your VPS conf file, use the same.
Privkey : its your masternode privkey from the "masternode genkey" command.
TxHash : its the first part of the "masternode outputs" command, in my example its aa7c6c173f7b691e5a070a37aeazd23557636ad1b4b43680ace39d522e1d4493
OutputIndex : its the last number, in my case its 1
Click Ok and wait few seconds. A new entry is created, its your masternode. It should say that your masternode is not on the list.
To start it, unlock the wallet, and press start and you are done !
METHOD B : Sending coins and setting up the Masternode - When your wallet is synced, you need to setup the masternode :
./craved masternode genkey
You'll receive a long string of letters and numbers. Copy it in a txt file, you'll need it later.
- Lets create a new receiving address :
./craved getaccountaddress 0
This address will receive your coins. Save also this one in the txt file.
Open your Windows wallet if it isnt yet and
send exactly 500 crave to this address. You'll have to pay a fee in addition.
You now need to wait for 10 confirmations before we continue.
################################################################################################################################################# - To pass time, we gonna secure your wallet :
./craved encryptwallet YOUR_WALLET_PASSWORD
Dont forget this password to unlock your wallet later. The wallet will shutdown alone after few seconds.
- Before restarting the wallet, we gonna edit the conf file again (you can do that on Windows and send the file through WinSCP if you want to)
cd ..
cd ..
cd .crave
sudo nano crave.conf
The conf file must look like that :
rpcuser=XXXXXXXXXXXXX
rpcpassword=XXXXXXXXXXXXXXXXXXXXXXXXXXXX
rpcallowip=127.0.0.1
#----
listen=1
server=1
daemon=1
staking=0
#--------------------
masternode=1
masternodeaddr=XXX.XXX.XXX.XXX:PORT
masternodeprivkey=XXXXXXXXXXXXXXXXXXXXXXXXX
Masternodeaddr is the ip and the port used by your VPS.
The port must be open.Masternodeprivekey is the string you got from the "masternodegenkey" command.
- You need to restart the wallet now :
cd ..
cd crave/src
./craved
Everytime you start your wallet, wait 1 min before sending commands to make sure it is fully loaded.
- You need to backup your wallet. I usually backup it in the home folder to avoid permission problems :
./craved backupwallet /home/
Use WinSCP to copy this wallet.dat to your local machine in case something goes wrong.
#################################################################################################################################################The wallet in now ready to run the masternode - First check if your transaction has the 10 confirmations needed with the block explorer using your receiving address to search. Then we check if your 500 cravecoins are credited into your wallet
You should get 500.00000000
- We can now start the masternode
./craved masternode start YOUR_WALLET_PASSWORD
You should get "Masternode successfully started".
You can close Putty and let it run.
Happy MasternodingHere a link to get all the commands available.
Standard Iptables command (firewall): sudo iptables -A INPUT -p tcp --dport 9999 -j ACCEPT
Allow trafic on port 9999.
In case you want to get your 500 coins back : - Unlock your wallet for few seconds :
./craved walletpassphrase YOU_WALLET_PASSWORD 120
- Setting up the default fee amount :
./craved settxfee 0.00001
- Sending your coin back :
./craved sendfrom 0 THE_RECEIVING_ADDRESS amount
If you have 502 craves on your MN, the amount must be 502-0.00001=501.99999 (reduced by fees)
I'll probably edit this guide in the future since its not perfect.
You can also check
here and
here as examples if you have troubles.
Donate : C44KanjHjCgcJimsCyLJKV9XkEpW2tGfZb