Creating a Bitcoin Gold Node using Raspberry Pi 3 and a USB hard drive


#1

Hello everyone,

The purpose of this tutorial is to teach you how to use a Raspberry Pi and a external USB Hard drive in order to create a full node to run on the Bitcoin Gold network. This tutorial will be broken up into three parts. Part 1 will cover setting up the Raspberry Pi. Part 2 will cover enabling usb boot and changing the password. Part 3 will cover installing the node. At the end of the document is a troubleshooting for working around USB boot if it fails.

Materials Needed:
Raspberry Pi 3.0 Model B
2.5 Amp Micro USB Power Adapter
8GB microSD card: It will be used to set up the device for the first time and then won’t be used after that.
External USB Hard Drive: The main thing with this is that it has to be large enough to hold the whole blockchain, the current blockchain is 150gb. Also, not all External hard drives will work as a boot device.
USB Mouse/Keyboard: Any sort of USB mouse/keyboard is fine.

Software Needed:
Raspbian Stretch with Desktop: https://www.raspberrypi.org/downloads/raspbian/
Etcher: https://etcher.io/

Part 1: Setting up the Raspberry Pi 3.0

  1. Download both Etcher and Raspbian from the links listed above.
  2. Install Etcher
  3. Select your image by clicking on image and navigating to the images location.
  4. Select device and choose your MicroSD card from the listed devices.
  5. Click on the flash button and wait for the program to finish flashing the OS to the device.
  6. Once Etcher is finished remove the MicroSD card from your computer and now attach your external HDD.
  7. Once the external HDD is connected we are going to repeat steps 3 through 5 for the external hard drive.
  8. While the Raspbian OS is being flash take the micro SD card and insert it into the slot on the Raspberry Pi.
  9. Plug in your keyboard, mouse, ethernet cable, and HDMI cable into the Raspberry Pi. Once all devices are connected go ahead and plug in the USB power cable.
  10. Once the device boots up it will go through the boot procedures and once that is done you should be met with the Raspbian OS system.
  11. Now open the terminal from the taskbar at the top of the screen.

#2

Part 2: Setting the Pi to boot from USB and changing the password

  1. Type in sudo apt-get update once that has finished running then run sudo apt-get upgrade
  2. This ensures that you have the latest packages for your system and upgrading to them.
  3. In the terminal we are going to type echo program_usb_boot_mode = 1 | sudo tee -a /boot/config.txt this command will set the OTP to use usb boot mode from next reboot on after it is restarted.
  4. Type reboot into the terminal to reboot the device.
  5. Once the device has finished rebooting open the terminal back up and type in vcgencmd otp_dmp | grep 17:
  6. When this command is done it should output “17:3020000a” If this command does not output the desired line that means the OTP was not correctly programmed. Please start from step 1 and try again.
  7. Once this is done shutdown the device by typing shutdown into the terminal. When the device is finished shutting down remove the SD card and plug in your external HDD once it has finished having the OS flashed.
  8. Plug the power cord back into the device to start it up. At this point the device should boot up form the external HDD. If it does not please see the troubleshooting section down below.
  9. Now that the device is booting from the external HDD we want to run both sudo apt-get update and sudo apt-get upgrade again. This will update the installation on the external HDD.
  10. In the terminal we are going to want to change the default password
  11. Type in passwd you will then be asked to enter the current password which is raspberry.
  12. Once that is done enter your password in and confirm it. Once you hit enter your password will be changed.
  13. For more information on users please see: “https://www.raspberrypi.org/documentation/linux/usage/users.md

Part 3: Install BTG Node for Raspberry Pi

  1. Now we are going to install the BTG Node. Download the arm version of the Bitcoin Gold Core wallet from: https://github.com/BTCGPU/BTCGPU/releases/tag/v0.15.0.2
  2. Next open the terminal and type mkdir bitcoingold which will create a folder path under the Pi user. Once this is done you can close the terminal.
  3. Open up the File manager go to downloads and copy the tar.gz file from the downloads folder to your bitcoingold folder.
  4. Next right click on the bitcoingold folder and select open in terminal.
  5. In the terminal type in ls to list the file name to make to easier to type for the next step.
  6. Type in the command tar xvzf bitcoin-gold-0.15.0-arm-linux-gnueabihf.tar.gz
  7. This will now extract the program.
  8. Once it has finished in the terminal type in cd bitcoin-gold-0.15.0
  9. Once you are in the bitcoin-gold-0.15.0 folder type in if [ $(whoami) == ‘root’ ]; then echo “NO don’t run as root”; else cd bin && ./bgold; fi
  10. Congratulations you are now running a full node! If you want you can check to make sure the blockchain is syncing correctly by opening a new terminal and typing in tail -f ~/.bitcoingold/debug.log

Part 4: Troubleshooting USB Boot

Unfortunately not all USB drives are made equal. Some devices take longer than others to spin up or just can’t operate as a boot drive or Raspbian. The end results is that we need a work around to do this. One such was is to leave the SD card as the boot drive and to transfer the root system to the external drive. This will allow you to have access to the storage space you need from the Bitcoin Gold blockchain while allowing your device to boot.

  1. Download the usb-boot.zip script from “https://www.raspberrypi.org/forums/viewtopic.php?t=196778&p=1230182#p1230182
  2. Feel free to read the information in the post as it does have some useful information on what exactly his script does. Also remember to check the script before running it to verify that there are not any issues.
  3. Extract the folder and then drag and drop it to your desktop.
  4. One the desktop in the upper left hand corner is an eject button. Click on it and select your external HDD. I find that if it is still mounted it will not let the program run correctly.
  5. Once this is done open the terminal and type in cd Desktop to navigate to the desktop.
  6. Next type in sudo su to change to the super user.
  7. Now we want to type in bash usb-boot and hit enter.
  8. This will execute the program. Use the arrow keys to highlight your USB device if you have more than use space to select it. Once the drive is selected used tab to navigate to okay and spacebar to start.
  9. The program will then ask you if you want to replicate boot/root contents form the MicroSd card to the external HDD. Hit space to confirm. After this it will pop a warning saying that all existing data on the device will be deleted and ask you if you want to continue. Hit yes and let it start running. Be forewarned that this will take awhile.
  10. Once this is done you can now restart your device and the external HDD will now contain your root path.

If you liked this tutorial and feel like helping out please feel free to donate:

BTG Address: GL5rxUcxrexnqPVgz9mUZ7qfXgzPWLruRf


#3

ok thank you i found this very easy to follow. but being a newbie to crypto., i dont know which files to edit to put my wallet address into ? I dont know if I have completed downloading the entire blockchain. dont know if I am finally helping to hash blocks ? So yeah dont know really what I am looking for with the Pi directory structure. can somebody point me in the right direction ?


#4

I can’t answer regarding Pi file directory structure, so I’ll leave that to others, but I can answer this:

No, you’re not. This approach lets you run a “full node” wallet, not a miner. A full node wallet connects directly to the Bitcoin Gold network of nodes & miners, allowing you to see and transmit transactions to the network, and to see blocks as they are created.

The Pi is not appropriate hardware for running Equihash, the mining algorithm we use. Equihash is designed to be impossible to run on an ASIC, butg possible to run on a graphics card. The Pi is likely not similar enough to a graphics card to run any of the available mining packages.