Raspberry Pi 4 Digibyte Core Node Step By Step

The DigiByte Community Forums Cryptocurrency 101 Guides 🧭 Raspberry Pi 4 Digibyte Core Node Step By Step

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #856
    AvatarDigibyte Holder
    Participant

    I wanted to put this together as a bit more detailed step by step to configuring a digibyte node on a raspberry pi. This is a result of a week or so of me fumbling through how to guides and random internet searches for Ubuntu commands. With that said, I am by no means an expert so if anyone see’s something that is incorrect, needs to be tweaked or done a different way, please mention it. I will test out any suggested changes and make updates to the steps as necessary. Once my guide was finished I wiped the storage card on my Raspberry Pi and started from scratch using copy/paste through SSH from this guide, most if not all commands should be copy/paste ready. The longest steps were flashing the Ubuntu image and transferring over the blockchain data. I referenced Yoshi’s guide, linked below, but there were some commands in his guide I could not get to work so others were substituted.

    My hardware:
    Raspberry PI4 4GB
    16GB usb flash drive
    CanaKit case and power supply with on/off button

    Yoshi’s Guide for reference:
    https://medium.com/@YoshiJaeger/running-digibyte-core-on-a-raspberry-pi-3-4-a7350dabbde0

    Installing Ubuntu on the SD card

    This was pretty self explanatory, the guide and tool provided walk you through step by step and I had zero issue. I did this on my Ubuntu desktop but I’m going to guess it works just as well on Windows. You want to pick the 64 bit Ubuntu server 20.04.

    Follow the tutorial for installing Ubuntu server on your sd card:

    https://ubuntu.com/tutorials/how-to-install-ubuntu-on-your-raspberry-pi#1-overview

    Once the tool finishes writing the OS. Mount the SD to your PC, you can configure wifi at this time using the details in the Ubuntu how to above.

    If you will be running without a display we need to configure ssh. Create a blank file and name it ssh. It can be a text file without the txt extension. Place it in the same folder as the network config file. If you are going to temporarily attach a keyboard/monitor you can skip the ssh part but using ssh does make it easier to simply copy/paste the commands instead of retyping.

    Start working with the PI

    Install your SD card into the Raspberry Pi, plug in the power and Ethernet cables. Power on the Raspberry PI.

    You will need to find the IP of the raspberry PI. I have a mobile app that connects to my router and I was able to look up the IP there. If you don’t have something like this available, log in to your router from your PC and get the IP from there. This would also be a good time to configure you router to give the PI a static IP, this will make sure the IP stays the same with each reboot. Set up port forwarding on port 12024 to this static IP. For this guide, lets assume its 10.10.10.15.

    Since I am configuring the PI from Ubuntu I just used terminal to ssh in, for windows you can download an SSH client or there may be other options.

    First boot will take a few minutes but try to ssh to the PI using the below, be sure to substitute in your IP:

    ssh [email protected]

    The default username and password are ubuntu/ubuntu. If ssh does not connect, wait 5 minutes and try again. Upon connecting, you are asked to reset the password. Choose a a new password and you will be disconnected.

    SSH back to the PI using:

    ssh [email protected]

    You are now SSH connected to the PI and can begin configuring the system.

    Updating the Ubuntu System

    First thing you want to do is update the system, the system may be updating packages in the background so if you receive and error, simply wait a few minutes, enter the following command and hit enter:

    sudo apt-get upgrade

    When prompted to confirm, enter “y�? and hit the enter key, the system will now download and apply all updates. Note – This will take a few minutes depending on your internet connection.

    Setting up SWAP space

    Yoshi’s guide specifies setting up swap space as he is using a 1GB ram PI3. The PI4 I am using has 4GB of ram but I decided to add the additional 3GB to match the ram/swap space total as Yoshi had. This may not be necessary but I don’t believe it will hurt. Swap space should be put on the usb flash instead of the SD for longevity. (With the 8gb PI out now this might now be necessary at all, I plan to purchase one and test as well)

    Insert your usb flash drive, mine is 16gb, few dollars off amazon. We now need to find the path of this drive. Run the following command:

    sudo lsblk

    Since we only have the one usb storage you’re going to be looking for something like /dev/sda1. The “size�? is also a good tell of which one it is if your SD card is a different size than your USB drive.

    Now that we know what the device is called we want to format it with fat32. Enter the following command to make sure its not mounted:

    sudo umount /dev/sda1

    Now we format using:

    sudo mkfs.vfat -F 32 /dev/sda1

    Now we want to make a mount point to mount this directory, use the following command:

    sudo mkdir /media/usb

    With that all finished, we mount the usb drive with the following (note the space between sda1 and /media):

    sudo mount /dev/sda1 /media/usb

    With the USB mounted we can go ahead and make our swap file, in this example I’m going to call it “usbswap�?. This file is going to be placed on the usb stick at the mount point. For my application I will be using 3GB as my swap space, change the 3 to whatever your config needs are. To create the file, use the following command:

    sudo fallocate -l 3G /media/usb/usbswap

    Set the permissions type so only the root user can write/read swap with:

    sudo chmod 600 /media/usb/usbswap

    NOTE: For some reason I cannot get the above permissions set despite trying many different commands. This seems to be the correct command. The system works fine without these permission restrictions set so I’ve left it for now without issue.

    Set the file as linux swap with:

    sudo mkswap /media/usb/usbswap

    Enable swap with:

    sudo swapon /media/usb/usbswap

    To verify the swap space is active run:

    sudo swapon -show

    You should see your designated swap space with the path name we specified above. With this confirmed we now want to make an entry in fstab so this is enabled with every boot. We need to find the UUID of /dev/sda1. Run the following:

    sudo blkid

    Note the UUID of /dev/sda1.

    We are now going to enter fstab with the following command:

    sudo nano /etc/fstab

    Use the down arrow to get to the bottom of the file and paste the following two lines, be sure to replace the X characters with the UUID you noted for /dev/sda1:

    UUID=XXXX-XXXX /media/usb auto nosuid,nodev,nofail 0 0
    /media/usb/usbswap swap swap defaults 0 0

    The first line here makes sure the usb is mounted on boot, the second line enables swap. Once these are pasted, hit ctrl X to exit, save with “Y�? then enter.

    Enter the following to reboot:

    sudo reboot

    Once the Pi comes back up, ssh to it and check that swap is active with:

    sudo free -h

    Preparing for Digibyte Core

    With all the above finished I started going through the following guide with a few changes.
    https://www.dgbwiki.com/index.php?title=Running_a_full_open_node_on_a_Linux_server

    Starting at the “Create User�? section, follow the instructions for Ubuntu as follows:

    Creating a new user

    sudo useradd -G sudo digibyte -m -s /bin/bash

    Set the password for this user:

    sudo passwd digibyte

    Log in as the user digibyte:

    su – digibyte

    Now that you have created a user named “digibyte�? a new home folder was created, your current directory is /home/digibyte instead of /home/ubuntu.

    Create the Digibyte config file

    I had some trouble with the commands in the guide for this section but was able to get the conf file made and edited using the below:

    Make the digibyte hidden directory with the following command:

    mkdir -vp /home/digibyte/.digibyte

    Move in to the hidden directory with:

    cd .digibyte

    Make an empty configuration file with:

    sudo touch digibyte.conf

    Verify the file is there using:

    ls

    Enter the digibyte.conf file with nano using:

    sudo nano digibyte.conf

    You should now be in the digibyte conf file with a blinking cursor ready for you to enter the details. Paste or type the following into the file:

    daemon=1
    maxconnections=5
    disablewallet=1
    minrelaytxfee = 0.0000005
    limitfreerelay = 0

    These are a mix of the items in Yoshi’s guide and the ones from the digibyte guide, I’ve set my maxconnections to 5 for now and will be monitoring performance to see if it can be increased.

    With the details pasted in the file press the “ctrl�? and “x�? keys simultaneously, you will be asked if you want to save the the file. Type “y�? and hit enter, the file will be saved.

    Move back to the /home/digibyte folder. “cd ..�? will move you back and you can use “ls�? to see whats inside your current folder. The folder structures aren’t very deep at the moments so if you get lost as to where you are you can “cd ..�? back as far as you need to using “ls�? at every step to see where you are. Is you back up too far, simply enter “cd�? followed by the directory you want to get in.

    Downloading Digibyte

    We are now in the /home/digibyte directory and we want to download digibyte. Use the “wget�? command with the URL following to download digibyte to the current folder.

    wget https://github.com/digibyte/digibyte/releases/download/v7.17.2/digibyte-7.17.2-aarch64-linux-gnu.tar.gz

    When the download is finished we need to unzip digibyte, use the following:

    tar -xf digibyte-7.17.2-aarch64-linux-gnu.tar.gz

    To save some space, lets remove the tar.gz we downloaded with:

    rm digibyte-7.17.2-aarch64-linux-gnu.tar.gz

    Use the “ls�? command to verify we now have a directory for digibyte-7.17.2.

    Adding a service file

    We want Digibyte to start every time the Pi boots up and we want it to run in the background.

    Log in to root with

    sudo su

    To define and open the service file enter:

    cat <<EOF > /etc/systemd/system/digibyted.service

    Paste the following, this is taken right from the digibyte guide above:

    [Unit]
    Description=DigiByte’s distributed currency daemon
    After=network.target

    [Service]
    User=digibyte
    Group=digibyte

    Type=forking
    PIDFile=/home/digibyte/.digibyte/digibyted.pid
    ExecStart=/home/digibyte/digibyte-7.17.2/bin/digibyted -daemon -pid=/home/digibyte/.digibyte/digibyted.pid \
    -conf=/home/digibyte/.digibyte/digibyte.conf -datadir=/home/digibyte/.digibyte -disablewallet

    Restart=always
    PrivateTmp=true
    TimeoutStopSec=60s
    TimeoutStartSec=2s
    StartLimitInterval=120s
    StartLimitBurst=5

    [Install]
    WantedBy=multi-user.target
    EOF

    Hit enter after pasting the above.

    Enable the service on boot with:

    systemctl enable digibyted.service

    Log back in as the digibyte user with:

    su – digibyte

    The service is now ready to be started and will start on reboot. We can do this now but that meas you are going to have to download the entire blockchain and based on some tests this will take days. You can do this if that wait time doesn’t matter, simply start the service and leave the PI alone, it will sync over the next few days and your node is running.

    We can speed this process up however by downloading most of the chain to our desktop PCs and then moving the chain data over. You can download the chain from here:

    https://drive.google.com/file/d/1o3kCLnZLofkKrFGFvWl2bnt44ouGfoM7/view?usp=sharing

    This link was pulled from the DGB Wiki and can be verified here:

    https://www.dgbwiki.com/index.php?title=Speeding_up_sync_for_your_DigiByte_Core_Wallet

    Once downloaded I moved it to my desktop and used SCP to transfer it over to the PI. I did this in ubuntu so I opened a terminal on the desktop and used the following:

    scp DigiByte.zip [email protected]:/home/digibyte/.digibyte

    Once the transfer was complete I installed unzip with:

    sudo apt install unzip

    Unzip the blockchain data with:

    unzip DigiByte.zip

    The unzip process will take some time. There is a digibyte.conf file in this zip and you will be asked if you want to overwrite the current one in the directory. Since we already configured ours, select “n�? and hit enter. This should be the last step and your chain data is properly staged.

    To free up some space we can remove the zip file with:

    rm DigiByte.zip

    Now we start the service with:

    systemctl start digibyted.service

    Tail the log to make sure the service is running with:

    tail -f /home/digibyte/.digibyte/debug.log

    It may take several minutes but once you see the chain begin to sync you can exit the log with “ctrl�? + “c�?.

    That’s it! Your Digibyte core node is now up and operational.

    From the Digibyte Wiki I decided not to use the upgrade tip shown. When its time to upgrade we can use nano to get into the service file and manually update. Updates seem to be pretty infrequent so I’d rather manually check a few things but that’s just my preference.

    Now that everything is set up you can use the digibyte cli that’s in the bin folder to check the state of the node, things like block height, peer info and various other node details can be found.

    You want to navigate to the home/digibyte/digibyte-7.17.2/bin folder. In here is the digibyte-cli.

    You can use it as follows:

    ./digibyte-cli getconnectioncount

    This shows the list of active connections. The full list is available in the qt wallet and instead of pasting the full list here I’m looking for an online source.

    Again, any and all feedback is welcome and hopefully this makes things a bit more clear for those who were apprehensive about tackling this project.

    #862
    Oliver KrilovOliver Krilov
    Participant

    Thanks on behalf of the community for documenting this.
    Perhaps you could also make a page for this on dgbwiki.com and add it to the guides section (https://www.dgbwiki.com/index.php?title=DigiByte#DigiByte_Guides)?

    On another note;
    You can find your local IP by opening a terminal and using the “ifconfig” command.
    It requires the “net-tools” package, I don’t know if this is a default package or not, but it can easily be installed with:

    sudo apt update
    sudo apt install net-tools

    Then run:
    ifconfig

    @KrilovOliver on Twitter & Telegram.

    #912
    Avatarolly
    Participant

    Can this be done on Raspbian, or must you install Ubuntu?

    #913
    Avatarolly
    Participant

    I found that “sudo swapon –show” produced an error:

    swapon: cannot open –show: No such file or directory

    However, typing “sudo swapon” worked fine.

    #914
    Avatarolly
    Participant

    I also found that entering “mkdir -vp /home/digibyte/.digibyte” produced an error saying that I did not have permission to create it.

    “sudo mkdir -vp /home/digibyte/.digibyte” worked fine

    #915
    Avatarolly
    Participant

    “su – digibyte” produces an error. Should it be “su digibyte”?

    #916
    AvatarDigibyte Holder
    Participant

    “su – digibyte�? produces an error. Should it be “su digibyte�??

    Yes “su digibyte” should be the correct command. Despite reviewing it a bunch of times I figured there would be some mistakes. Did you mange to complete the install/setup?

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.

Enquire now

Give us a call or fill in the form below and we will contact you. We endeavor to answer all inquiries within 24 hours on business days.