FREE GUIDES FOR CRYPTOCURRENCY NODE BUILDERS
  • Nodes
    • ALT-Coin Nodes >
      • Ethereum
      • Monero
      • Dogecoin >
        • Dogecoin
        • Dogecoin with display
        • Dogecoin Tor Network
      • Gamecredits >
        • GameCredits
        • Gamecredits with display
        • GameCredits Tor Network
    • Node Add-ons >
      • Wallet Functionality
      • Vanity Address Generators >
        • Bitcoin Vanity Address
        • Litecoin Vanity Address
        • Dogecoin Vanity Address
      • Node stats "Slideshow"
    • Bitcoin Desktop PC Node Software
  • Staking Nodes
    • Dash >
      • Dash - Standard
      • Dash - With LCD display
    • BlackCoin >
      • BlackCoin - Lore
      • BlackCoin - Lore - With LCD display
      • BlackCoin - Lore - Tor enabled
      • BlackCoin - Original
      • BlackCoin - Original - With LCD display
      • BlackCoin - Original - Tor enabled
    • PIVX
    • PinkCoin
    • GoByte >
      • GoByte - Standard
      • GoByte - With LCD display
  • Mining/Data Farming
    • Mining Add-On
    • BurstCoin Mining >
      • Burst Mining Single HDD
      • Burst Mining Multiple HDDs
    • Storj Host (Raspberry Pi)
    • Sia Host (Raspberry Pi)
  • Archive
    • Bitcoin Nodes >
      • With Display >
        • Bitcoin Core With Display
        • Bitcoin Core with display Tor network
        • Bitcoin Cash with display
        • Bitcoin Cash with display Tor network
        • Bitcoin Unlimited with display
        • Bitcoin Unlimited with display Tor network
      • Without Display >
        • Bitcoin Core
        • Bitcoin Core Tor Network
        • Bitcoin Cash
        • Bitcoin Cash Tor Network
        • Bitcoin Unlimited
        • Bitcoin Unlimited Tor Network
      • Update your Node >
        • Latest Core version
    • Litecoin >
      • Litecoin
      • Litecoin with display
      • Litecoin Tor Network
    • Monero >
      • Monero Node for Pi 3 or ARMv7 devices (With LCD display)
      • Monero Node for Pi 3 or ARMv7 devices (no LCD display)
      • Monero Node for all other devices
      • Monero Tor Network add-on
      • Monero Mining Add-On
  • Hardware
  • Hardened Cold Storage
  • SUPPORT
    • Getting Started
    • Credits and Thanks

Bitcoin Core, Segwit 2x, Raspberry Pi

See the HARDWARE tab for parts list and assembly/build information
​Latest Update 8th November 2017

​
Step (1) Preparing the Pi

Because all the preparation steps are the same for all nodes here, I have made a beginner friendly guide with images, step-by-step. "Getting started" Link opens a new window

                                                                                                                     Getting Started


Then continue below...

​Step (2) Enabling WiFi
Picture
Wifi is available once the Pi is rebooted. Either reboot now using
sudo reboot
and remove the ethernet cable. Or continue, and reboot later as it is required after the next step.
With the Pi turned on, booted and you logged in with SSH we can start the setup.

First WiFi network connections are stored:
​
                         sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Go to the bottom of the file and add the following text:
    
                             network={
                                 ssid="YOUR WIFI ROUTER NAME"
                                 psk="YOUR WIFI ROUTER PASSWORD"
                             }

**Note: Enter details between the quotes, leave the  "" in
save and exit using

                             ctrl+O
Then 'enter'
                            ctrl+X

Step (3) Expand the file system, (making full use of the SD card) and changing the Password.
Picture
enter:​
                             sudo raspi-config

The default password for obvious security reasons should be changed. That is done in this menu.

select "1 change user password", and follow the on-screen instructions. This will be the new password when using PUTTY to SSH into the Pi.

Because we installed a 2GB image onto the card, the Pi may think that the card is only 2GB in size. So we tell it to expand the file-system (returns it to it's full size allowed):

select "7 advanced options"

select "A1 expand filesystem"

select 'finish' system will reboot, (remove the ethernet cable if you didn't at the previous step). And log back in with SSH and PUTTY once reboot is complete.

Step (4) Updates

The image we downloaded may have an update or two since they released it:

                             sudo apt-get update
                             sudo apt-get upgrade
                             

select 'y' to accept the storage requirement.

Step (5) Moving everything to the USB drive

People have been making projects (not just nodes) on the raspberry pi for some time. A common failure point seems to be the SD cards. The constant read/write process 24/7 drastically shorten their life. We can reduce this by moving the entire file-system to the USB drive, and where possible using traditional platter HDDs. Check out the 'HARDWARE' section for cheap solutions available to the Raspberry Pi.

For moving the file-system we need the "git" repository

                              sudo apt-get install git

Insert the USB drive if you havn't already, then check it is mounted to the Pi. 

                              sudo lsblk

99% of the time it will be mounted as /dev/sda with a partition called sda1. However if it has found sda1 it won't let us continue until it is unmounted. (It would be telling it to make changes to the filesystem whilst it's in use. It won't let us and doesn't like it). So we unmount with

                             umount /dev/sda1

We need to delete this partition to stop raspbian from automatically using the drive on boot, at this point. The helper in the next step will automatically create a new partition to do it's job of moving the files.

                              sudo fdisk /dev/sda

                              d

(deletes old partition)

                              w

(writes and commits the changes)

Now it's  compatible with the helper script.

The folks at Adafruit have made a very useful helper to reduce the amount of commands you need. These next three lines create a new partition and move the entire file system onto the USB drive. It does warn you that any data currently written to /sda will be overwritten. If you are an advanced user and have called the partition something other than /sda, this is where it should be changed.

                              git clone https://github.com/adafruit/Adafruit-Pi-ExternalRoot-Helper.git
                              cd Adafruit-Pi-ExternalRoot-Helper
                              sudo ./adafruit-pi-externalroot-helper -d /dev/sda


It will ask you to check that you are writing to the correct partition, select y when you are sure. When I do this step it takes a little under 10mins. Please be patient.
Picture
This is our drives labels and addresses. We need to check that the PARTUUID long number (that's the USB), is entered into

                             sudo nano /boot/cmdline.txt
​


​So everything has been copied over and the drive configured. We just need to change the boot file so it starts from the USB drive from now on. The helper untility should have done this automatically. But recently this has not been the case. Do this just to check, it's simple and is just a copy/paste action.

                             sudo blkid -o export /dev/sda1

The numbers will be different but it brings up something like the image on the left. 

Picture
Enter:
                                           sudo nano /boot/cmdline.txt​
And ensure that the helper has changed
root=PARTUUID=
​to match the one that was listed to you above. Yours will be different to mine. Then Save and exit using ctrl+o then ctrl+x.

Do another reboot with           sudo reboot          and when the Pi starts this time your USB activity light will blink like crazy, showing it's now getting it's data from there.


Step (6) Bitcoin Core, Segwit2x
Picture
We start with making a directory to hold the blockchain:

                             mkdir ~/bitcoinData

then enlarge something called a swapfile so the blockchain loads quicker (like artifictialy boosting available memory)

                             sudo nano /etc/dphys-swapfile

And change the default size of 100(MB, to 1000 as shown to the left

save, exit, ctrl+o ctrl+x
Then, to build the new swap file...

                             sudo dphys-swapfile setup
                             sudo dphys-swapfile swapon

This one liner will download and install the packages we will need for Bitcoin Core Segwit 2x:

                             sudo apt-get install autoconf libevent-dev libtool libssl-dev libboost-all-dev libminiupnpc-dev -y


make a directory to download the files

                             mkdir ~/bin
                             cd ~/bin

then download bitcoin core Segwit 2x

                             git clone -b segwit2x https://github.com/btc1/bitcoin.git

then navigate to our bitcoin folder to install it all

                             cd bitcoin
                             ./autogen.sh
                             ./configure --enable-upnp-default --disable-wallet
                             make

**Note** 'make' took around 2 hours on my last build. It has been recommended to use 'make -j2' as the command as it is quicker. The -j2 flag tells the pi how many cores of it's processor to use in that instruction. The pi has 4 cores available but it is not recommended to use them all for  a task. If you encounter errors just stick with 'make'. **Update Nov '17 - With these newer builds I am regularly  getting errors when adding a -j2 flag. I now recommend without.

Then 
                             sudo make install

Configure the node.

                             sudo nano /home/pi/bitcoinData/bitcoin.conf

and add to it

                             rpcuser=<yourbitcoinrpcuser>
                             rpcpassword=<yourpasswordhere>

**make up some values here remove the <>
save, exit, ctrl+o ctrl+x

Picture


​Finally, to autorun the node when the Pi boots, we edit

                             sudo nano /etc/rc.local

and add

                             /usr/local/bin/bitcoind -datadir=/home/pi/bitcoinData -daemon &

To the bottom, but ABOVE 'exit 0'. The & is also very important.

Save, exit, ctrl+0, ctrl+x
That's it!! It will now run when the Pi is booted. So reboot when you're ready.

                       sudo reboot


Picture
​



​
Once booted that should be it! To verify it's working use

                                bitcoin-cli -datadir=/home/pi/bitcoinData getinfo


check you have 8 connections (after giving it 5 mins to start) and each time you use that command, the value of "blocks": xxxxx should be increasing. That is your current block height. It will get slower to increase later on as blocks start getting busier.



Picture





​Once you're happy you are connected to the network, you'll probably want reassurance that you're operating a SegWit version. This is achieved by:

​             bitcoin-cli -datadir=/home/pi/bitcoinData getnetworkinfo

This will display a line titled "subversion", as on the left here. The 14.1 is referring to the core version it is built from, and the 0.3 for the segwit version. These will no doubt increase in the future as new releases become available.


This is the tedious bit. It has to download approx 130GB+ of blocks and verify every transaction within it. That's a big ask for a little raspberry pi! It handles it fine though and on the nodes I have built it has taken approx 4 weeks. Just check on it every-other day or so with the getinfo command above. I've not had one crash yet. I should also mention that it builds the block-chain very quickly at first. For the first few years the block-chain is mostly empty, now the blocks are mostly at capacity and there are many more transactions to verify. It will get slower, this is normal. Once it has fully sync'd the Pi pretty much idles until a new block appears, busying itself with the transaction mempool.

To stop the node (recommended before disconnecting power, or using sudo reboot/shutdown from now on to prevent data corruption) use:

                                       bitcoin-cli -datadir=/home/pi/bitcoinData stop​

Step (7) Security
Picture
​I've been made aware that there are some underlying defaults that can affect system security one is to disable root login by ssh by editing

                                     sudo nano /etc/ssh/sshd_config
and changing
                                    PermitRootLogin without-password
to
                                    PermitRootLogin no

and add the line below to only allow ssh access to user 'pi'

                                    AllowUsers pi

Save, ctrl+o, enter, exit ctrl+x
then reboot sshd by
                                        sudo /etc/init.d/ssh restart

I will update any security recommendations as I become aware of them.
​Enjoy
Powered by Create your own unique website with customizable templates.
  • Nodes
    • ALT-Coin Nodes >
      • Ethereum
      • Monero
      • Dogecoin >
        • Dogecoin
        • Dogecoin with display
        • Dogecoin Tor Network
      • Gamecredits >
        • GameCredits
        • Gamecredits with display
        • GameCredits Tor Network
    • Node Add-ons >
      • Wallet Functionality
      • Vanity Address Generators >
        • Bitcoin Vanity Address
        • Litecoin Vanity Address
        • Dogecoin Vanity Address
      • Node stats "Slideshow"
    • Bitcoin Desktop PC Node Software
  • Staking Nodes
    • Dash >
      • Dash - Standard
      • Dash - With LCD display
    • BlackCoin >
      • BlackCoin - Lore
      • BlackCoin - Lore - With LCD display
      • BlackCoin - Lore - Tor enabled
      • BlackCoin - Original
      • BlackCoin - Original - With LCD display
      • BlackCoin - Original - Tor enabled
    • PIVX
    • PinkCoin
    • GoByte >
      • GoByte - Standard
      • GoByte - With LCD display
  • Mining/Data Farming
    • Mining Add-On
    • BurstCoin Mining >
      • Burst Mining Single HDD
      • Burst Mining Multiple HDDs
    • Storj Host (Raspberry Pi)
    • Sia Host (Raspberry Pi)
  • Archive
    • Bitcoin Nodes >
      • With Display >
        • Bitcoin Core With Display
        • Bitcoin Core with display Tor network
        • Bitcoin Cash with display
        • Bitcoin Cash with display Tor network
        • Bitcoin Unlimited with display
        • Bitcoin Unlimited with display Tor network
      • Without Display >
        • Bitcoin Core
        • Bitcoin Core Tor Network
        • Bitcoin Cash
        • Bitcoin Cash Tor Network
        • Bitcoin Unlimited
        • Bitcoin Unlimited Tor Network
      • Update your Node >
        • Latest Core version
    • Litecoin >
      • Litecoin
      • Litecoin with display
      • Litecoin Tor Network
    • Monero >
      • Monero Node for Pi 3 or ARMv7 devices (With LCD display)
      • Monero Node for Pi 3 or ARMv7 devices (no LCD display)
      • Monero Node for all other devices
      • Monero Tor Network add-on
      • Monero Mining Add-On
  • Hardware
  • Hardened Cold Storage
  • SUPPORT
    • Getting Started
    • Credits and Thanks