Dogecoin Node, Raspberry Pi
See the HARDWARE tab for parts list and assembly/build information
Latest Update 25th June 2017
Step 1 Preparing the Pi
Because all the preparation steps are the same for all Dogecoin 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
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"
}
save and exit using
ctrl+O
Then 'enter'
ctrl+X
sudo reboot
remove Ethernet cable
Step (3) Expand the file system, (making full use of the SD card)
sudo raspi-config
select "advanced options"
select "expand filesystem"
select 'finish' system will reboot
log back in via ssh
check file system expanded by using command below (the -h flag means human readable, showing size in 'G' gigabytes, 'M' megabytes, etc)
df -h
Step (4) Updates
sudo apt-get update
sudo apt-get upgrade
select 'y' to accept the storage requirement.
Step (5) Installing Dogecoin
We start with
sudo apt-get install git
mkdir ~/DogecoinData
then enlarge the swapfile so the blockchain loads quicker
sudo nano /etc/dphys-swapfile
And change the default size of 100
CONF_SWAPSIZE=100
To 1000
CONF_SWAPSIZE=1000
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 Dogecoin:
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
Download Dogecoin core
git clone https://github.com/dogecoin/dogecoin.git
Begin the install
cd dogecoin
./autogen.sh
./configure --enable-upnp-default --disable-wallet
make -j2
**Note** It has been recommended to use 'make -j2' as the command as it is quicker than just 'make'. The -j2 tells the pi how many of it's processor cores to build with. The higher the number the faster it builds. In theory up to -j4 is possible but not recommended. If you encounter errors just run 'make' instead.
Then
sudo make install
then we configure the node.
sudo nano /home/pi/DogecoinData/dogecoin.conf
and add to it
rpcuser=<yourdogecoinrpcuser>
rpcpassword=<yourpasswordhere>
save, exit, ctrl+o ctrl+x
Step (6) Security
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
Also in
sudo raspi-config
and follow the top menu option to change the user password to something other than the default of "raspberry"
I will update as I'm informed of other issues.
Step (7) 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.
***Note for future*** This section which guides you through the moving of the entire filesystem is here because we have installed everything, and the next step is to run the node. The helper in this step copies (rather than moves) everything to the USB drive and then points the boot section of the SD card to the USB drive on power-on. In theory this means that if your USB drive ever fails, there is a copy of the entire installation (minus the blockchain) held on the SD card un-used. On a PC open the first partition on the SD card and edit cmdline.txt Then simply relace
root=PARTUUID=<randonnumbers>
with
root=/dev/mmcblk0p2
this will point the root partition back to the second partition on your SD card. Then simply insert a new USB drive, repeat the rest of this step (7) and continue to the final step (8) and your node will start again without having to go through the entire install. It may help someone one day I hope.***End Note***
Insert the USB drive if you haven't already, then check it is mounted to the Pi.
cd
sudo lsblk
99% of the time it will be mounted as /dev/sda with a partition called 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.
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 this:
DEVNAME=/dev/sda1
LABEL=rootfs
UUID=39a737fd-0cb2-4365-b46a-3dd8fe8dacf8
TYPE=ext4
PARTLABEL=primary
PARTUUID=5d23b969-ec82-483f-9084-8803566055a2
This is our drives labels and addresses. We need to check that the PARTUUID of the sda1 (that's the USB), is entered into
sudo nano /boot/cmdline.txt
This one is unchanged, and you can see the PARTUUID for this node is INCORRECT as it doesn't match that I have listed above.
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=1d6e3b54-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
Change it so that the PARTUUID that you have listed above is entered. You will have different numbers but in my case I made it look like this:
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=5d23b969-ec82-483f-9084-8803566055a2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
Step (8) Starting and running the Dogecoin Node
Unfortunately this guide has an extra step, it's simple, but I'll explain why. Dogecoin is an odd one. When we autoboot it creates folders inside /home/pi/DogecoinData called chainstate and blocks. For some reason (and this is the only install I've ever done that does this) is makes those folders only accessible to those with root permissions! Not for us as a pi user.
But a simple fix is at hand
First we edit
sudo nano /etc/rc.local
and add
/usr/local/bin/dogecoind -datadir=/home/pi/DogecoinData -daemon &
To the bottom, but ABOVE 'exit 0'. The & is also very important. Just like a normal node build.
Save, exit, as always then
sudo reboot
The node will try to run, and create the two folders I mentioned with root permissions. We then change those permissions with the command
sudo chown -hR pi /home/pi/DogecoinData
To get this to run I had to repeat this step. Changing the owner once with the line above allowed the node to write some files (which it made as root user again) so we repeat.
sudo reboot
sudo chown -hR pi /home/pi/DogecoinData
And then one final sudo reboot to get it going! (Now it should work) It's annoying and I'll look into a permanent solution.
Once booted that should be it! To verify it's working use
dogecoin-cli -datadir=/home/pi/DogecoinData 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.
This is the tedious bit. It has to download a lot of blocks and verify every transaction within it. That's a big ask for a little raspberry pi! It handles it fine though. 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.
Latest Update 25th June 2017
Step 1 Preparing the Pi
Because all the preparation steps are the same for all Dogecoin 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
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"
}
save and exit using
ctrl+O
Then 'enter'
ctrl+X
sudo reboot
remove Ethernet cable
Step (3) Expand the file system, (making full use of the SD card)
sudo raspi-config
select "advanced options"
select "expand filesystem"
select 'finish' system will reboot
log back in via ssh
check file system expanded by using command below (the -h flag means human readable, showing size in 'G' gigabytes, 'M' megabytes, etc)
df -h
Step (4) Updates
sudo apt-get update
sudo apt-get upgrade
select 'y' to accept the storage requirement.
Step (5) Installing Dogecoin
We start with
sudo apt-get install git
mkdir ~/DogecoinData
then enlarge the swapfile so the blockchain loads quicker
sudo nano /etc/dphys-swapfile
And change the default size of 100
CONF_SWAPSIZE=100
To 1000
CONF_SWAPSIZE=1000
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 Dogecoin:
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
Download Dogecoin core
git clone https://github.com/dogecoin/dogecoin.git
Begin the install
cd dogecoin
./autogen.sh
./configure --enable-upnp-default --disable-wallet
make -j2
**Note** It has been recommended to use 'make -j2' as the command as it is quicker than just 'make'. The -j2 tells the pi how many of it's processor cores to build with. The higher the number the faster it builds. In theory up to -j4 is possible but not recommended. If you encounter errors just run 'make' instead.
Then
sudo make install
then we configure the node.
sudo nano /home/pi/DogecoinData/dogecoin.conf
and add to it
rpcuser=<yourdogecoinrpcuser>
rpcpassword=<yourpasswordhere>
save, exit, ctrl+o ctrl+x
Step (6) Security
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
Also in
sudo raspi-config
and follow the top menu option to change the user password to something other than the default of "raspberry"
I will update as I'm informed of other issues.
Step (7) 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.
***Note for future*** This section which guides you through the moving of the entire filesystem is here because we have installed everything, and the next step is to run the node. The helper in this step copies (rather than moves) everything to the USB drive and then points the boot section of the SD card to the USB drive on power-on. In theory this means that if your USB drive ever fails, there is a copy of the entire installation (minus the blockchain) held on the SD card un-used. On a PC open the first partition on the SD card and edit cmdline.txt Then simply relace
root=PARTUUID=<randonnumbers>
with
root=/dev/mmcblk0p2
this will point the root partition back to the second partition on your SD card. Then simply insert a new USB drive, repeat the rest of this step (7) and continue to the final step (8) and your node will start again without having to go through the entire install. It may help someone one day I hope.***End Note***
Insert the USB drive if you haven't already, then check it is mounted to the Pi.
cd
sudo lsblk
99% of the time it will be mounted as /dev/sda with a partition called 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.
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 this:
DEVNAME=/dev/sda1
LABEL=rootfs
UUID=39a737fd-0cb2-4365-b46a-3dd8fe8dacf8
TYPE=ext4
PARTLABEL=primary
PARTUUID=5d23b969-ec82-483f-9084-8803566055a2
This is our drives labels and addresses. We need to check that the PARTUUID of the sda1 (that's the USB), is entered into
sudo nano /boot/cmdline.txt
This one is unchanged, and you can see the PARTUUID for this node is INCORRECT as it doesn't match that I have listed above.
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=1d6e3b54-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
Change it so that the PARTUUID that you have listed above is entered. You will have different numbers but in my case I made it look like this:
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=5d23b969-ec82-483f-9084-8803566055a2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
Step (8) Starting and running the Dogecoin Node
Unfortunately this guide has an extra step, it's simple, but I'll explain why. Dogecoin is an odd one. When we autoboot it creates folders inside /home/pi/DogecoinData called chainstate and blocks. For some reason (and this is the only install I've ever done that does this) is makes those folders only accessible to those with root permissions! Not for us as a pi user.
But a simple fix is at hand
First we edit
sudo nano /etc/rc.local
and add
/usr/local/bin/dogecoind -datadir=/home/pi/DogecoinData -daemon &
To the bottom, but ABOVE 'exit 0'. The & is also very important. Just like a normal node build.
Save, exit, as always then
sudo reboot
The node will try to run, and create the two folders I mentioned with root permissions. We then change those permissions with the command
sudo chown -hR pi /home/pi/DogecoinData
To get this to run I had to repeat this step. Changing the owner once with the line above allowed the node to write some files (which it made as root user again) so we repeat.
sudo reboot
sudo chown -hR pi /home/pi/DogecoinData
And then one final sudo reboot to get it going! (Now it should work) It's annoying and I'll look into a permanent solution.
Once booted that should be it! To verify it's working use
dogecoin-cli -datadir=/home/pi/DogecoinData 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.
This is the tedious bit. It has to download a lot of blocks and verify every transaction within it. That's a big ask for a little raspberry pi! It handles it fine though. 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.