Masternodes

Raspberry Pi Masternode Setup

Head over to the forum for the most up to date guides.

https://forum.pivx.org/t/updated-edited-raspberry-pi-masternode-setup/

—————————————————–

This guide is intended for people that understand at least some computer/networking basics. To begin this guide you must have already imaged an sd card with raspbian and have it connected to your router via ethernet. You may use wireless as well but you will need to connect it to your wireless network first as this guide will not cover that. This also currently only deals with setting up from a Windows computer. I may add Mac later on. All commands that are to be entered will be surrounded by “ “ be sure to not include them when typing in commands. This is a work in progress, use at your own risk.

 

Funding your masternode

  1. Open up notepad
  2. Open your wallet and make sure it is fully synced
  3. Go to Tools > Debug Console
  4. Type the following
    1. “masternode genkey”
      1. This will be a long string of letters and numbers, copy it to notepad and label it MASTERNODEPRIVKEY
    2. “getaccountaddress NAME”
      1. Replace NAME with whatever you want to call this address i.e. MN01
  5. Send 10,000 PIVX to the address you just created
    1. It must be EXACTLY 10,000 PIVX so send it as Zero fee and disable any fees it has to be exactly that amount
  6. Now is a good time to make sure your wallet is encrypted and create a backup of your wallet
  7. After the transaction has been confirmed go back to the debug console and run
    1. “masternode outputs”
    2. Copy the result to your notepad and call it Masternode Output

 

Networking – To begin you must have your Raspberry Pi plugged into your router and powered on

  1. From your computer open the cmd prompt and type “ipconfig”
  2. You are looking for Gateway in the results
    1. For most people this will be 192.168.0.1 or 192.168.1.1
  3. Open up a web browser and type the IP address for your gateway
  4. Log in to your router
    1. The username and password might be on a label on your device, otherwise you can google what the default credentials are
  5. Find the menu for DHCP
    1. Typically this may be under a section called LAN
  6. You will need to find the IP address of your Raspberry Pi
    1. Make a note of this IP as it will be needed to access the device
  7. Look for an option to add a DHCP reservation and create one for the Raspberry PI using its existing IP address
  8. Find the menu for Port Forwarding
    1. https://portforward.com/ Find your router make and model on this site and it will tell you how to forward a port
  9. Add a rule for port 51472 going to the IP of your Raspberry Pi
  10. Log out of your router
  11. Go to http://www.whatsmyip.org/ to find your external IP address, save this in your notepad with everything else
    1. A note about external IP addresses, many ISPs set residential modems to a dynamic address so there is a chance the address you have now could be something different after a period of time. If it does change you will need to update the pivx.conf file that is created later on otherwise your wallet will not be able to communicate with your masternode if it changes.

Raspberry Pi configuration

  1. On your computer download Putty http://www.putty.org/ and WinSCP https://winscp.net/eng/index.php
    1. WinSCP will need to be installed but Putty will run on it’s own
  2. Open Putty and put in the IP address for your Raspberry Pi and click Connect
    1. Username: pi
    2. Password : raspberry
  3. Type “raspi-config”
  4. Choose option 4 : Wait for Network at Boot
    1. Make sure this is enabled
  5. Next choose option 3 : Boot options
    1. Set this to boot to command line only since we will not need a desktop environment
  6. Finally choose option 1 : Expand Filesystem
    1. This will reboot your pi once it’s complete
  7. After a few minutes SSH back into your Pi using the new password to connect
  8. Run “sudo passwd” to change the root user password
    1. Pick something long and complex
  9. Close putty and connect again this time with the following credentials
    1. Username: root
    2. Password: <new password you created>
  10. Now we will change the pi username to something different, replace NAME with whatever you pick
    1. “sudo usermod -l NAME -d /home/NAME -m pi”
    2. “sudo chown NAME /home/NAME”
  11. Close putty and connect again this time with your new username
  12. Run the following commands
    1. “sudo apt-get update”
    2. “sudo apt-get upgrade”
    3. “sudo apt-get dist-upgrade”
    4. “sudo apt-get install libtool autotools-dev autoconf libdb-dev libminiupnpc-dev dh-autoreconf libdb++-dev libboost-all-dev libssl-dev pkg-config joe ufw protobuf-compiler libprotobuf-dev libqt4-dev”
  13. Now we will configure the firewall to only allow ports 22 for SSH and 50472 for the masternode
    1. “sudo ufw allow ssh/tcp”
    2. “sudo ufw limit ssh/tcp”
    3. “sudo ufw allow 51472/tcp”
    4. “sudo ufw logging on”
    5. “sudo ufw enable”
    6. “sudo reboot”
  14. After a few minutes connect back with Putty and check the status of the firewall
    1. “sudo ufw status”
  15. It should say active
  16. Back on the windows side of things, download the Raspberry Pi wallet from pivx.org
    1. Extract the files from the ZIP
  17. Open WinSCP and connect to the Raspberry Pi using your login credentials
  18. Create a new folder on the Raspberry Pi called .pivx
    1. Open the .pivx folder so you can copy files into it
  19. In the left window find the files you just extracted from the ZIP
  20. Copy pivxd and pivx-cli into the .pivx folder on the Raspberry Pi folder
  21. Close WinSCP
  22. Back in Putty we will need to run a few commands
    1. “cd .pivx”
    2. “chmod 777 ./pivxd”
    3. “chmod 777 ./pivx-cli”
  23. Now in windows open up notepad and paste the following

rpcuser=XXXXXXXXXXXXX

rpcpassword=XXXXXXXXXXXXXXXXXXXXXXXXXXXX

rpcallowip=127.0.0.1

listen=1

server=1

daemon=1

maxconnections=24

masternode=1

masternodeprivkey=XXXXXXXXXXXXXXXXXXXXXXX

externalip=XXX.XXX.XXX.XXX

    1. rpcuser and rpcpassword need to be replaced with a long string of ONLY letters and numbers, make it something long and random
    2. masternodeprivkey will be the string that was generated from your wallet
    3. externalip  is your external IP address
  1. Back in Putty run the following
    1. “joe .pivx/pivx.conf”
  2. Copy and paste everything from the notepad into this new document
    1. Be sure all of the X’s have been replaced
  3. Once it is copied over press CTRL+(K and then X)
  4. Next make this read only so it can’t be changed
    1. “chmod 444 .pivx/pivx.conf”
  5. Now we will start the daemon
    1. “cd .pivx”
    2. “./pivxd”
  6. You should see a message the the server is starting
  7. Back on Windows we will now need to edit the masternode.conf file
  8. Open up %appdata%\PIVX\ to find masternode.conf and then open the file to edit it. Add the following line at the bottom
    1. LABEL IP:PORT MASTERNODEPRIVKEY TRANSACTIONHASH INDEX
      1. LABEL : can be whatever you want to label this masternode
      2. IP : the external IP address that you put into the pivx.conf file
      3. PORT : 51472
      4. MASTERNODEPRIVKEY : the same private key you put into the pivx.conf file
      5. TRANSACTIONHASH and INDEX : This was saved earlier when you ran masternode outputs in the wallet
    2. Save the file
  9. Restart your wallet if it is currently open
  10. Back in Putty we will check the status of the masternode sync
    1. You should be in the .pivx folder to run the command
    2. “./pivx-cli mnsync status”
      1. “IsBlockchainSynced” : should have a value of True, if it says False you will need to wait until the results of mnsync status say True
      2. Depending on your internet connection this may take a few hours or overnight but you will need to wait for it to finish before moving on
      3. Just rerun the command to check the sync status
  11. Once the blockchain is synced you can go to the Masternodes tab of your wallet and you should see your new masternode in there
  12. Click on your masternode and then click Start alias, this will start your masternode
  13. You can SSH back into your Raspberry Pi to check the status as well
    1. “./pivx-cli masternode debug”
    2. The result should say Masternode successfuly started
  14. You can close out of your wallet at this point, it doesn’t need to stay open for the masternode to run

NOTES – It will take anywhere from 3 – 5 days before you start to see payouts from the masternode, the more masternodes on the network the longer it will take for a payout.

Leave a Reply

© 2017 PIVX Masternode