<p dir="auto">I started to make this small project motivated by few things which happened last time in Bitcoin world. People argue with me that Raspberry Pi 2 is not capable to host Bitcoin node anymore because of Core’s software high hardware requirements. However it was executable in the past. What was changed is the blocks are fully filled to 1MB right now. There are also new features implemented by Bitcoin Core in last years few years. I have to agree all that made setup of independent node a little harder, but not impossible.<br />
We are near 6 weeks before SegWit activation. It is perfect time to show Your vote if we want new feature to be activated or not. I won’t convince anyone here to do so. It is all Your choice. To be honest I am very interested in the way how SegWit things will happen.
<p dir="auto">I treat this project as my little challenge. What I wanted to achieve:
<ul>
<li>setup light Bitcoin node (pruned to 550MB) on Raspberry Pi 2 with success
<li>assemble 3D printed custom case to make minicomputer pretty attractive
<li>setup 3,5 inch TFT display with small info
<li>do not spend more than $100 on parts
<p dir="auto">This is a story how all things got connected together by me.
<h1>Parts
<div class="table-responsive"><table>
<thead>
<tr><th><span><img src="https://images.hive.blog/768x0/https://cdn.shopify.com/s/files/1/0176/3274/products/rpi2b_1024x1024.jpg?v=1477646083" srcset="https://images.hive.blog/768x0/https://cdn.shopify.com/s/files/1/0176/3274/products/rpi2b_1024x1024.jpg?v=1477646083 1x, https://images.hive.blog/1536x0/https://cdn.shopify.com/s/files/1/0176/3274/products/rpi2b_1024x1024.jpg?v=1477646083 2x" /><th><span>Raspberry Pi 2 Model B £20.00 = $25.20 <a href="https://thepihut.com/collections/raspberry-pi/products/clearance-raspberry-pi-2-model-b?variant=18198528708" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">https://thepihut.com/collections/raspberry-pi/products/clearance-raspberry-pi-2-model-b?variant=18198528708
<tbody>
<tr><td><span><img src="https://images.hive.blog/768x0/https://cdn.shopify.com/s/files/1/0176/3274/products/raspberry_pi_psu_eu_1024x1024.jpg?v=1477646170" srcset="https://images.hive.blog/768x0/https://cdn.shopify.com/s/files/1/0176/3274/products/raspberry_pi_psu_eu_1024x1024.jpg?v=1477646170 1x, https://images.hive.blog/1536x0/https://cdn.shopify.com/s/files/1/0176/3274/products/raspberry_pi_psu_eu_1024x1024.jpg?v=1477646170 2x" /><td><span>EU Micro USB Power Supply for Raspberry Pi £5.00 = $6.30 <a href="https://thepihut.com/collections/raspberry-pi-power-supplies/products/eu-micro-usb-power-supply-for-the-raspberry-pi" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">https://thepihut.com/collections/raspberry-pi-power-supplies/products/eu-micro-usb-power-supply-for-the-raspberry-pi
<tr><td><span><img src="https://images.hive.blog/768x0/https://ae01.alicdn.com/kf/HTB1U2zoQpXXXXcgXpXXq6xXFXXXt/Raspberry-Pi-LCD-Display-Module-3-5inch-320-480-TFT-Resistive-Touch-Screen-Panel-SPI-Interface.jpg_640x640.jpg" srcset="https://images.hive.blog/768x0/https://ae01.alicdn.com/kf/HTB1U2zoQpXXXXcgXpXXq6xXFXXXt/Raspberry-Pi-LCD-Display-Module-3-5inch-320-480-TFT-Resistive-Touch-Screen-Panel-SPI-Interface.jpg_640x640.jpg 1x, https://images.hive.blog/1536x0/https://ae01.alicdn.com/kf/HTB1U2zoQpXXXXcgXpXXq6xXFXXXt/Raspberry-Pi-LCD-Display-Module-3-5inch-320-480-TFT-Resistive-Touch-Screen-Panel-SPI-Interface.jpg_640x640.jpg 2x" /><td><span>3.5inch RPi LCD (A), 320x480 $24.99 <a href="http://www.waveshare.com/product/3.5inch-rpi-lcd-a.htm" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">http://www.waveshare.com/product/3.5inch-rpi-lcd-a.htm
<tr><td><span><img src="https://images.hive.blog/768x0/https://cdn.shopify.com/s/files/1/0176/3274/products/100040_grande_eb1c723c-a009-4bb9-b59a-76fad17c17ee_1024x1024.jpg?v=1488490685" srcset="https://images.hive.blog/768x0/https://cdn.shopify.com/s/files/1/0176/3274/products/100040_grande_eb1c723c-a009-4bb9-b59a-76fad17c17ee_1024x1024.jpg?v=1488490685 1x, https://images.hive.blog/1536x0/https://cdn.shopify.com/s/files/1/0176/3274/products/100040_grande_eb1c723c-a009-4bb9-b59a-76fad17c17ee_1024x1024.jpg?v=1488490685 2x" /><td><span>16GB Sandisk Ultra Class 10 Micro SD card £9.00 = $11.34 <a href="https://thepihut.com/collections/raspberry-pi-sd-cards-and-adapters/products/noobs-preinstalled-sd-card" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">https://thepihut.com/collections/raspberry-pi-sd-cards-and-adapters/products/noobs-preinstalled-sd-card
<tr><td><span><img src="https://images.hive.blog/768x0/https://cdn.shopify.com/s/files/1/0176/3274/products/wifi_1024x1024.jpg?v=1477646172" srcset="https://images.hive.blog/768x0/https://cdn.shopify.com/s/files/1/0176/3274/products/wifi_1024x1024.jpg?v=1477646172 1x, https://images.hive.blog/1536x0/https://cdn.shopify.com/s/files/1/0176/3274/products/wifi_1024x1024.jpg?v=1477646172 2x" /><td><span>USB Wifi Adapter for the Raspberry Pi £6.00 = $7.56 <a href="https://thepihut.com/products/usb-wifi-adapter-for-the-raspberry-pi" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">https://thepihut.com/products/usb-wifi-adapter-for-the-raspberry-pi
<tr><td><span><img src="https://images.hive.blog/768x0/https://thingiverse-production-new.s3.amazonaws.com/renders/b4/31/2e/54/c5/assembly2_preview_featured.jpg" srcset="https://images.hive.blog/768x0/https://thingiverse-production-new.s3.amazonaws.com/renders/b4/31/2e/54/c5/assembly2_preview_featured.jpg 1x, https://images.hive.blog/1536x0/https://thingiverse-production-new.s3.amazonaws.com/renders/b4/31/2e/54/c5/assembly2_preview_featured.jpg 2x" /><td><span>Raspberry Pi Display Case $16 <a href="https://www.thingiverse.com/thing:1229473" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">https://www.thingiverse.com/thing:1229473
<p dir="auto">£1 = $1.26<br />
Total amount: $91.39
<h1>Assembly
<p dir="auto">While connecting Raspberry Pi to power is trivial I wanted to achieve more. Headless minicomputer is too ugly for me. I decided to 3D print one of the projects from thingiverse.com community. The case I found turned out to match perfectly with the rest of my parts. Small company in my town printed it for me for about $16. The quality of the parts aren't the best but pretty decent. I am okay with that.
<div class="table-responsive"><table>
<thead>
<tr><th><span><img src="https://images.hive.blog/768x0/https://thingiverse-production-new.s3.amazonaws.com/renders/b4/31/2e/54/c5/assembly2_preview_featured.jpg" srcset="https://images.hive.blog/768x0/https://thingiverse-production-new.s3.amazonaws.com/renders/b4/31/2e/54/c5/assembly2_preview_featured.jpg 1x, https://images.hive.blog/1536x0/https://thingiverse-production-new.s3.amazonaws.com/renders/b4/31/2e/54/c5/assembly2_preview_featured.jpg 2x" /><th><span><img src="https://images.hive.blog/768x0/https://thingiverse-production-new.s3.amazonaws.com/renders/23/b1/b2/93/27/d88cf5ac09899117f836bdeb7106a1bd_preview_featured.JPG" srcset="https://images.hive.blog/768x0/https://thingiverse-production-new.s3.amazonaws.com/renders/23/b1/b2/93/27/d88cf5ac09899117f836bdeb7106a1bd_preview_featured.JPG 1x, https://images.hive.blog/1536x0/https://thingiverse-production-new.s3.amazonaws.com/renders/23/b1/b2/93/27/d88cf5ac09899117f836bdeb7106a1bd_preview_featured.JPG 2x" />
<tbody>
<p dir="auto">Project visualization and author's photo
<p dir="auto">Connecting parts together:<br />
<center><img src="https://images.hive.blog/768x0/https://steemitimages.com/DQmSgQHicR3dtuYMBpP3u7Q4CnTBcKomJJtn564nCQjzS3c/DSC_0018.JPG" alt="DSC_0018.JPG" srcset="https://images.hive.blog/768x0/https://steemitimages.com/DQmSgQHicR3dtuYMBpP3u7Q4CnTBcKomJJtn564nCQjzS3c/DSC_0018.JPG 1x, https://images.hive.blog/1536x0/https://steemitimages.com/DQmSgQHicR3dtuYMBpP3u7Q4CnTBcKomJJtn564nCQjzS3c/DSC_0018.JPG 2x" />
<div class="table-responsive"><table>
<thead>
<tr><th><img src="https://images.hive.blog/768x0/https://steemitimages.com/DQmcJmyg1v8HaMopAXDohZ7HQwGSmFAW3mQ9ppcv6qHozdk/DSC_0021.JPG" alt="DSC_0021.JPG" srcset="https://images.hive.blog/768x0/https://steemitimages.com/DQmcJmyg1v8HaMopAXDohZ7HQwGSmFAW3mQ9ppcv6qHozdk/DSC_0021.JPG 1x, https://images.hive.blog/1536x0/https://steemitimages.com/DQmcJmyg1v8HaMopAXDohZ7HQwGSmFAW3mQ9ppcv6qHozdk/DSC_0021.JPG 2x" /><th><img src="https://images.hive.blog/768x0/https://steemitimages.com/DQmNcKqKQ5Rn8KyH854QRa9CA2FYGAX4JQMbehWFTGoLtNu/DSC_0025.JPG" alt="DSC_0025.JPG" srcset="https://images.hive.blog/768x0/https://steemitimages.com/DQmNcKqKQ5Rn8KyH854QRa9CA2FYGAX4JQMbehWFTGoLtNu/DSC_0025.JPG 1x, https://images.hive.blog/1536x0/https://steemitimages.com/DQmNcKqKQ5Rn8KyH854QRa9CA2FYGAX4JQMbehWFTGoLtNu/DSC_0025.JPG 2x" />
<tbody>
<tr><td><img src="https://images.hive.blog/768x0/https://steemitimages.com/DQmcC3oUCiBDgbVfpYBN4t6RZj4FmP7iBro3B5naJjBYkBD/DSC_0030.JPG" alt="DSC_0030.JPG" srcset="https://images.hive.blog/768x0/https://steemitimages.com/DQmcC3oUCiBDgbVfpYBN4t6RZj4FmP7iBro3B5naJjBYkBD/DSC_0030.JPG 1x, https://images.hive.blog/1536x0/https://steemitimages.com/DQmcC3oUCiBDgbVfpYBN4t6RZj4FmP7iBro3B5naJjBYkBD/DSC_0030.JPG 2x" /><td><img src="https://images.hive.blog/768x0/https://steemitimages.com/DQmXq8e1FQ5zhugjWFuNxPkupp8AQdba6ZY2hNb5yDXeqe9/DSC_0039.JPG" alt="DSC_0039.JPG" srcset="https://images.hive.blog/768x0/https://steemitimages.com/DQmXq8e1FQ5zhugjWFuNxPkupp8AQdba6ZY2hNb5yDXeqe9/DSC_0039.JPG 1x, https://images.hive.blog/1536x0/https://steemitimages.com/DQmXq8e1FQ5zhugjWFuNxPkupp8AQdba6ZY2hNb5yDXeqe9/DSC_0039.JPG 2x" />
<p dir="auto">Looks beautiful and neat :)
<h1>Operating system
<p dir="auto">Here comes the coding thing. I have decided to install default Raspbian Jessie image with PIXEL desktop. It is official Raspberry Pi operating system. Just download and write that onto SD card.
<p dir="auto"><center><img src="https://images.hive.blog/768x0/https://steemitimages.com/DQmRUSULynzrJzoaDe5bPmEk543nVmFohtmsdNgujonhE4V/jessie.png" alt="jessie.png" srcset="https://images.hive.blog/768x0/https://steemitimages.com/DQmRUSULynzrJzoaDe5bPmEk543nVmFohtmsdNgujonhE4V/jessie.png 1x, https://images.hive.blog/1536x0/https://steemitimages.com/DQmRUSULynzrJzoaDe5bPmEk543nVmFohtmsdNgujonhE4V/jessie.png 2x" />
<p dir="auto">After configuring basic settings like WiFi connection, hostname and local settings, it's time to launch display screen.<br />
I remember how difficult was to properly configure this display on Raspberry Pi. The drivers juggle was a madness. Luckily newest waveshare drivers made that very easy process for me. It all came to type just few commands.
<pre><code>> wget http://www.waveshare.com/w/upload/7/74/LCD-show-170309.tar.gz
> tar xvf LCD-show-*.tar.gz
> cd LCD-show/
> chmod +x LCD35-show
> sudo ./LCD35-show
<p dir="auto">Then reboot
<p dir="auto"><center><img src="https://images.hive.blog/768x0/https://steemitimages.com/DQmaZcrKsmPkzqfUy7sTi1y3q8cVvQCpet24cZmU25W5rSN/DSC_0054.JPG" alt="DSC_0054.JPG" srcset="https://images.hive.blog/768x0/https://steemitimages.com/DQmaZcrKsmPkzqfUy7sTi1y3q8cVvQCpet24cZmU25W5rSN/DSC_0054.JPG 1x, https://images.hive.blog/1536x0/https://steemitimages.com/DQmaZcrKsmPkzqfUy7sTi1y3q8cVvQCpet24cZmU25W5rSN/DSC_0054.JPG 2x" />
<p dir="auto"><span>It works :) Next step was to display something prettier than just console terminal. Redditors recommend <a href="http://www.realtimebitcoin.info/" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">http://www.realtimebitcoin.info/ as simple widget for small screens. I think this is the best choice for my display. For this I had to configure light desktop GUI where I could display realtimebitcoin.info site. Set it in fullscreen POS style for best utility.
<pre><code>> sudo apt-get install --no-install-recommends xserver-xorg
> sudo apt-get install --no-install-recommends xinit xserver-xorg-video-fbdev
> sudo apt-get install lxde-core lxappearance
> sudo apt-get install lightdm
> sudo apt-get install --no-install-recommends matchbox chromium-browser
<p dir="auto">Plus 3,5inch rescaling:
<pre><code>> sudo nano /usr/share/X11/xorg.conf.d/99-fbdev.conf
Section "Device"
Identifier "touchscreen"
Driver "fbdev"
Option "fbdev" "/dev/fb1"
EndSection
<p dir="auto"><span>And finally set the kiosk mode directing to <a href="http://www.realtimebitcoin.info" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">http://www.realtimebitcoin.info:
<pre><code>> sudo nano ~/.config/lxsession/LXDE/autostart
@lxpanel --profile LXDE
@pcmanfm --desktop --profile LXDE
@xscreensaver -no-splash
@chromium-browser --kiosk --incognito http://www.realtimebitcoin.info/
<p dir="auto">Just to hide weird mouse cursor:
<pre><code>> sudo apt-get install unclutter
<p dir="auto"><center><img src="https://images.hive.blog/768x0/https://steemitimages.com/DQmSfsy2ASR6JaCWPGe4SyTnDNJiJEaXN7ULDwq5NCBVkDc/DSC_0037.JPG" alt="DSC_0037.JPG" srcset="https://images.hive.blog/768x0/https://steemitimages.com/DQmSfsy2ASR6JaCWPGe4SyTnDNJiJEaXN7ULDwq5NCBVkDc/DSC_0037.JPG 1x, https://images.hive.blog/1536x0/https://steemitimages.com/DQmSfsy2ASR6JaCWPGe4SyTnDNJiJEaXN7ULDwq5NCBVkDc/DSC_0037.JPG 2x" /><br />
Result after reboot. Beautiful :)
<h1>Bitcoin node
<p dir="auto">I don't wanted to run full Bitcoin node. Pruning to 550MB is enough to be light node. It synchronizes with full blockchain and checks every block for theirs compatibility but saves only last 550MB of blockchain on the disk. This is what I wanted to achieve.<br />
I had some issues in the middle of compiling the sources of Bitcoin Core application. According to Core, it is recommended to have at least 1,5GB of memory available. The problem is my Raspberry Pi has only 1GB. I had to resize the swap dynamic memory and compile c++ code with additional parameters. It made compilation very slow and took few hours, but ended without errors.
<p dir="auto">Install all the packages needed for Bitcoin Core:
<pre><code>> sudo apt-get install autoconf libevent-dev libtool libssl-dev libboost-all-dev libminiupnpc-dev -y
<p dir="auto">Clone most recent repository:
<pre><code>> git clone -b 0.14 https://github.com/bitcoin/bitcoin.git
<p dir="auto">Extend swap from 100MB to 1GB!
<pre><code>> sudo sed -i '16s/.*/CONF_SWAPSIZE=1024/g' /etc/dphys-swapfile
> sudo dphys-swapfile setup
> sudo dphys-swapfile swapon
<p dir="auto">Compile and install
<pre><code>> cd bitcoin
> ./autogen.sh
> ./configure --enable-upnp-default --disable-wallet CXXFLAGS="--param ggc-min-expand=1 --param ggc-min-heapsize=32768"
> time make
real **354m**40.952s
user 348m8.710s
sys 5m28.990s
> sudo make install
<p dir="auto">As You see, it was needed to configure with specific parameters. The most crucial one was heapsize=32768, which changed memory used while compiling from 1,5GB down to 500MB! The downside of this solution was the compiling time which took 6 hours...
<h1>Blockchain synchronization
<p dir="auto">Before run of bitcoin client I had to set configuration options in bitcoin.conf file. I decided that my Bitcoin node will be pruned to 550MB and it will signal UASF-SegWit-BIP148 proposal. This is optional and only my preference.
<pre><code>> nano /home/pi/bitcoinData/bitcoin.conf
prune=550
uacomment=UASF-SegWit-BIP148
<p dir="auto">Run bitcoind client as a daemon:
<pre><code>> bitcoind -datadir=/home/pi/bitcoinData -daemon
<p dir="auto">We can see all the data through the bitcoin-cli command:
<pre><code>> bitcoin-cli -datadir=/home/pi/bitcoinData getinfo
{
"version": 140100,
"protocolversion": 70015,
"blocks": 365029,
"timeoffset": 0,
"connections": 0,
"proxy": "",
"difficulty": 51076366303.48193,
"testnet": false,
"relayfee": 0.00001000,
"errors": ""
}
<p dir="auto">However I was monitoring the status of synchronized blocks in real time through command:
<pre><code>> watch bitcoin-cli -datadir=/home/pi/bitcoinData getblockcount
Every 2.0s: bitcoin-cli -datadir=/home/pi/bitcoinDa... Tue Jun 13 22:14:42 2017
368160
<p dir="auto">I started downloading blockchain about 2 weeks ago. Right now I have synchronized about 75% of blockchain. I do keep my fingers crossed to make it finish before 1st of August.
<p dir="auto"><center><img src="https://images.hive.blog/768x0/https://steemitimages.com/DQmVknWAqW8BvvKEjSrjwq2yAqQuUKNSeuU24nVD6HTCdoo/bitnode.png" alt="bitnode.png" srcset="https://images.hive.blog/768x0/https://steemitimages.com/DQmVknWAqW8BvvKEjSrjwq2yAqQuUKNSeuU24nVD6HTCdoo/bitnode.png 1x, https://images.hive.blog/1536x0/https://steemitimages.com/DQmVknWAqW8BvvKEjSrjwq2yAqQuUKNSeuU24nVD6HTCdoo/bitnode.png 2x" />
<blockquote>
<p dir="auto"><span>75 percent confirmed by the network <a href="https://bitnodes.21.co" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">https://bitnodes.21.co
<p dir="auto"><center><img src="https://images.hive.blog/768x0/https://steemitimages.com/DQmZWRzVAe9qzhrWvgTa18mNg9iwzUCFkLBi4wqehxpjfeP/rpi.png" alt="rpi.png" srcset="https://images.hive.blog/768x0/https://steemitimages.com/DQmZWRzVAe9qzhrWvgTa18mNg9iwzUCFkLBi4wqehxpjfeP/rpi.png 1x, https://images.hive.blog/1536x0/https://steemitimages.com/DQmZWRzVAe9qzhrWvgTa18mNg9iwzUCFkLBi4wqehxpjfeP/rpi.png 2x" />
<blockquote>
<p dir="auto">htop monitor
<h1>Links
<p dir="auto"><br /><br /><br /><br />
<br /><span><a href="https://www.raspberrypi.org/downloads/raspbian/" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">https://www.raspberrypi.org/downloads/raspbian/<span>
<a href="http://www.waveshare.com/wiki/3.5inch_RPi_LCD_" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">http://www.waveshare.com/wiki/3.5inch_RPi_LCD_(A)<span>
<a href="https://github.com/bitcoin/bitcoin/blob/master/doc/build-unix.md" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">https://github.com/bitcoin/bitcoin/blob/master/doc/build-unix.md<span>
<a href="https://github.com/bitcoin/bitcoin/issues/6658#issuecomment-174396998" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">https://github.com/bitcoin/bitcoin/issues/6658#issuecomment-174396998<span>
<a href="https://bitnodes.21.co" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">https://bitnodes.21.co
Cool stuff!
A load average of 2 seems like it's a little too much for the poor thing tho :D
Cool project! I was gonna offer my 3d printing services, but $16 is a great deal for that. I wonder if a pi 3 would be much better?
RPI 3 is definitely much easier to configure bitcoin core and faster to synchronize blocks. Many people build nodes based on rpi3 without any problems.
The challenge was to use old rpi2 :)
I like it, I was thinking about doing similar node, hovewer my internet connecion is to weak currently;/
I have technical question: is there any available power to run other services on this rpi, or it can stand just a node?
It all depends what are the other services. You can save some CPU power by disabling Desktop GUI and keep console terminal screen. The www animations from www.realtimebitcoin.info takes so much power tho :/ The blocks synchronize much faster when I turn the screen off.
You can host simple SAMBA server together which doesn't take any CPU usage or other light services You like.
Great project for pi 2/3 - Excellent info. Looking forward to giving this a try.
Interesting how much the sd card can withstand. Sd card does not like big swap. Nice "pi box" ;)
I think I should do backup of pruned blockchain soon. Just in case the SD card breaks down :\
Cool. Cool cool cool.