· 8 years ago · Apr 24, 2018, 01:16 AM
1# Raspberry Pi 3 B/B+ Vertcoin Full Node Installation Guide for Windows
2
3`* anything marked with an asterisk is an optional step`
4
5#### Why a Vertcoin Full node?
6>Vertcoin is a digital currency supported by a peer-to-peer network. In order to run efficiently and effectively, it needs peers run by different people... and the more the better. [1]
7
8>This tutorial will describe how to create a Vertcoin “full node†(a Vertcoin server that contains the full blockchain and propagates transactions throughout the Vertcoin network via peers). This system will not mine for Vertcoins... it will play its part to keep the Vertcoin peer-to-peer network healthy and strong. For a detailed explanation for why it is important to have a healthy Vertcoin peer-to-peer network, read this [article](https://medium.com/@lopp/bitcoin-nodes-how-many-is-enough-9b8e8f6fd2cf) about Bitcoin full nodes.
9
10>Also please note this will be a “headless†server... meaning we will not be using a GUI to configure Vertcoin or check to see how things are running. In fact, once the server is set up, you will only interact with it using command line calls over SSH. The idea is to have this full node be simple, low-power, and something that “just runs†in your basement, closet, etc.
11
12#### Why a Raspberry Pi?
13>Raspberry Pi is an inexpensive computing hardware platform that generates little heat, draws little power, and can run silently 24 hours a day without having to think about it. [1]
14
15## Table of Contents
161. Parts List
172. *Download and sync Vertcoin Core
183. Format USB Flash Drive
194. Install Raspbian Stretch Lite
205. Copy Blockchain to USB Flash Drive
216. Setup Raspberry Pi
227. Setup USB Flash Drive and Auto-Mount
238. Create vertcoin.conf and soft link to USB Flash Drive
249. Configure firewall to allow Vertcoin Core traffic
2510. Congratulations! Your Vertcoin node is up and running
26
27
28
29### 1.) Parts List
30
31| Parts | Price | Link |
32|--------------------------------------------------------------|------------|---------------------------------------------------------------------------------|
33| CanaKit Raspberry Pi 3 B+ | $49.99 USD | https://www.amazon.com/CanaKit-Raspberry-Power-Supply-Listed/dp/B07BC6WH7V/ |
34| Samsung 32GB 95MB/s (U1) MicroSD EVO Select Memory Card | $12.99 USD | https://www.amazon.com/Samsung-MicroSD-Adapter-MB-ME32GA-AM/dp/B06XWN9Q99/ |
35| SanDisk Ultra Fit 128GB USB 3.0 Flash Drive | $27.49 USD | https://www.amazon.com/SanDisk-Ultra-128GB-Flash-Drive/dp/B01BGTG2A0/ |
36| Transcend USB 3.0 SDHC / SDXC / microSDHC / SDXC Card Reader | $9.23 USD | https://www.amazon.com/Transcend-microSDHC-Reader-TS-RDF5K-Black/dp/B009D79VH4/ |
37| *OPTIONAL: Zebra Black Ice Case for Raspberry Pi by C4Labs | $14.95 USD | https://www.amazon.com/Zebra-Black-Case-Raspberry-C4labs/dp/B00M6G9YBM/ |
38
39
40You may change the USB Flash Drive to match your preference. I highly recommend that a USB Flash Drive (16GB - 128GB) or an External Hard Drive is paired with the Raspberry Pi.
41
42The case in the parts list is a personal preference, it is your choice how you wish to protect your Raspberry Pi. The Zebra Black Ice case was chosen for its cut out on the bottom of the case, allowing for the placement of a heatsink on the RAM of the Raspberry Pi.
43
44
45
46## 2.) Download and sync Vertcoin Core
47
48This step is optional but recommended. [Download](https://github.com/vertcoin-project/vertcoin-core/releases) the latest stable release of Vertcoin Core and launch `vertcoin-qt.exe` to begin the syncing process. I use my desktop PC to sync the blockchain first because it has better specs than a $35 Raspberry Pi. The PC will sync headers, download blocks and verify blocks faster than the Raspberry Pi can.
49
50We will use this copy of the blockchain that is syncing to side-load onto our Raspberry Pi later.
51
52`Vertcoin Core Download Link: https://github.com/vertcoin-project/vertcoin-core/releases`
53`Default Windows Directory (Vertcoin): C:\Users\%USER%\AppData\Roaming\Vertcoin`
54
55
56
57
58## 3.) Format USB Flash Drive
59
60>The Vertcoin blockchain is about 4GB today (4/23/2018) which means that a 16GB USB Flash Drive will have more than enough space to store everything we need, but you can easily future proof with a 128GB USB Flash Drive.
61
62Insert the USB Flash Drive into your Windows PC. Access the drive with Windows Explorer (Win+E). Right click on the removable drive you wish to format and `Format...`
63
64Format the USB Flash Drive to an `NTFS` File system.
65
66This USB Flash Drive will contain our Vertcoin data directory as well as our swap space file. We will give the Raspberry Pi some extra memory to work with we will ensure a swap file large enough to handle the memory demand to bootstrap the blockchain.
67
68It is worth mentioning that constantly writing data to the MicroSD card can be damaging, in this guide we will configure the swap file to reside off of the MicroSD card.
69
70
71
72## 4.) Install Raspbian Stretch Lite
73
74I recommend downloading the latest stable version of [Raspbian Stretch Lite](https://www.raspberrypi.org/downloads/raspbian/).
75
76We will utilize the software 'Win32 Disk Imager' to format and install Raspbian on the MicroSD card. Please follow the [guide](https://www.raspberrypi.org/documentation/installation/installing-images/windows.md) below for details on installing the Rasbian image to the MicroSD card.
77
78
79`Raspberry Pi - Installing Operating System Images Using Windows: https://www.raspberrypi.org/documentation/installation/installing-images/windows.md`
80
81Once Win32 Disk Imager is finished writing to the MicroSD card please access the 'boot' partition of the MicroSD card with Windows Explorer (Win+E). Create a new empty text file named `ssh` like so...
82
83
84This enables SSH access on the Raspberry Pi's first boot sequence. Please safely remove the USB Card Reader / MicroSD card as to ensure the data is not corrupted.
85
86
87## 5.) Copy Blockchain to USB Flash Drive
88Once Vertcoin Core is finished syncing the blockchain please navigate to the data directory for Vertcoin.
89
90`Default Windows Directory (Vertcoin): C:\Users\%USER%\AppData\Roaming\Vertcoin`
91
92Copy the folders 'blocks' and 'chainstate' to the USB Flash Drive that was formatted as an `NTFS` file system earlier. This will allow us to side-load the Vertcoin blockchain and bootstrap faster than if we had the Raspberry Pi do all the work.
93
94## 6.) Setup Raspberry Pi
95
96Please insert the MicroSD card that was safely removed into the slot located on the bottom of the Raspberry Pi. Connect an Ethernet cable to the Raspberry Pi that has internet access. When you are ready to power on the Pi, plug the power supply in and the Raspberry Pi will immediately begin to boot.
97
98We will access our Raspberry Pi through an SSH session on our Windows PC. I like to use Git Bash which is included in the Windows [download](https://git-scm.com/downloads) of Git.
99
100`Git download link: https://git-scm.com/downloads`
101
102Open a web browser page and navigate to your router page and identify the IP address of the freshly powered on Raspberry Pi. In my case the IP address is `192.168.1.2`, please make note of your Raspberry Pi's IP address as we will need to use it to login via SSH.
103
104Open Git Bash and ...
105`~ $ ssh 192.168.1.2 -l pi`
106`default password: raspberry`
107
108'# Download and install latest system updates
109`pi@raspberrypi:~ $ sudo apt-get update ; sudo apt-get upgrade -y`
110
111
112'# Remove orphaned packages and clean apt
113`pi@raspberrypi:~ $ sudo apt-get autoremove ; sudo apt-get autoclean`
114
115
116'# Initiate `raspi-config` script
117`pi@raspberrypi:~ $ sudo raspi-config`
118
1191. (8) Update
1202. (1) Change User Password
1213. (4) Localization Options > (I2) Change Timezone
1224. (7) Advanced Options > (A1) Expand Filesystem
123
124`<Finish>` and choose to reboot.
125
126'# Wait a minute, then log back in via SSH
127`ssh 192.168.1.2 -l pi`
128
129'# Download and install useful software packages
130`pi@raspberrypi:~ $ sudo apt-get install git ntfs-3g`
131
132#####*OPTIONAL: Disable Wireless and Bluetooth
133`pi@raspberrypi:~ $ cd /etc/modprobe.d/`
134
135'# Create our blacklist file
136`pi@raspberrypi:/etc/modprobe.d $ sudo nano raspi-blacklist.conf`
137
138```
139# disable wireless
140blacklist brcmfmac
141blacklist brcmutil
142
143# disable bluetooth
144blacklist btbcm
145blacklist hci_uart
146```
147ctrl+x to save
148
149'# Reboot Raspberry Pi for changes to take effect
150`pi@raspberrypi:/etc/modprobe.d $ sudo reboot`
151
152'# Wait a minute, then log back in via SSH
153`ssh 192.168.1.2 -l pi`
154
155'# Download latest stable version of vertcoin-core for ARM architecture to Raspberry Pi
156`pi@raspberrypi:~ $ wget https://github.com/vertcoin-project/vertcoin-core/releases/download/0.12.0/vertcoin-v0.12.0-linux-arm.zip`
157
158'# Unzip `vertcoin-v0.12.0-linux-arm.zip`
159```
160pi@raspberrypi:~ $ unzip vertcoin-v0.12.0-linux-arm.zip
161Archive: vertcoin-v0.12.0-linux-arm.zip
162 inflating: vertcoin-cli
163 inflating: vertcoind
164 inflating: vertcoin-tx
165```
166'# Remove `vertcoin-v0.12.0-linux-arm.zip`
167`pi@raspberrypi:~ $ rm *.zip`
168
169'# Move vertcoin-cli, vertcoind, vertcoin-tx to /usr/bin/
170`pi@raspberrypi:~ $ sudo mv vertcoin* /usr/bin/`
171
172
173
174## Setup USB Flash Drive and Auto-Mount
175
176Please insert the USB Flash Drive that contains the folders `blocks` and `chainstate` into the Raspberry Pi. We will mount the USB Flash Drive to the Raspberry Pi and configure the device to auto-mount on reboot ensuring the blockchain stays accessible to the vertcoin daemon after reboot.
177
178'# Find your USB Flash Drive
179```
180pi@raspberrypi:~ $ sudo blkid
181/dev/mmcblk0p1: LABEL="boot" UUID="5DB0-971B" TYPE="vfat" PARTUUID="efbdd15e-01"
182/dev/mmcblk0p2: LABEL="rootfs" UUID="060b57a8-62bd-4d48-a471-0d28466d1fbb" TYPE="ext4" PARTUUID="efbdd15e-02"
183/dev/mmcblk0: PTUUID="efbdd15e" PTTYPE="dos"
184/dev/sda1: UUID="0DC965316518EB7C" TYPE="ntfs" PARTUUID="00e3d476-01"
185```
186My USB device appears as /dev/sda1 which shows a filesystem type of `NTFS`, your device may be listed differently. Please take note of the /dev/* information that identifies your USB Flash Drive.
187
188'# Make sure a mount point exists for the USB Flash Drive
189```
190pi@raspberrypi:~ $ sudo mkdir /mnt
191mkdir: cannot create directory ‘/mnt’: File exists
192```
193'# Give /mnt privileges
194`pi@raspberrypi:~ $ sudo chmod 755 /mnt`
195
196'# Mount USB Flash Drive to mount point
197`pi@raspberrypi:~ $ sudo mount /dev/sda1 /mnt`
198
199'# Confirm USB Flash Drive was successfully mounted to /mnt
200```
201pi@raspberrypi:~ $ ls /mnt/
202blocks chainstate System Volume Information
203```
204'# Setup fstab file to auto-mount the USB Flash Drive on reboot
205```
206pi@raspberrypi:~ $ sudo nano /etc/fstab
207
208proc /proc proc defaults 0 0
209PARTUUID=efbdd15e-01 /boot vfat defaults 0 2
210PARTUUID=efbdd15e-02 / ext4 defaults,noatime 0 1
211
212# replace /dev/sda1 with your USB device, [tab] between each value
213/dev/sda1 /mnt ntfs defaults 0 0
214
215# a swapfile is not a swap partition, no line here
216# use dphys-swapfile swap[on|off] for that
217```
218ctrl+x to save
219
220'# Reboot to confirm auto-mount is successful
221`pi@raspberrypi:~ $ sudo reboot `
222
223'# Wait a minute, then log back in via SSH
224`ssh 192.168.1.2 -l pi`
225
226'# Confirm USB Flash Drive auto-mounted
227```
228pi@raspberrypi:~ $ ls /mnt/
229blocks chainstate System Volume Information
230```
231
232## Create vertcoin.conf and soft link to USB Flash Drive
233
234'# Create vertcoin.conf for Vertcoin Core
235```
236server=1
237rpcuser=node
238rpcpassword=yoursecurepasswordgoeshere
239
240# disable wallet, we only a node son
241disablewallet=1
242
243# makes client run in background
244daemon=1
245
246# lopp.net optimizations
247dbcache=100
248maxorphantx=10
249maxmempool=50
250maxconnections=40
251maxuploadtarget=5000
252```
253ctrl+x to save
254'# *OPTIONAL NOTE: A quick and easy way to generate a random password is taking the md5sum of a file
255```
256pi@raspberrypi:/mnt $ touch rand
257pi@raspberrypi:/mnt $ md5sum rand
258d41d8cd98f00b204e9800998ecf8427e rand
259```
260'# Change directory back home
261```
262pi@raspberrypi:/mnt $ cd
263pi@raspberrypi:~ $ pwd
264/home/pi
265```
266'# Create soft link (symbolic link) connecting /mnt/ <---> /home/pi/.vertcoin
267`pi@raspberrypi:~ $ sudo ln -s /mnt/ /home/pi/.vertcoin`
268
269'# List all files in home
270```
271pi@raspberrypi:~ $ ls -a
272. .. .bash_history .bash_logout .bashrc .config .profile .vertcoin .wget-hsts
273```
274'# Change directory to /home/pi/.vertcoin, confirm blockchain and vertcoin.conf is there
275```
276pi@raspberrypi:~ $ cd .vertcoin ; ls
277blocks chainstate System Volume Information vertcoin.conf
278```
279
280## Create swap file space for Raspberry Pi
281
282Here we ensure that dphys-swapfile is installed and configured to save the swap file in /mnt/swap, allocate 500MB of swap file space, uncomment CONF_SWAPFACTOR and CONF_MAXSWAP lines.
283
284'# Install dphys-swapfile
285```
286pi@raspberrypi:~ $ sudo apt-get install dphys-swapfile
287Reading package lists... Done
288Building dependency tree
289Reading state information... Done
290dphys-swapfile is already the newest version (20100506-3).
2910 upgraded, 0 newly installed, 0 to remove and 15 not upgraded.
292```
293
294'# Configure swap file
295```
296# /etc/dphys-swapfile - user settings for dphys-swapfile package
297# author Neil Franklin, last modification 2010.05.05
298# copyright ETH Zuerich Physics Departement
299# use under either modified/non-advertising BSD or GPL license
300
301# this file is sourced with . so full normal sh syntax applies
302
303# the default settings are added as commented out CONF_*=* lines
304
305
306# reconfigure swapfile to reside on /mnt/swap
307CONF_SWAPFILE=/mnt/swap
308
309# set size to absolute value, leaving empty (default) then uses computed value
310# you most likely don't want this, unless you have an special disk situation
311
312# set swapsize to 500
313CONF_SWAPSIZE=500
314
315# set size to computed value, this times RAM size, dynamically adapts,
316# guarantees that there is enough swap without wasting disk space on excess
317CONF_SWAPFACTOR=2
318
319# restrict size (computed and absolute!) to maximally this limit
320# can be set to empty for no limit, but beware of filled partitions!
321# this is/was a (outdated?) 32bit kernel limit (in MBytes), do not overrun it
322# but is also sensible on 64bit to prevent filling /var or even / partition
323CONF_MAXSWAP=2048
324```
325ctrl+x to save
326
327'# Restart swap file service
328```
329pi@raspberrypi:~ $ sudo /etc/init.d/dphys-swapfile stop
330[ ok ] Stopping dphys-swapfile (via systemctl): dphys-swapfile.service.
331pi@raspberrypi:~ $ sudo /etc/init.d/dphys-swapfile start
332[ ok ] Starting dphys-swapfile (via systemctl): dphys-swapfile.service.
333```
334
335## Setup Vertcoin Core Crontab for auto-start on reboot
336
337Here we will configure the crontab file to start `vertcoind` as a daemon on reboot and on each hour to ensure `vertcoind` always has a process thats alive. If `vertcoind` is already running when the hourly crontab executes it will simply fail to spawn a new process.
338
339'# Configure crontab file to start `vertcoind` on reboot and hourly
340```
341pi@raspberrypi:~ $ crontab -u pi -e
342no crontab for pi - using an empty one
343
344Select an editor. To change later, run 'select-editor'.
345 1. /bin/ed
346 2. /bin/nano <---- easiest
347 3. /usr/bin/vim.tiny
348
349Choose 1-3 [2]: 2
350----------------------------------------------------------------------
351# Edit this file to introduce tasks to be run by cron.
352#
353# Each task to run has to be defined through a single line
354# indicating with different fields when the task will be run
355# and what command to run for the task
356#
357# To define the time you can provide concrete values for
358# minute (m), hour (h), day of month (dom), month (mon),
359# and day of week (dow) or use '*' in these fields (for 'any').#
360# Notice that tasks will be started based on the cron's system
361# daemon's notion of time and timezones.
362#
363# Output of the crontab jobs (including errors) is sent through
364# email to the user the crontab file belongs to (unless redirected).
365#
366# For example, you can run a backup of all your user accounts
367# at 5 a.m every week with:
368# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
369#
370# For more information see the manual pages of crontab(5) and cron(8)
371#
372# m h dom mon dow command
373
374@reboot vertcoind -daemon
375@hourly vertcoind -daemon
376```
377ctrl+x to save
378
379'# Reboot and confirm vertcoind process spawns on reboot
380`pi@raspberrypi:~ $ sudo reboot `
381
382'# Wait a minute, then log back in via SSH
383`ssh 192.168.1.2 -l pi`
384```
385pi@raspberrypi:~ $ ps aux | grep vertcoin
386pi 406 99.9 9.5 169160 90256 ? Rsl 22:43 1:46 vertcoind -daemon
387pi 530 0.0 0.0 4372 560 pts/0 S+ 22:45 0:00 grep --color=auto vertcoin
388```
389
390Vertcoin Core is now synchronizing to the side-loaded blockchain located in /mnt/ (linked to /home/pi/.vertcoin). This process can take ~3-5 hours to sync headers and verify all of the downloaded blocks. You can monitor system resources with `htop` or by issuing the following commands:
391
392'# Display output of /home/pi/.vertcoin/debug.log to the screen
393`pi@raspberrypi:~ $ tailf .vertcoin/debug.log`
394
395'# Show blockchain information
396`pi@raspberrypi:~ $ vertcoin-cli getblockchaininfo`
397
398'# Show current block
399`pi@raspberrypi:~ $ vertcoin-cli getblockcount`
400
401## Configure firewall to allow Vertcoin Core traffic
402
403'# Install UFW
404`pi@raspberrypi:~ $ sudo apt-get install ufw`
405
406'# Enter root and configure UFW
407```
408pi@raspberrypi:~ $ sudo su
409root@raspberrypi:/home/pi# ufw default deny incoming
410Default incoming policy changed to 'deny'
411(be sure to update your rules accordingly)
412root@raspberrypi:/home/pi# ufw default allow outgoing
413Default outgoing policy changed to 'allow'
414(be sure to update your rules accordingly)
415root@raspberrypi:/home/pi# ufw allow from 192.168.1.0/24 to any port 22 comment 'allow SSH from local LAN'
416Rules updated
417root@raspberrypi:/home/pi# ufw allow 5889 comment 'allow vertcoin core'
418Rules updated
419Rules updated (v6)
420root@raspberrypi:/home/pi# ufw enable
421Command may disrupt existing ssh connections. Proceed with operation (y|n)? y
422Firewall is active and enabled on system startup
423root@raspberrypi:/home/pi# systemctl enable ufw
424Synchronizing state of ufw.service with SysV service script with /lib/systemd/systemd-sysv-install.
425Executing: /lib/systemd/systemd-sysv-install enable ufw
426root@raspberrypi:/home/pi# ufw status
427Status: active
428
429To Action From
430-- ------ ----
43122 ALLOW 192.168.1.0/24 # allow SSH from local LAN
4325889 ALLOW Anywhere # allow vertcoin core
4335889 (v6) ALLOW Anywhere (v6) # allow vertcoin core
434
435root@raspberrypi:/home/pi# exit
436exit
437```
438Please note that your IP range may be different than what I have listed above. If your router IP address is `192.168.1.1` then the instructions above require no alterations. If your IP address is something like `192.168.56.1` or `10.0.0.1` then you will need to modify the 'ufw allow from `192.168.1.0/24` to any port 22' to 'ufw allow from `192.168.56.0/24`(...)' or 'ufw allow from `10.0.0.0/24`(...)' respectively.
439
440Please open a browser window and navigate to your router page, from there you can port forward your Raspberry Pi. `TCP/UDP 5889`. This will make your node public and support the health of the Vertcoin network by keeping it decentralized, populated with one more node.
441
442
443## Congratulations!
444You have successfully setup a full Vertcoin Core node on a Raspberry Pi. Thank you for following along and contributing to the Vertcoin network by helping keep it populated with nodes and distributed. You help give meaning to 'the peoples' coin'!
445```
446pi@raspberrypi:~ $ vertcoin-cli getblockchaininfo
447{
448 "chain": "main",
449 "blocks": 888507,
450 "headers": 915979,
451 "bestblockhash": "c56f7d9fbddd4073c68d18e901944dd50cad072b3fa39bbd0047e476b5297898",
452 "difficulty": 45108.82829895391,
453 "mediantime": 1520320068,
454 "verificationprogress": 0.9595547815279806,
455 "initialblockdownload": true,
456 "chainwork": "0000000000000000000000000000000000000000000000015f56d79735e934ce",
457 "size_on_disk": 3240624105,
458 "pruned": false,
459 "bip9_softforks": {
460 "csv": {
461 "status": "active",
462 "startTime": 1488326400,
463 "timeout": 1519862400,
464 "since": 691488
465 },
466 "segwit": {
467 "status": "active",
468 "startTime": 1488326400,
469 "timeout": 1519862400,
470 "since": 713664
471 },
472 "nversionbips": {
473 "status": "active",
474 "startTime": 1488326400,
475 "timeout": 1519862400,
476 "since": 691488
477 }
478 },
479 "warnings": ""
480}
481```
482
483
484
485## References
486`[1] How to Create Your Own Bitcoin Full Node With a Raspberry Pi http://www.raspberrypifullnode.com/`
487
488``