Introduction
When setting up a bitcoin node on a raspberry pi, there are a couple of choices to make in regards to the resources available to you. The first thing to consider is whether to run a full node or a pruning node. A full node downloads the entire blockchain, while a pruning node will only download the latest part of the blockchain. If you choose to run a full node, there is the option to store the blockchain on an external storage unit (as micro sd cards can get expensive).
This tutorial assumes that you have a working pi with raspbian installed. If you don't already have one, you can buy it here:
https://app.purse.io/product/B01C6EQNNK
. . .micro sd cards:
https://app.purse.io/product/B00V62XBQQ
https://www.amazon.com/SanDisk-microSDH ... b+micro+sd
. . .And installing raspbian:
https://vimeo.com/90518800
Setting up you pi
Before you compile the code, set up remote ssh with your pi and increase the swapfile (more memory). This makes the compiling more doable for your pi.
This tutorial below explains how:
http://raspnode.com/diyBitcoin.html
There are two ways to install the software. You can either compile the source code directly, or download the arm build from the Bitcoin Unlimited website. I will explain below how to do it from each of these methods. I have found compiling the source code to be a more slow and reliable way of installation. The choice is up to you.
>Method 1<
Compile the code
To compile the code, you will need to install the necessary dependencies, and clone the source code from github into your home folder. Be patient as it may take a few hours to compile the source code.
Install dependencies
sudo apt-get update sudo apt-get install git build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils libboost-all-devCloning the source code
mkdir -p ~/src cd ~/src git clone https://github.com/BitcoinUnlimited/BitcoinUnlimited.git bu-src cd bu-srcCompile
./autogen.sh LIBS="-lboost_atomic" ./configure --enable-upnp-default --disable-wallet make sudo make install>Method 2<
Note: If you have already followed the steps in method 1, skip ahead to the 'Setting up your node' section
Install the pre-compiled package from bitcoinunlimited.info
The Raspberry Pi 3 uses a 32bit processor. Some boards like the pine have a 64bit architecture.
Use the terminal to download the latest build.
Note: The actual url may be different then the one shown below because of future releases.
mkdir ~/downloads/ cd ~/downloads wget https://www.bitcoinunlimited.info/downloads/bitcoinUnlimited-1.0.0-arm32.tar.gzVerify your download by pasting the checksum from the website on the command line and use the following format:
echo 6bb4489c74d0d295741e7c9f3cbd95dbfc54ae7ae29ca8badbc413f14fd587ef bitcoinUnlimited-1.0.0-arm32.tar.gz | sha256sum -cIf the checksum the actual file, proceed on and extract the archive.
tar xf bitcoinUnlimited-1.0.0-arm32.tar.gz cd bitcoinUnlimited-1.0.0Now the executables inside the archive need to be moved inside /usr/local/bin in order to run properly.
mkdir -p /usr/local/bin mv ./bin/bitcoind /usr/local/bin/bitcoind mv ./bin/bitcoin-cli /usr/local/bin/bitcoin-cli mv ./bin/bitcoin-tx /usr/local/bin/bitcoin-tx mv ./bin/test-bitcoin /usr/local/bin/test-bitcoin chmod 755 /usr/local/bin/bitcoind /usr/local/bin/bitcoin-cli /usr/local/bin/bitcoin-tx /usr/local/bin/test-bitcoinAlso, the Include files will need to be moved to /usr/local/include
mkdir -p /usr/local/include mv ./include/bitcoinconsensus.h /usr/local/include/bitcoinconsensus.h chmod 644 /usr/local/include/bitcoinconsensus.hFinish the installation by moving the library files to /usr/local/lib
mkdir -p /usr/local/lib mv ./lib/libbitcoinconsensus.so /usr/local/lib/libbitcoinconsensus.so mv ./lib/libbitcoinconsensus.so.0 /usr/local/lib/libbitcoinconsensus.so.0 mv ./lib/libbitcoinconsensus.so.0.0.0 /usr/local/lib/libbitcoinconsensus.so.0.0.0 chmod 644 /usr/local/lib/libbitcoinconsensus.so /usr/local/lib/libbitcoinconsensus.so.0 /usr/local/lib/libbitcoinconsensus.so.0.0.0Alright, you're done with the installation! You can purge your download folder if you'd like and move on to starting/setting up your node.
Setting up your node
Starting your node
bitcoind -daemonThis process runs completely in the background.
Stopping your node
bitcoin-cli stop
(Optional)
Custom Configurations
Like I mentioned earlier, If you want to run a pruning node where only part of the blockchain is downloaded, or if you want to store the blockchain on an external drive, you can do so by adding a few simple lines to your bitcoin.conf file. Because this is Bitcoin Unlimited, you can also set rules for the size of blocks for your node to accept.
Opening bitcoin.conf
nano .bitcoin/bitcoin.confHere is a sample setup for bitcoin.conf:
Set up pruning
prune=<n>(in megabytes)
Storing the blockchain on an external drive
datadir=<n>(Enter the location of your External Hard Drive)
Signaling for bigger blocks
excessiveblocksize=<n>(in bytes. For example, if you want 4mb, write in 4000000)
excessiveacceptdepth=<n>(this number is how many previous blocks with that size are required to have been accepted on the blocksize in order for your node to accept them. This is to keep mining from becoming centralized.)
________________________________________________________________________________________________________________________
Special thanks to user justaph, who helped me out in /r/bitcoin_unlimited . Without the help I received, this tutorial would not have been possible.