Welcome to the Dash Forum!

Please sign up to discuss the most innovative cryptocurrency!

Masternode On Raspberry Pi 2 Model B

Discussion in 'Masternode Guides' started by fuzzyduck, Feb 21, 2015.

  1. fuzzyduck

    fuzzyduck Active Member

    Joined:
    Feb 19, 2015
    Messages:
    134
    Likes Received:
    113
    Trophy Points:
    93
    ****OUTDATED****
    This guide is NOT up to date with version 12.1. Besides raspberry pi builds can be downloaded from straight from the website so compiling is no longer needed.

    I do not recommend the pi as a masternode just yet. I got 30 to 60mb ram left of 1gb which is next to nothing.

    NOOBIES GUIDE GETTING A MASTERNODE TO RUN ON A RASPBERRY PI 2 MODEL B


    UPDATE #1

    Thx to user Sandell its now also confirmed its working on a Pi 1 model B(512mb ram). Not sure about stability though cuz of lack of free ram)


    UPDATE #2

    The guide is updated to DASH


    UPDATE #3

    Obsolete


    UPDATE #4

    Updated to V12. Not really much difference. I think i had to add 'sudo apt-get install libqt4-dev' to get dash-cli to build.







    [​IMG]

    WHY?
    A week, ago my Raspberry pi 2 arrived and was delighted to finally get a masternode run on it, instead of hosting it at a VPS(thx for that Flare).
    It all went well and its running as i write this. With help of various people by mail and on the forums I decided to contribute to write a howto tutorial with all the new stuff i have learned.


    NEEDED KNOWLEDGE?
    Almost no prior knowlegde. As a windows-boy i know my way around pc's except hardcore coding n stuff. Ive been playing around in Ubuntu as well in a virtual machine just to see what it means to run a linux distro. Im classify myself as a linux noob. So if i can do it, you can do it too ;)

    This guide can be written way more more compact but didnt do that on purpose for you to follow easily. I made it the most no-brainer i could.

    "Like warm raspberry pi"


    [​IMG]


    MY SOURCES?

    I grabbed different sources to make this tut. Mainly TAO's tut for some shameless copy paste (THX!), some forum posts for the basic setup of the pi2 (THX!)


    SPEED OF THE PI2?
    The compiling of the needed file for the master node takes about 1.5/2h until done. The PI2 has an ARM kernel. So just downloading the 32bit/64bit version just doesnt cut it....

    We have to compile it ourselfs on the PI2.

    There is the possibility to crosscompile on your desktop but that is beyond the scope of this tut. In this tut We will do the 1.5h waitinggame. Compiling is long but not that long.
    One you built your first, there is the possibility to leave the Masternode running while compiling the next version. That way you dont have to take it offline for long and miss your valuable DASH.


    PREREQUISITES?
    1. A raspberry Pi 2 model B, (duh!)
    2. >1000 DASH
    3. I did this on windows so its written as such
    4. Unlimited data from your ISP
    5. A stable highspeed internetconnection with a fixed IP address
    6. Know your way around your router OR learn how to
    7. SDcard class 10
    8. Cardreader
    9. Basic nerdskills
    10. An girlfriend/wife who understands what you are doing at night and why its so awsome. (I failed at this one, girlfriend yes, understanding? Nah)/


    ISP TEST (Do both tests before continuing)

    Test 1:
    go to whatismyipaddress.com and take note of your IP. Then pull the plug on your modem, wait a bit and replug. Check the page again. If the same then good!

    Test 2:
    : Take note of IP address and wait 24h and check again. If the same then good!


    DISCLAIMER
    Running a Masternode on a PI2 is hardly tested for a longer period of time. Besides, they just got out. Mine is running 24/7 at this moment with no issues, but i cannot guarantee yours will too. So i will take no responsibility for what ever happens to yours. As with the crypto-scene, its highy experimental! At your own risk.

    DONATIONS
    :rolleyes:If this tutorial has been helpful for you, dont be shy and donate some spare DASH in my pocket. Thank you! :rolleyes:

    XdptGDg2mMQ7wrcp8eUDtTkSPW71vMteBF



    HERE WE GO!

    1. Grab gear

    Take a grab in your hardware box and take out a micro SHcard class 10 and a cardreader, or buy these. These puppies are cheap so grab a large one. I got a 32gb, for lateral future use also. Even cameras take these. Be sure it fits in your cardreader, else dont forget an SD-adapter. They are usually in the package of the product.


    2. Grab Operating System

    Head to http://www.raspberrypi.org/downloads/ to download the latest RASPBIAN image. Unpack the file to whatever dir you like. Dont use older ones because they dont run on the PI2.


    3. Flash OS to sdcard

    Head to http://www.raspberrypi.org/documentation/installation/installing-images/ and follow the tutorial to get the downloaded and unpacked image (.img file) on the sdcard. I did the Windows tutorial. After you have flashed the IMG-file to the card put it in your pi2. Be gentle, its a delicate slot.


    4. Booting

    Hook up the Pi2 to your router with an ethernet cable. We do want a stable connection so no wifi (i tried it and worked flawlessly, but eventually i moved it to my router with a 1.5m cable, besides wifi needs tinkering with files on the PI2 and im not gonna bother you with it atm).

    Then hookup it up to a powersupply (i got it running on a 1,5Amps phonecharger. Just dont go hooking all sorts of USB on it because then you might need more amps. Im using mine as a decicated mastenode box.

    Your pi2 is now booting the operating system you just flashed to the SDcard.


    5. Fetching the IP

    On Windows press windowsbutton+R. type 'cmd' and press enter. You enter a DOS box. type IPCONFIG and press enter. Scroll up a bit till you see Standard Gateway. Take note of the IP. 99% of the time it starts with 192.168.1.xxx or 192.168.0.xxx


    6. Config your router

    Start your browser and enter that IP. You will now see your router's website. Enter login + password (sticker on router?)
    In the menu's somewhere there is a list of connected devices. They all have a IPaddress. Take note of the one called RASPBERRY.

    Somewhere in the menus of your router you can do a DHCP reservation for the IP address of the PI2. This means everytime the PI2 boots it gets the same IPaddress. Thats what we want. We dont want it to change. Dunno your router so cannot help on this one :( Check manual or do a search on it. You should find some other tut.)

    Now also somewhere in the menu of the router there is a NAT or PORT FORWARD menu. Enter the IPaddress of the PI2 and open port 9999. Usally by just filling all portboxes with 9999. IN / OUT etc. Maybe you just have one box to put it in.

    Save the config of the router and reboot it. (also in the menus somewhere)

    You are now re-routes internet traffic on port 9999 to your Pi2.

    Check http://www.yougetsignal.com/tools/open-ports/ and fill in port 9999 to find it open.


    7. Putty for a terminalconnection

    No head to you desktop and download putty @ www.chiark.greenend.org.uk/~sgtatham/putty/download.html. Take the top one Intel x86 is fine.

    Drag it to your desktop and start it. Enter the IPaddress of the pi at the Host Name, fill Masternode or whatever at Saved Sessions and press Save. That way you can easily load it again. Press Open.

    Now you see a black box with a prompt. Enter 'pi' as login and 'raspberry' as password. You then see a green with blue prompt.


    8a. Setup the PI2

    Now we are gonna setup the PI2 just a little bit before continuing. From now on, whenever you see a RED line then thats a command. Type it and hit enter.

    sudo raspi-config

    You are shown a simple menu. We are gonna do options 1 2 and 3. Use the arrows and tab to navigate.
    1. Expand the filesystem so it uses the whole 32gb of the SDcard
    2. Change the password of the user pi. Make a strong password like you do so your darkcoin wallet.
    3. Make it boot to command-line. So that way we safe some ram by not loading the desktop enviroment we will not be using at all.

    I forgot if it reboots automaticly or manually. If manual, then:

    sudo reboot

    Putty will give an error it has lost connection. Reopen Putty and log in again after 1min. Remember you got a new password for the user 'pi'.


    8b. Change root password and change username pi

    Next we change to root password to something strong as well. Choose a long one:

    sudo passwd

    Close putty and login with user 'root'

    Change username 'pi' to your loginname

    sudo usermod -l NEW -d /home/NEW -m pi
    sudo chown NEW /home/NEW


    Close putty and login with your new login name.
     
    #1 fuzzyduck, Feb 21, 2015
    Last edited: Feb 9, 2017
    • Like Like x 12
  2. fuzzyduck

    fuzzyduck Active Member

    Joined:
    Feb 19, 2015
    Messages:
    134
    Likes Received:
    113
    Trophy Points:
    93
    9. Download and install the needed packages

    At the prompt type the following commands in this order to fully update the pi and get it ready for compiling. Press yes to all when asked.

    sudo apt-get update
    sudo apt-get upgrade
    sudo apt-get dist-upgrade


    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


    Just copy the whole thing and rightclick mouse in the putty screen. If it fails do one by one as written down here:

    # sudo apt-get install libtool autotools-dev autoconf
    # sudo apt-get install libdb-dev
    # sudo apt-get install libminiupnpc-dev
    # sudo apt-get install dh-autoreconf
    # sudo apt-get install libdb++-dev
    # sudo apt-get install libboost-all-dev
    # sudo apt-get install libssl-dev
    # sudo apt-get install pkg-config
    # sudo apt-get install joe
    # sudo apt-get install ufw
    # sudo apt-get install protobuf-compiler libprotobuf-dev
    # sudo apt-get install libqt4-dev


    there is maybe one too much in the list but this does the job for sure (maybe somebody can tell me which one is not needed, I grabbed them from different tuts.)


    10. Config the Firewall


    We are going to configure the firewall on the PI2 you just installed to block all ports except port 22(for putty) and 9999(for masternode):

    sudo ufw allow ssh/tcp
    sudo ufw limit ssh/tcp
    sudo ufw allow 9999/tcp
    sudo ufw logging on
    sudo ufw enable


    Again reboot and again use putty to get back:

    sudo reboot

    Check your firewall's status by entering the following command:

    sudo ufw status

    It should say active.


    11. Preparing the build

    ls

    You will see a directory 'python-games' which in my eyes its clutter because the directory you are seeing now is your 'home' directory we will be using. Remove the dir:

    sudo rm -R python-games

    We are now gonna download the newest whole 1:1 DASH source from which we will compile the file needed to run the masternode, DASHD

    git clone https://github.com/darkcoin/darkcoin

    (yes, its still at this address although darkcoin is rebranded to DASH
    When done type check if directory darkcoin folder is there:

    ls


    12. Swap or crash!
    CHAPTER 12 IS NO LONGER CORRECT. COMPILING WITH 1 CORE SEEMS QUICKER THEN 3. SKIP TO CHAPTER 13

    Before we are gonna compile we want to make the most out of the 4core cpu on the pi. When compiling with more cores the 1gb RAM on the PI2 is not enough and the build crashes to prompt. We need a swapfile on the pi to use as RAM. 1core compiling works bswaut takes looooong. To create a swapfile of 2gb in the root dir of the pi:

    sudo dd if=/dev/zero of=/root/swap bs=1M count=2048

    Change the permission of the swap file so that only root can access it:

    sudo chmod 600 /root/swap

    Make this file as a swap file using mkswap command:

    sudo mkswap /root/swap

    Enable the newly created swapfile:

    sudo swapon -a

    Check if swap is enabled with:

    top

    This will show a everupdating processeslist. Look for KiB Swap at the top. It should get a high number at 'free'. Exit the command hitting CONTROL + C on keyboard.

    NOTE: Enabling swap does lots of read/write on the sdcard shortening its lifespan. So only do the command when compiling on 2 or 3 cores. Swap is not needed when compiling on 1 core i think. To turn off swap:

    swapoff -a



    13. DA BUILD! 2 hours of teethgrinding, nailbiting, checking and rechecking

    We are now gonna compile darkcoin and use just the one file called DASHD to run the masternode. Enter the directory, config the build and compile it typing subsequently:

    cd darkcoin
    ./autogen.sh
    ./configure --with-incompatible-bdb
    make


    Go outside and do something healthy and check back in 2h.

    NOTE1: This will take lots of time and gives errors about arm6 and arm7. Ignore it, let it run. Be aware that closing Putty stops the build so leave it open. ( i got a headless server running so i do it from there. You can expiriment with the command 'screen' www.tecmint.com/screen-command-examples-to-manage-linux-terminals/ but im not bothered atm. Dunno how yet).


    14. Checking stuff 'n setting up

    You are still in the darkcoin folder. Enter the src folder of darkcoin and check if DASHD is there with:

    cd src
    ls


    Now we are gonna move that file to the home dir where you start everytime with putty.

    mv dashd ../..

    Which moves it 2 dirs up to your home dir. At this stage you should have the directory darkcoin and the file dashd in the dir. Check with:

    ls

    The dashd file cant be run yet so we need to make it executable:

    chmod +x ./dashd

    To preset some settings to make it work we make a directory called .darkcoin and enter it with:

    mkdir .dash
    cd .dash


    NOTE: this is the workingdirectory of the masternode. Its there, but hidden.

    We need to make a configfile in there with an commandprompt file-editor Joe, which you installed earlier:

    joe dash.conf

    Type the following in the empty editor or paste this with just a rightmousebuttonclick in the putty screen.

    rpcuser=RANDOMSTRINGOFLETTERSANDNUMBERS
    rpcpassword=LONGERRANDOMSTRINGOFLETTERSANDNUMBERSHAVEFUN
    rpcallowip=127.0.0.1
    listen=1
    server=1
    daemon=1
    logtimestamps=1
    maxconnections=256
    masternode=0
    masternodeprivkey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    addnode=23.23.186.131


    Hit CONTROL - K then CONTROL - X to save and exit Joe.
    For added security, it is recommended to make this file "Read Only" so no one can change it:

    chmod 444 dash.conf

    NOTE1: rpcuser and rpcpassword can be anything, you DONT have to remember them later. Only use letters and numbers.

    NOTE2: Check and recheck. it usually goes wrong here with a typo.


    Leave the dir one up back to your home directory:

    cd ..


    14. Lets fire it up for the first time

    Run your darkcoind daemon for the first time:

    ./dashd

    You will see the message like "Server Starting". It will now startup and configure itself. Also it will go download the blockchain. This will take plenty of time, and only happens once. Check if files are being made with:

    cd .dash
    ls

    (check if there is more then that config file you made earlier made)
    cd ..

    Fire up another putty and at prompt check its progress with:

    top

    The CPU is 100% all the time. When its done it is just about 10%:

    When done, close the second putty and return to the first one and check stats:

    ./dashd getinfo

    Check the blockcount and check if its the same @https://chainz.cryptoid.info/dash/ See blockheight. If its the same and cpu dashd is max 10% all the time you know its done.


    15. Linking it to your local wallet on your desktop pc.

    32. We are now gonna make a private key so your masternode and local wallet can talk to eachother:

    dashd masternode genkey

    NOTE: Dont worry, this is not a key to get to your 1000dash. They are still safe in your local wallet protected with its own privatekey.

    Select the generated string with your mouse. You dont need to copy it. Dragging mouse copies it automaticly.

    Stop the the masternode and enter the hidden .darkcoin directory again and edit the configfile:

    ./dashd stop
    cd .dash
    joe dash.conf


    Delete the long XXXXXXX-string and paste the string with a right mousebutton click on the putty screen. Also change masternode=0 to masternode=1 and save n quit with CONTROL - K then CONTROL - X

    After leave the dir again to your home directory.

    cd ..

    Also copy paste the string to a notepad editor on your desktop pc. We need it later.


    16. Starting your masternode permanently!:D

    Restart the deamon and wait for it to idle (remember, you can check with another putty with command 'top' remember?, again takes a bit of time)

    ./dashd


    Useful commands to check if your masternode is running ok:

    # ./dashd getinfo
    Check version number and block count vs website

    # ./dashd masternode debug
    It should say: masternode started remotely. If anything else its NOT working ok. use this only if you end this tutorial.

    ./dashd masternode list | grep YOUREXTERNALIPADDRESS
    Check if your ip is red and the line ends with a 1 like: "YOUREXTERNALIPADDRESS:9999" : 1. Then you know its connectes and seen on the network.




    :) CONGRATS SO FAR! THE HARD WORK IS DONE! :)
     
    #2 fuzzyduck, Feb 21, 2015
    Last edited by a moderator: Aug 14, 2015
    • Like Like x 4
  3. fuzzyduck

    fuzzyduck Active Member

    Joined:
    Feb 19, 2015
    Messages:
    134
    Likes Received:
    113
    Trophy Points:
    93
    17. Updating & configuring your local wallet on your desktop to get the payments rolling in

    Download the latest wallet from http://www.dashpay.io/ and replace the version with the one you already have on your pc. ( I assume you already have your wallet running, else you are not here) :rolleyes:

    The Local(wallet on your desktop) and Remote(Masternode on PI2) version should always be the same.

    Dont start it yet. We are now gonna make another dash.conf and put it in the datadirectory of the wallet. This should be here unless you moved it on purpose:

    C:\Users\username\AppData\Roaming\Dash

    Now open notepad and paste this:

    masternodeaddr=XXX.XXX.XXX.XXX:9999
    masternode=1
    masternodeprivkey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


    Change the first XXX with you external IP address.
    Change the second long XXX with your masternode private key i asked you to save somewhere.

    Save the file as dash.conf in C:\Users\username\AppData\Roaming\Dash

    Start up the wallet and let it sync until you see a green checkmark in the bottom right corner.


    18. Moving you 1000dash to a masternode address

    Unlock your wallet in the settings menu. If you dont have it encrypted yet do it NOW! :eek:

    Again, choose are very strong password. Not the name of your pet, but preferably a sentence you can remember easily. Make it weird swapping a with @, s with a $ etc.

    Anyway you should have it unlocked before continuing....

    In the wallet head to Tools-->Debug console

    Now to generate your new Masternode's receiving address type:

    getaccountaddress 0

    This will output your special masternode payment enabled public address!

    Next up is dumping the private key of that new address:

    dumpprivkey YOURADDRESCOPYPASTEIT

    Copy both strings to a notepad editor and print it. Store is somewhere safe.
    For now, save the notepad file to your desktop temporarily. We will encrypt it later in chapter 20.

    From wherever you currently hold your 1,000dash (exchange, another dash wallet, even a different address in the same wallet), send your dash to your freshly generated "0" Masternode receiving address in your wallet. Make sure the "Darksend" checkbox is unchecked.
    You must send exactly 1,000dash to this address, no more, no less, to be eligible to run a Masternode! Once you have initiated the transaction, you must wait for a minimum of 15 confirmations so your address is eligible to be associated with your new Masternode.


    19. Starting your mastenode.

    Now after you 15 conformations are through you can start your PI2 masternode. Again do this from the debug-console and enter:

    masternode start YOURWALLETPASSWORD

    You should see "successfully started masternode"

    Wait about 20 to 30min and check:

    https://dashninja.pl/?mnregexp=XXX.XXX.XXX.XXX
    On this site you can see if your masternode is listed. Ofcourse replace the XXX with your external IP. It should be all green like this:

    [​IMG]



    :)CONGRATS SO FAR! YOUR MASTERNODE IS RUNNING!:)




    20. Storing your precious files to a USB

    Grab a thumbdrive you can spare and empty it because you will loose all data.. Head over to

    https://www.grc.com/misc/truecrypt/truecrypt.htm

    and install Truecrypt 7.1a

    Next follow the graphical tutorial on:

    https://kb.wisc.edu/page.php?id=18301

    You end up with an encrypted USBthumbdrive you can unlock with a password using truecrypt.

    Save the notepad file with the public and private key to the openend USBthumbdrive. Delete the file from your desktop and empty the desktop trashcan.

    Close Your Dash Wallet and wait untill its done closing. Head over to your datadir C:\Users\username\AppData\Roaming\Dash

    and copy your wallet.dat and your dash.conf to your usbthumbdrive as well. Then close the drive and store the drive in the house somewhere.

    <BLINK> NOTE: NEVER COPY/MOVE THE WALLET.DAT FILE WHILE YOUR WALLET IS OPEN. IT WILL GET CORRUPTED! </BLINK>


    Note: You can also make a truecrypt container file and save it on your desktop but, you know.... Harddisks fail......:what: (and if you are like me, tinkering with hardware, you might just drop a screwdriver in a running pc:D.

    Alternatively you can make that truecrypt containerfile and save that to the thumbdrive. In that way you can save some more files on it unencrypted. You choose your flavor.

    Remember you can loose both the sheet of paper AND the thumbdrive by fire, if both held at home. So you can also email a containerfile to yourself with a weird name. Zip it also, again with a strong password (other one then the walletfile).
     
    #3 fuzzyduck, Feb 21, 2015
    Last edited by a moderator: Mar 29, 2015
    • Like Like x 2
  4. fuzzyduck

    fuzzyduck Active Member

    Joined:
    Feb 19, 2015
    Messages:
    134
    Likes Received:
    113
    Trophy Points:
    93
    21. Updating your running masternode

    NEW: 05-08-2015

    I made and update script tailormade for my tutorial. Run it and its all on automatic. Only to do is type the sudo password and the beginning and ending of the script to to enable and disable swap. Make sure you did the greyed out chapter 12 in my previous post. Dunno what caused it but building a new version made the running dashd crash, so i added swap to this script.

    In the dir you land when using putty type:

    nano update

    ( If you get error you dont have nano installed: sudo apt-get install nano )

    Then copy paste the whole lot down below with a rightclick.

    #!/bin/sh

    clear

    echo " "
    echo " "
    echo " ******** SWAP ON, TYPE PASSWORD ******** "
    echo " "
    echo " "

    sudo swapon -a

    echo " "
    echo " "
    echo " ******** REMOVING BACKUP AND OLD GITHUB CLONE ******** "
    echo " "
    echo " "

    rm dashdold
    rm -R -f darkcoin

    echo " "
    echo " "
    echo " ******** CLONING NEW GITHUB ******** "
    echo " "
    echo " "

    git clone https://github.com/darkcoin/darkcoin

    echo " "
    echo " "
    echo " ******** STARTING BUILD ******** "
    echo " "
    echo " "

    ./darkcoin/autogen.sh
    ./darkcoin/configure --with-incompatible-bdb
    ./darkcoin/make

    echo " "
    echo " "
    echo " ******** STOPPING DASHD AND SLEEP 20SEC COOLDOWN ******** "
    echo " "
    echo " "

    ./dashd stop
    sleep 20

    echo " "
    echo " "
    echo " ******** BACK UP PREVIOUS DASHD TO DASHOLD IN CASE NEW ONE DOESNT RUN PROPERLY, AND RUN NEW DASHD ******** "
    echo " "
    echo " "

    mv dashd dashdold
    mv darkcoin/src/dashd .
    chmod +x ./dashd
    ./dashd

    echo " "
    echo " "
    echo " ******** SLEEPING 5 MINUTES TO LET IT START UP ******** "
    echo " "
    echo " "

    sleep 300

    echo " "
    echo " "
    echo "******** SWAP OFF, TYPE PASSWORD ******** "
    echo " "
    echo " "

    swapoff -a

    echo " "
    echo " "

    ./check

    echo " "
    echo " "
    echo " "
    echo " ******** MAKE SURE TO START MASTERNODE LOCALLY ******** "


    Save the file with CNTRL-O --> return --> CNTRL-X
    Make the file executable with:

    chmod +x update

    You can now update your masternode with one click!

    ./update
    .
    EDIT: 28-05-2015: I just found out i incorporated ./check command in the script which gives an error cuz its another script i got the check the stats

    EDIT: 28-05-2015: the script starts with removing the file dashdold. This only exists when the scipt in run for the second time because the scipt renames dashd to dashdold, So when presented with an error dont freak out, it will continue.

    21. Updating your running masternode

    You can compile the next version while the masternode is running and swap the file quickly.

    Putty into the PI2

    Check where you are and see the directory darkcoin. Then remove the darkcoin directory:
    (Yes, although we are called DASH now the dir is still called Darkcoin)

    ls
    sudo rm -R darkcoin

    NOTE Dont remove the hidden folder .dash

    Download the newest source from github, enter the directory and compile the next version like you did before.(Yes, although we are called DASH now the dir is still called Darkcoin)

    git clone https://github.com/darkcoin/darkcoin
    cd darkcoin
    ./autogen.sh
    ./configure --with-incompatible-bdb
    make

    NOTE: Remember to leave putty open, or learn otherwise.

    Check if the new darkcoind file is there and ready to be used:

    cd src
    ls

    Now we stop the masternode and replace it with the new one. So head back two up to the main dir and stop and remove the file.

    cd ../..
    ./dashd stop
    (wait a minute)
    rm dashd

    Now we move the new one in the darkcoin/src dir to the current dir you are in atm. And make it executable, and run it!: (Yes, although we are called DASH now the dir is still called Darkcoin)

    mv ~/darkcoin/src/dashd .
    chmod +x ./dashd
    ./dashd

    There you go! Its updated and started. Starting will take some time again. Check cpu with:

    top

    Start the masternode in your local wallet again (not always needed but i do it anyway for good measures)

    Remember you can check if its running correct with:

    ./dashd getinfo
    Check version number and block count vs website

    ./dashd masternode debug
    It should say: masternode started remotely. If anything else its NOT working ok. use this only if you end this tutorial.

    ./dashd masternode list | grep YOUREXTERNALIPADDRESS
    Check if your ip is red and the line ends with a 1 like: "YOUREXTERNALIPADDRESS:9999" : 1. Then you know its connectes and seen on the network.




    ENDNOTE: DONT OPEN PORT 22 IN YOUR ROUTER SO YOU CAN LOGIN WHEN AWAY FROM HOME. YOU BECOME MORE EASILY HACKABLE. JUST PORT 9999.


    :rolleyes:If this tutorial has been helpful for you, dont be shy and donate some spare drk in my pocket. Thank you! :rolleyes:

    XdptGDg2mMQ7wrcp8eUDtTkSPW71vMteBF


    :)GOODLUCK AND HAPPY MASTERNODING @ HOME!:)
     
    #4 fuzzyduck, Feb 21, 2015
    Last edited by a moderator: May 28, 2015
    • Like Like x 2
  5. darkred

    darkred Active Member

    Joined:
    Feb 6, 2015
    Messages:
    235
    Likes Received:
    262
    Trophy Points:
    123
    Good one. I just picked up two PI2s, too. (lol)

    I had the first one building the bitcoind and downloading the blockchain. It's only 16% done.

    FWIW, I just did a make -j 4 on bitcoind and it worked without any problems. I didn't do any of the swap stuff you did above.

    Was not sure what to do with the 2nd PI2. I was considering setting up a MN on testnet first, since I don't have much experience with a MN. Thanks for sharing your recipe. I may end up "testing" it. :)

    I'd seriously consider "hardening" the distro.

    Take a look at all of these logins that are enabled:

    root:x:0:0:root:/root:/bin/bash
    daemon:x:1:1:daemon:/usr/sbin:/bin/sh
    bin:x:2:2:bin:/bin:/bin/sh
    sys:x:3:3:sys:/dev:/bin/sh
    games:x:5:60:games:/usr/games:/bin/sh
    man:x:6:12:man:/var/cache/man:/bin/sh
    lp:x:7:7:lp:/var/spool/lpd:/bin/sh
    mail:x:8:8:mail:/var/mail:/bin/sh
    news:x:9:9:news:/var/spool/news:/bin/sh
    uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
    proxy:x:13:13:proxy:/bin:/bin/sh
    www-data:x:33:33:www-data:/var/www:/bin/sh
    backup:x:34:34:backup:/var/backups:/bin/sh
    list:x:38:38:Mailing List Manager:/var/list:/bin/sh
    irc:x:39:39:ircd:/var/run/ircd:/bin/sh
    gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
    nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
    libuuid:x:100:101::/var/lib/libuuid:/bin/sh
    pi:x:1000:1000:,,,:/home/pi:/bin/bash

    eek. Pretty sure most of those should be set to /bin/false.

    Don't forget to change the root pw. In fact, I'd create a new account and delete the pi account.
     
    • Like Like x 4
  6. UdjinM6

    UdjinM6 Official Dash Dev
    Dash Core Team Moderator

    Joined:
    May 20, 2014
    Messages:
    3,631
    Likes Received:
    3,532
    Trophy Points:
    1,183
    https://github.com/UdjinM6/darkcoin-bootstrap
    Fresh bootstrap.dat at 0:00 UTC every day ;)
     
    • Like Like x 2
  7. darkred

    darkred Active Member

    Joined:
    Feb 6, 2015
    Messages:
    235
    Likes Received:
    262
    Trophy Points:
    123
    Sorry. The first PI2 is downloading the bitcoin blockchain. lol

    However, I may use that on the second pi2. Thanks
     
    • Like Like x 1
  8. UdjinM6

    UdjinM6 Official Dash Dev
    Dash Core Team Moderator

    Joined:
    May 20, 2014
    Messages:
    3,631
    Likes Received:
    3,532
    Trophy Points:
    1,183
    I thought you just misspelled darkcoind :tongue:
     
    • Like Like x 2
  9. darkred

    darkred Active Member

    Joined:
    Feb 6, 2015
    Messages:
    235
    Likes Received:
    262
    Trophy Points:
    123
    I'm lazy. Can you combine all of those pkgs onto one line? (like this)

    sudo apt-get install libtool autotools-dev autoconf libdb-dev libminiupnpc-dev dh-autoreconf libdb++-dev libboost-all-dev libssl-dev pkg-config

    This:
    # ufw status
    should be this:
    # sudo ufw status
     
    • Like Like x 2
  10. darkred

    darkred Active Member

    Joined:
    Feb 6, 2015
    Messages:
    235
    Likes Received:
    262
    Trophy Points:
    123
    Tried building with -j4 without the swap steps... boom. "virtual memory exhausted: Cannot allocate memory" Just like you said.

    Did the swap steps.

    Change this:
    chmod 600 /root/swap
    to this:
    sudo chmod 600 /root/swap

    and
    mkswap /root/swap
    to
    sudo mkswap /root/swap

    Building now... with -j2

    Now I wait... gotta run some errands anyways...
     
    • Like Like x 2
  11. fuzzyduck

    fuzzyduck Active Member

    Joined:
    Feb 19, 2015
    Messages:
    134
    Likes Received:
    113
    Trophy Points:
    93
    thx for the tips. I edited the tuts with your tips. I forgot sudo somwhere and did your apt-get install 'the whole bunch'. Mine failed so i entered them one by one, but that must have been a typo i guess.

    To just disable users on the pi i dunno yet. I think i will test some stuff first in vmware before i disable them. I dont wanna break my Masternode just yet now its running so smooth.

    EDIT: Split 8 in 8a and b. Rootpasword and user pi addressed.
     
    #11 fuzzyduck, Feb 22, 2015
    Last edited by a moderator: Feb 22, 2015
    • Like Like x 1
  12. fuzzyduck

    fuzzyduck Active Member

    Joined:
    Feb 19, 2015
    Messages:
    134
    Likes Received:
    113
    Trophy Points:
    93
    # cat /etc/passwd | cut -d":" -f1

    shows all users and:

    # userdel -r login

    removes them.

    I succesfully removed user irc / games but dunno how far i can go.

    darkred Can you test how far we can go on your second pi2?
     
    • Like Like x 1
  13. darkred

    darkred Active Member

    Joined:
    Feb 6, 2015
    Messages:
    235
    Likes Received:
    262
    Trophy Points:
    123
    Sure. Not sure I want to remove pi user, yet. Let me make another pass.

    Another thing... all of the commands that start with '#' look really good on the tutorial, but they're a bit painful to copy/paste because you have to select most of the line (without the # sign). The prompt is <user>@raspberrypi <dir>$ and not a # sign. Can you remove the leading character '#' to make it easier to copy/paste? I can make another pass from a fresh install.

    My testnet never sync'd. You probably don't care as you're using this for a MN on the real darkcoin network.

    It would get to some really close 99+% message:
    2015-02-22 05:56:45 UpdateTip: new best=00000003014cd4211ddc7647057ae0b2a983c8415239aa36051c285a5223bbe1 height=9075 log2_work=40.557032 tx=10756 date=2015-02-22 05:56:14 progress=0.999983

    Then several of these...
    2015-02-22 05:56:45 ProcessBlock: ACCEPTED
    2015-02-22 05:56:45 ProcessMessages(mnw, 145 bytes) : Exception 'CDataStream::read() : end of data' caught, normally caused by a message being shorter than its stated length

    Then back to another 99+% message. On and on. Killed and restarted it multiple times. Let it churn for a long time.

    Not sure what's up with that.

    Any thoughts anyone?

    Also, there was no "make check" step in your tutorial.

    Which is probably good because they fail.

    [email protected] ~/darkcoin $ make check
    Making check in src
    make[1]: Entering directory '/home/pi/darkcoin/src'
    Making check in .
    make[2]: Entering directory '/home/pi/darkcoin/src'
    make[2]: Leaving directory '/home/pi/darkcoin/src'
    Making check in test
    make[2]: Entering directory '/home/pi/darkcoin/src/test'
    make check-am
    make[3]: Entering directory '/home/pi/darkcoin/src/test'
    make check-TESTS
    make[4]: Entering directory '/home/pi/darkcoin/src/test'
    Running 115 test cases...
    alert_tests.cpp(121): error in "AlertApplies": check alert.CheckSignature() failed
    alert_tests.cpp(121): error in "AlertApplies": check alert.CheckSignature() failed
    alert_tests.cpp(121): error in "AlertApplies": check alert.CheckSignature() failed
    alert_tests.cpp(121): error in "AlertApplies": check alert.CheckSignature() failed
    alert_tests.cpp(121): error in "AlertApplies": check alert.CheckSignature() failed
    alert_tests.cpp(121): error in "AlertApplies": check alert.CheckSignature() failed
    alert_tests.cpp(121): error in "AlertApplies": check alert.CheckSignature() failed
    alert_tests.cpp(121): error in "AlertApplies": check alert.CheckSignature() failed
    alert_tests.cpp(127): error in "AlertApplies": check alerts[0].AppliesTo(1, "") failed
    alert_tests.cpp(128): error in "AlertApplies": check alerts[0].AppliesTo(999001, "") failed
    alert_tests.cpp(129): error in "AlertApplies": check alerts[0].AppliesTo(1, "/Satoshi:11.11.11/") failed
    alert_tests.cpp(131): error in "AlertApplies": check alerts[1].AppliesTo(1, "/Satoshi:0.1.0/") failed
    alert_tests.cpp(132): error in "AlertApplies": check alerts[1].AppliesTo(999001, "/Satoshi:0.1.0/") failed
    alert_tests.cpp(134): error in "AlertApplies": check alerts[2].AppliesTo(1, "/Satoshi:0.1.0/") failed
    alert_tests.cpp(135): error in "AlertApplies": check alerts[2].AppliesTo(1, "/Satoshi:0.2.0/") failed
    alert_tests.cpp(171): error in "AlertNotify": check r.size() == 4u failed [0 != 4]
    unknown location(0): fatal error in "AlertNotify": memory access violation at address: 0x00000000: no mapping at fault address
    alert_tests.cpp(172): last checkpoint

    *** 17 failures detected in test suite "Bitcoin Test Suite"
    FAIL: test_darkcoin
    =================================
    1 of 1 test failed
    Please report to [email protected]
    =================================
    Makefile:1105: recipe for target 'check-TESTS' failed
    make[4]: *** [check-TESTS] Error 1
    make[4]: Leaving directory '/home/pi/darkcoin/src/test'
    Makefile:1228: recipe for target 'check-am' failed
    make[3]: *** [check-am] Error 2
    make[3]: Leaving directory '/home/pi/darkcoin/src/test'
    Makefile:1230: recipe for target 'check' failed
    make[2]: *** [check] Error 2
    make[2]: Leaving directory '/home/pi/darkcoin/src/test'
    Makefile:859: recipe for target 'check-recursive' failed
    make[1]: *** [check-recursive] Error 1
    make[1]: Leaving directory '/home/pi/darkcoin/src'
    Makefile:435: recipe for target 'check-recursive' failed
    make: *** [check-recursive] Error 1

    [email protected] ~/darkcoin $ git pull
    Already up-to-date.
    [email protected] ~/darkcoin $ git branch
    * master
    [email protected] ~/darkcoin $ git branch -a
    * master
    remotes/origin/HEAD -> origin/master
    remotes/origin/consensus-voting-sysstem
    remotes/origin/dsee-notes
    remotes/origin/master
    remotes/origin/master-mnpayments-debug
    remotes/origin/master-v0.10
    remotes/origin/masternode-blinding
    remotes/origin/mnchanges
    remotes/origin/revert-187-devel-0.9-strings
    remotes/origin/revert-191-revert-187-devel-0.9-strings
    remotes/origin/spork-reprocess
    remotes/origin/v0.11.1.x
    remotes/origin/v0.11.2.x

    Not sure if I should switch to 11.2.x since I'm going to be on testnet for a bit...

    BTW, my bitcoin one got to 26% sync'ed before it died. Looks like a memory leak...
    2015-02-22 10:33:34 UpdateTip: new best=00000000000000001b895df68cb44e97ae64b2af45a2f660fb7fb4ad8d1d388b height=291143 log2_work=77.352432 tx=35081337 date=2014-03-18 09:08:06 progress=0.265558 cache=171169
    2015-02-22 10:34:01
    ************************
    EXCEPTION: St9bad_alloc
    std::bad_alloc
    bitcoin in ProcessMessages()

    This is what I did on the bitcoin one:
    [email protected] ~ $ cat /etc/rc.local
    #!/bin/sh -e
    #
    # rc.local
    #
    # This script is executed at the end of each multiuser runlevel.
    # Make sure that the script will "exit 0" on success or any other
    # value on error.
    #
    # In order to enable or disable this script just change the execution
    # bits.
    #
    # By default this script does nothing.
    # Print the IP address
    _IP=$(hostname -I) || true
    if [ "$_IP" ]; then
    printf "My IP address is %s\n" "$_IP"
    fi
    su pi -c '/usr/local/bin/bitcoind &'
    exit 0

    Perhaps we should do a similar thing on the darkcoind pi.

    Also, I'm thinking of adding a croncheck to reboot if the process is not running.
     
    • Like Like x 1
  14. darkred

    darkred Active Member

    Joined:
    Feb 6, 2015
    Messages:
    235
    Likes Received:
    262
    Trophy Points:
    123
    How are you running raspberry pi in vmware?
     
    • Like Like x 1
  15. darkred

    darkred Active Member

    Joined:
    Feb 6, 2015
    Messages:
    235
    Likes Received:
    262
    Trophy Points:
    123
    Hmm... this is kinda close...

    accts="daemon bin sys games man lp mail news uucp proxy www-data backup list irc list gnats nobody libuuid ntp"

    [email protected] ~ $ for a in $accts; do echo sudo usermod -s /bin/false $a ; done
    sudo usermod -s /bin/false daemon
    sudo usermod -s /bin/false bin
    sudo usermod -s /bin/false sys
    sudo usermod -s /bin/false games
    sudo usermod -s /bin/false man
    sudo usermod -s /bin/false lp
    sudo usermod -s /bin/false mail
    sudo usermod -s /bin/false news
    sudo usermod -s /bin/false uucp
    sudo usermod -s /bin/false proxy
    sudo usermod -s /bin/false www-data
    sudo usermod -s /bin/false backup
    sudo usermod -s /bin/false list
    sudo usermod -s /bin/false irc
    sudo usermod -s /bin/false list
    sudo usermod -s /bin/false gnats
    sudo usermod -s /bin/false nobody
    sudo usermod -s /bin/false libuuid
    sudo usermod -s /bin/false ntp
    sudo usermod -s /bin/false mail

    To check...

    [email protected] ~ $ cat /etc/passwd | grep sh
    root:x:0:0:root:/root:/bin/bash
    mail:x:8:8:mail:/var/mail:/bin/sh
    pi:x:1000:1000:,,,:/home/pi:/bin/bash
    sshd:x:101:65534::/var/run/sshd:/usr/sbin/nologin

    I cannot figure out why the mail account will not get disabled. I have also tried 'usermod -s /sbin/nologin' but that gets the same results.


    Note: Ninjaedit... forgot to include the accts variable at the top.
     
    #15 darkred, Feb 22, 2015
    Last edited by a moderator: Feb 22, 2015
    • Like Like x 1
  16. darkred

    darkred Active Member

    Joined:
    Feb 6, 2015
    Messages:
    235
    Likes Received:
    262
    Trophy Points:
    123
    Figured out my issue with the swap. You need to add /root/swap to the command. Here's how you can see if it has more swap. This is much better than using 'top'.

    [email protected] ~ $ sudo swapon -s
    Filename Type Size Used Priority
    /var/swap file 102396 0 -1
    [email protected] ~ $ sudo swapon /root/swap
    [email protected] ~ $ sudo swapon -s
    Filename Type Size Used Priority
    /var/swap file 102396 0 -1
    /root/swap file 2097148 0 -2
     
    • Like Like x 1
  17. darkred

    darkred Active Member

    Joined:
    Feb 6, 2015
    Messages:
    235
    Likes Received:
    262
    Trophy Points:
    123
    • Like Like x 1
  18. darkred

    darkred Active Member

    Joined:
    Feb 6, 2015
    Messages:
    235
    Likes Received:
    262
    Trophy Points:
    123
    Without the -j (so it just uses one process to build all)

    [email protected] ~/darkcoin $ time make
    <snip>
    real 93m22.457s
    user 90m45.570s
    sys 1m56.950s
     
    • Like Like x 1
  19. fuzzyduck

    fuzzyduck Active Member

    Joined:
    Feb 19, 2015
    Messages:
    134
    Likes Received:
    113
    Trophy Points:
    93
    Are you saying compiling with 1 core is quicker then 4?

    And as for you bitcoin testing and testnet testing on the PI2. Remember im a linux freshman and just got the basics sorted. So i cant help u with that sorry.

    Thanks for the user-disable testing. Does your PI2 still logs in as PI and ROOT? That the only one im using now atm. If so, i can safely put your commands in the tut!
     
    • Like Like x 1
  20. darkred

    darkred Active Member

    Joined:
    Feb 6, 2015
    Messages:
    235
    Likes Received:
    262
    Trophy Points:
    123
    It appears that compiling with 1 core is quicker than 4. I guess we can drop the -j option from the make. Still bummed about not being able to run 'make check'. But for now, that will have to do.

    For grins, I re-did the test. I did a 'make clean' and 'sudo reboot', then:
    [email protected] ~/darkcoin $ time make
    Making all in src
    <snip>
    real 93m29.558s
    user 90m53.890s
    sys 1m57.160s
    [email protected] ~/darkcoin $

    No worries about the other stuff.

    You probably want to disable the root from being able to ssh. To do so, edit the ssh configuration file changing PermitRootLogin

    [email protected] ~/darkcoin $ grep Root /etc/ssh/sshd_config
    PermitRootLogin yes
    # the setting of "PermitRootLogin without-password".

    [email protected] ~/darkcoin $ sudo vi /etc/ssh/sshd_config

    [email protected] ~/darkcoin $ sudo service ssh restart
    [ ok ] Restarting OpenBSD Secure Shell server: sshd.
    [email protected] ~/darkcoin $ grep Root /etc/ssh/sshd_config
    PermitRootLogin no
    # the setting of "PermitRootLogin without-password".

    I like the change to colors. It looks purty. And, it makes it so much easier to copy/paste. Thanks for doing that.

    You are still missing the swap command that I mentioned in a prior posting. See 'sudo swapon -s'. Ditch the 'top' command.

    Oh. You'll want to setup some alerting for when the darkcoind is not running.

    You'll want some sort of backup running.

    You'll want some regular OS update/upgrade.

    Also, check that your MN is paying something. Check for your MN on this web page: https://drk.mn/

    lol... a little daunting... but not too hard one step at a time. :)
     
    • Like Like x 1
  21. fuzzyduck

    fuzzyduck Active Member

    Joined:
    Feb 19, 2015
    Messages:
    134
    Likes Received:
    113
    Trophy Points:
    93
    Lol i will look into this after im done with the tut. Still got a little bit of writing to do! ;)

    Cant find the time though... :( But im on it!

    EDIT: TUTS ARE DONE!
     
    #21 fuzzyduck, Feb 23, 2015
    Last edited by a moderator: Feb 23, 2015
    • Like Like x 2
  22. Raico

    Raico Well-known Member
    Foundation Member Dash Support Group

    Joined:
    May 28, 2014
    Messages:
    139
    Likes Received:
    143
    Trophy Points:
    193
    Awesome~!!
    i think it must be full of fun when deploying the MN on the pi and enjoy it working like clock.
    Nice work~!
     
  23. fuzzyduck

    fuzzyduck Active Member

    Joined:
    Feb 19, 2015
    Messages:
    134
    Likes Received:
    113
    Trophy Points:
    93
    For sure! It has been running rockstable for over a week now and received 2 payments so far
     
  24. paperThin

    paperThin Member

    Joined:
    Jun 13, 2014
    Messages:
    106
    Likes Received:
    19
    Trophy Points:
    68
    Fuzzy,

    Maybe a dumb question... can I do this on a Raspberry Pi "1"? I am asking because I have one here doing nothing, and would like to fire it up. Any reason it wouldn't work?

    Thanks! (and good write up!)
     
  25. darkred

    darkred Active Member

    Joined:
    Feb 6, 2015
    Messages:
    235
    Likes Received:
    262
    Trophy Points:
    123
    I have a PI1. I guess I could try it. Give me a bit...
     
  26. paperThin

    paperThin Member

    Joined:
    Jun 13, 2014
    Messages:
    106
    Likes Received:
    19
    Trophy Points:
    68
    Thanks! If you don't I will. I am digging around for that thing and will give it a go tomorrow. I will let you know how it goes.
     
  27. fuzzyduck

    fuzzyduck Active Member

    Joined:
    Feb 19, 2015
    Messages:
    134
    Likes Received:
    113
    Trophy Points:
    93
    Before i got the Pi2 i was tinkering with the Pi1 the same way. I got it to compile, but didnt got to the point where i got in running, because the mailman brought the PI2 :)

    I think the cpu of the Pi1 is capable, but not sure about the 512mb ram though. You can try it, and see if its stable. Also you could run it with swap on (see abandoned chapter) but it will shorten the lifespan of the sd card

    workflow should be exactly the same though!

    Let us know.
     
  28. darkred

    darkred Active Member

    Joined:
    Feb 6, 2015
    Messages:
    235
    Likes Received:
    262
    Trophy Points:
    123
    My computer went to sleep and killed my ssh session that had 'make' running. I've setup screen and kicked off the build again. I am really curious how long the build will take.

    There already is swap setup on raspbian. It shows 100 megabytes.

    [email protected] ~ $ top
    top - 14:33:11 up 2 min, 1 user, load average: 0.66, 0.27, 0.10
    Tasks: 76 total, 2 running, 74 sleeping, 0 stopped, 0 zombie
    %Cpu(s): 95.1 us, 3.7 sy, 0.0 ni, 0.0 id, 0.0 wa, 0.0 hi, 1.2 si, 0.0 st
    KiB Mem: 445740 total, 153368 used, 292372 free, 13596 buffers
    KiB Swap: 102396 total, 0 used, 102396 free, 45008 cached

    PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
    2235 pi 20 0 80368 63m 7508 R 93.8 14.7 0:22.95 cc1plus
    2236 pi 20 0 4696 2520 2120 R 6.1 0.6 0:00.22 top
     
  29. darkred

    darkred Active Member

    Joined:
    Feb 6, 2015
    Messages:
    235
    Likes Received:
    262
    Trophy Points:
    123
    Check out using monit for watching/re-starting darkcoind.

    Here's how someone is using it to monitor bitcoind:
    https://bitcointalk.org/index.php?topic=5911.0

    [email protected] ~ $ sudo apt-get install monit
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Suggested packages:
    exim4 postfix mail-transport-agent
    The following NEW packages will be installed:
    monit
    0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
    Need to get 291 kB of archives.
    After this operation, 718 kB of additional disk space will be used.
    Get:1 http://mirrordirector.raspbian.org/raspbian/ wheezy/main monit armhf 1:5.4-2 [291 kB]
    Fetched 291 kB in 0s (300 kB/s)
    Selecting previously unselected package monit.
    (Reading database ... 92017 files and directories currently installed.)
    Unpacking monit (from .../monit_1%3a5.4-2_armhf.deb) ...
    Processing triggers for man-db ...
    Setting up monit (1:5.4-2) ...
    [ ok ] Starting daemon monitor: monit.
     
  30. fuzzyduck

    fuzzyduck Active Member

    Joined:
    Feb 19, 2015
    Messages:
    134
    Likes Received:
    113
    Trophy Points:
    93
    That looks handy. I'll look into it too later. There is also a script here on the forum by drkminer
     

Share This Page