· 8 years ago · Apr 25, 2018, 11:18 PM
1# Raspberry Pi 3 B/B+ Vertcoin Full Node Installation Guide for Windows
2
3`*`
4###### anything marked with an asterisk is an optional step
5
6##
7
8#### Why a Vertcoin Full node?
9>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]
10
11>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. [2]
12
13>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.
14
15#### Why a Raspberry Pi?
16>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]
17
18## Table of Contents
191. `Parts List`
202. `* OPTIONAL: Download and sync Vertcoin Core`
213. `Format USB Flash Drive`
224. `Install Raspbian Stretch Lite`
235. `Copy Blockchain to USB Flash Drive`
246. `Setup Raspberry Pi`
257. `Setup USB Flash Drive and Auto-Mount`
268. `Create vertcoin.conf and soft link to USB Flash Drive`
279. `Configure firewall to allow Vertcoin Core traffic`
2810. `* OPTIONAL: Setup p2pool-vtc`
2911. `Congratulations!`
30
31
32##
33
34
35
36### 1.) Parts List
37
38| Parts | Price | Link |
39|--------------------------------------------------------------|------------|---------------------------------------------------------------------------------|
40| CanaKit Raspberry Pi 3 B+ | $49.99 USD | https://www.amazon.com/CanaKit-Raspberry-Power-Supply-Listed/dp/B07BC6WH7V/ |
41| 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/ |
42| SanDisk Ultra Fit 128GB USB 3.0 Flash Drive | $27.49 USD | https://www.amazon.com/SanDisk-Ultra-128GB-Flash-Drive/dp/B01BGTG2A0/ |
43| 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/ |
44| *OPTIONAL: Zebra Black Ice Case for Raspberry Pi by C4Labs | $14.95 USD | https://www.amazon.com/Zebra-Black-Case-Raspberry-C4labs/dp/B00M6G9YBM/ |
45
46
47You 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.
48
49The 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.
50
51
52
53## 2.) `* OPTIONAL:` Download and sync Vertcoin Core
54
55This 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.
56
57We will use this copy of the blockchain that is syncing to side-load onto our Raspberry Pi later.
58
59`Vertcoin Core Download Link: https://github.com/vertcoin-project/vertcoin-core/releases`
60`Default Windows Directory (Vertcoin): C:\Users\%USER%\AppData\Roaming\Vertcoin`
61
62
63
64
65## 3.) Format USB Flash Drive
66
67>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.
68
69Insert the USB Flash Drive into your Windows PC. Then access the drive with Windows Explorer `Win+E`, right click on the removable drive you wish to format and `Format...`
70
71Format the USB Flash Drive to an `NTFS` File system.
72
73This 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.
74
75It 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 card.
76
77
78
79## 4.) Install Raspbian Stretch Lite
80
81I recommend downloading the latest stable version of [Raspbian Stretch Lite](https://www.raspberrypi.org/downloads/raspbian/).
82
83We 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.
84
85
86`Raspberry Pi - Installing Operating System Images Using Windows: https://www.raspberrypi.org/documentation/installation/installing-images/windows.md`
87
88Once 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...
89
90
91This 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.
92
93`Raspian Download Link: https://www.raspberrypi.org/downloads/raspbian/`
94`Win32 Disk Imager Documentation: https://www.raspberrypi.org/documentation/installation/installing-images/windows.md`
95
96
97## 5.) Copy Blockchain to USB Flash Drive
98Once Vertcoin Core is finished syncing the blockchain please navigate to the data directory for Vertcoin.
99
100`Default Windows Directory (Vertcoin): C:\Users\%USER%\AppData\Roaming\Vertcoin`
101
102Copy 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.
103
104## 6.) Setup Raspberry Pi
105
106Please 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.
107
108We 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`.
109
110`Git download link: https://git-scm.com/downloads`
111
112Open 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.
113
114\# Open `Git Bash` and ...
115`~ $ ssh 192.168.1.2 -l pi`
116`default password: raspberry`
117
118\# Download and install latest system updates
119`pi@raspberrypi:~ $ sudo apt-get update ; sudo apt-get upgrade -y`
120
121
122\# Remove orphaned packages and clean apt
123`pi@raspberrypi:~ $ sudo apt-get autoremove ; sudo apt-get autoclean`
124
125
126\# Initiate `raspi-config` script
127`pi@raspberrypi:~ $ sudo raspi-config`
128
129```
1301.) [8] Update # update raspi-config script first
1312.) [1] Change User Password # change password for current user
1323.) [4] Localization Options #
133 > [I2] Change Timezone # set your timezone
1344.) [7] Advanced Options #
135 > [A1] Expand Filesystem # expand filesystem
136```
137`<Finish>` and choose to reboot.
138
139\# Wait a minute, then log back in via SSH
140`ssh 192.168.1.2 -l pi`
141
142\# Download and install useful software packages
143`pi@raspberrypi:~ $ sudo apt-get install git ntfs-3g`
144
145##
146
147\# `* OPTIONAL:` Disable Wireless and Bluetooth
148`pi@raspberrypi:~ $ cd /etc/modprobe.d/`
149
150\# Create our blacklist file
151`pi@raspberrypi:/etc/modprobe.d $ sudo nano raspi-blacklist.conf`
152
153```
154# disable wireless
155blacklist brcmfmac
156blacklist brcmutil
157
158# disable bluetooth
159blacklist btbcm
160blacklist hci_uart
161```
162ctrl+x to save
163
164\# Reboot Raspberry Pi for changes to take effect
165`pi@raspberrypi:/etc/modprobe.d $ sudo reboot`
166
167\# Wait a minute, then log back in via SSH
168`ssh 192.168.1.2 -l pi`
169##
170
171\# Download latest stable version of vertcoin-core for ARM architecture to Raspberry Pi
172`pi@raspberrypi:~ $ wget https://github.com/vertcoin-project/vertcoin-core/releases/download/0.12.0/vertcoin-v0.12.0-linux-arm.zip`
173
174\# Unzip `vertcoin-v0.12.0-linux-arm.zip`
175```
176pi@raspberrypi:~ $ unzip vertcoin-v0.12.0-linux-arm.zip
177Archive: vertcoin-v0.12.0-linux-arm.zip
178 inflating: vertcoin-cli
179 inflating: vertcoind
180 inflating: vertcoin-tx
181```
182\# Remove `vertcoin-v0.12.0-linux-arm.zip`
183`pi@raspberrypi:~ $ rm *.zip`
184
185\# Move vertcoin-cli, vertcoind, vertcoin-tx to /usr/bin/
186`pi@raspberrypi:~ $ sudo mv vertcoin* /usr/bin/`
187
188
189
190## 7.) Setup USB Flash Drive and Auto-Mount
191
192Please 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.
193
194\# Find your USB Flash Drive
195```
196pi@raspberrypi:~ $ sudo blkid
197/dev/mmcblk0p1: LABEL="boot" UUID="5DB0-971B" TYPE="vfat" PARTUUID="efbdd15e-01"
198/dev/mmcblk0p2: LABEL="rootfs" UUID="060b57a8-62bd-4d48-a471-0d28466d1fbb" TYPE="ext4" PARTUUID="efbdd15e-02"
199/dev/mmcblk0: PTUUID="efbdd15e" PTTYPE="dos"
200/dev/sda1: UUID="0DC965316518EB7C" TYPE="ntfs" PARTUUID="00e3d476-01"
201```
202My 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.
203
204\# Make sure a mount point exists for the USB Flash Drive
205```
206pi@raspberrypi:~ $ sudo mkdir /mnt
207mkdir: cannot create directory ‘/mnt’: File exists
208```
209\# Give `/mnt` privileges
210`pi@raspberrypi:~ $ sudo chmod 755 /mnt`
211
212\# Mount USB Flash Drive to mount point
213`pi@raspberrypi:~ $ sudo mount /dev/sda1 /mnt`
214
215\# Confirm USB Flash Drive was successfully mounted to `/mnt`
216```
217pi@raspberrypi:~ $ ls /mnt/
218blocks chainstate System Volume Information
219```
220\# Setup `fstab` file to auto-mount the USB Flash Drive on reboot
221`pi@raspberrypi:~ $ sudo nano /etc/fstab`
222```
223proc /proc proc defaults 0 0
224PARTUUID=efbdd15e-01 /boot vfat defaults 0 2
225PARTUUID=efbdd15e-02 / ext4 defaults,noatime 0 1
226
227# replace /dev/sda1 with your USB device, [tab] between each value
228/dev/sda1 /mnt ntfs defaults 0 0
229
230# a swapfile is not a swap partition, no line here
231# use dphys-swapfile swap[on|off] for that
232```
233`ctrl+x` to save
234
235\# Reboot to confirm auto-mount is successful
236`pi@raspberrypi:~ $ sudo reboot `
237
238\# Wait a minute, then log back in via SSH
239`ssh 192.168.1.2 -l pi`
240
241\# Confirm USB Flash Drive auto-mounted
242```
243pi@raspberrypi:~ $ ls /mnt/
244blocks chainstate System Volume Information
245```
246
247## 8.) Create vertcoin.conf and soft link to USB Flash Drive
248
249\# Change directory to `/mnt/`
250`pi@raspberrypi:~ $ cd /mnt/`
251
252\# Create `vertcoin.conf` for Vertcoin Core
253`pi@raspberrypi:/mnt $ sudo nano vertcoin.conf`
254```
255server=1
256rpcuser=node
257rpcpassword=yoursecurepasswordgoeshere
258
259# makes client run in background
260daemon=1
261
262# lopp.net optimizations
263dbcache=100
264maxorphantx=10
265maxmempool=50
266maxconnections=40
267maxuploadtarget=5000
268```
269`ctrl+x` to save
270
271##
272`* OPTIONAL:` A quick and easy way to generate a random password is taking the `md5sum` of a file
273```
274pi@raspberrypi:/mnt $ touch rand
275pi@raspberrypi:/mnt $ md5sum rand
276d41d8cd98f00b204e9800998ecf8427e rand
277```
278##
279
280\# Change directory back home
281```
282pi@raspberrypi:/mnt $ cd
283pi@raspberrypi:~ $ pwd
284/home/pi
285```
286 \# Create soft link (symbolic link) connecting `/mnt/` <---> `/home/pi/.vertcoin`
287`pi@raspberrypi:~ $ sudo ln -s /mnt/ /home/pi/.vertcoin`
288
289\# List all files in home
290```
291pi@raspberrypi:~ $ ls -a
292. .. .bash_history .bash_logout .bashrc .config .profile .vertcoin .wget-hsts
293```
294\# List files in `/home/pi/.vertcoin`, confirm blockchain and `vertcoin.conf` is there
295```
296pi@raspberrypi:~ $ ls .vertcoin
297blocks chainstate System Volume Information vertcoin.conf
298```
299
300#### Create swap file space for Raspberry Pi
301
302Here 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.
303
304\# Install `dphys-swapfile`
305```
306pi@raspberrypi:~ $ sudo apt-get install dphys-swapfile
307Reading package lists... Done
308Building dependency tree
309Reading state information... Done
310dphys-swapfile is already the newest version (20100506-3).
3110 upgraded, 0 newly installed, 0 to remove and 15 not upgraded.
312```
313
314\# Configure swap file
315`pi@raspberrypi:~ $ sudo nano /etc/dphys-swapfile`
316```
317# /etc/dphys-swapfile - user settings for dphys-swapfile package
318# author Neil Franklin, last modification 2010.05.05
319# copyright ETH Zuerich Physics Departement
320# use under either modified/non-advertising BSD or GPL license
321
322# this file is sourced with . so full normal sh syntax applies
323
324# the default settings are added as commented out CONF_*=* lines
325
326
327# reconfigure swapfile to reside on /mnt/swap
328CONF_SWAPFILE=/mnt/swap
329
330# set size to absolute value, leaving empty (default) then uses computed value
331# you most likely don't want this, unless you have an special disk situation
332
333# set swapsize to 500
334CONF_SWAPSIZE=500
335
336# set size to computed value, this times RAM size, dynamically adapts,
337# guarantees that there is enough swap without wasting disk space on excess
338CONF_SWAPFACTOR=2
339
340# restrict size (computed and absolute!) to maximally this limit
341# can be set to empty for no limit, but beware of filled partitions!
342# this is/was a (outdated?) 32bit kernel limit (in MBytes), do not overrun it
343# but is also sensible on 64bit to prevent filling /var or even / partition
344CONF_MAXSWAP=2048
345```
346`ctrl+x` to save
347
348\# Restart swap file service
349```
350pi@raspberrypi:~ $ sudo /etc/init.d/dphys-swapfile stop
351[ ok ] Stopping dphys-swapfile (via systemctl): dphys-swapfile.service.
352```
353```
354pi@raspberrypi:~ $ sudo /etc/init.d/dphys-swapfile start
355[ ok ] Starting dphys-swapfile (via systemctl): dphys-swapfile.service.
356```
357
358#### Setup Vertcoin Core Crontab for auto-start on reboot
359
360Here 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.
361
362\# Configure `crontab` file to start `vertcoind` hourly and on reboot
363
364`pi@raspberrypi:~ $ crontab -u pi -e`
365```
366no crontab for pi - using an empty one
367
368Select an editor. To change later, run 'select-editor'.
369 1. /bin/ed
370 2. /bin/nano <---- easiest
371 3. /usr/bin/vim.tiny
372
373Choose 1-3 [2]: 2
374----------------------------------------------------------------------
375# Edit this file to introduce tasks to be run by cron.
376#
377# Each task to run has to be defined through a single line
378# indicating with different fields when the task will be run
379# and what command to run for the task
380#
381# To define the time you can provide concrete values for
382# minute (m), hour (h), day of month (dom), month (mon),
383# and day of week (dow) or use '*' in these fields (for 'any').#
384# Notice that tasks will be started based on the cron's system
385# daemon's notion of time and timezones.
386#
387# Output of the crontab jobs (including errors) is sent through
388# email to the user the crontab file belongs to (unless redirected).
389#
390# For example, you can run a backup of all your user accounts
391# at 5 a.m every week with:
392# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
393#
394# For more information see the manual pages of crontab(5) and cron(8)
395#
396# m h dom mon dow command
397
398@reboot vertcoind -daemon
399@hourly vertcoind -daemon
400```
401`ctrl+x` to save
402
403\# Reboot and confirm `vertcoind` process spawns on reboot
404`pi@raspberrypi:~ $ sudo reboot `
405
406\# Wait a minute, then log back in via SSH
407`ssh 192.168.1.2 -l pi`
408```
409pi@raspberrypi:~ $ ps aux | grep vertcoin
410pi 406 99.9 9.5 169160 90256 ? Rsl 22:43 1:46 vertcoind -daemon
411pi 530 0.0 0.0 4372 560 pts/0 S+ 22:45 0:00 grep --color=auto vertcoin
412```
413##
414### Quick note about blockchain syncing
415Vertcoin 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 by issuing the `htop` command and check up on `vertcoind` by issuing the following commands:
416
417\# Display output of Vertcoin `debug.log`; `ctrl+c` to stop
418`pi@raspberrypi:~ $ tailf .vertcoin/debug.log`
419
420\# Show blockchain information
421`pi@raspberrypi:~ $ vertcoin-cli getblockchaininfo`
422
423\# Show current block
424`pi@raspberrypi:~ $ vertcoin-cli getblockcount`
425
426###### You may continue on while `vertcoind` catches up to the blockchain ...
427
428
429## 9.) Configure firewall to allow Vertcoin Core traffic
430
431##### Please note that your `IP` range may be different than what I have listed below. 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.
432
433\# Install `UFW`
434`pi@raspberrypi:~ $ sudo apt-get install ufw`
435
436\# Escalate to `root` and configure `UFW`
437
438`pi@raspberrypi:~ $ sudo su`
439`root@raspberrypi:/home/pi# ufw default deny incoming`
440```
441Default incoming policy changed to 'deny'
442(be sure to update your rules accordingly)
443```
444`root@raspberrypi:/home/pi# ufw default allow outgoing`
445```
446Default outgoing policy changed to 'allow'
447(be sure to update your rules accordingly)
448```
449`root@raspberrypi:/home/pi# ufw allow from 192.168.1.0/24 to any port 22 comment 'allow SSH from local LAN'`
450`root@raspberrypi:/home/pi# ufw allow 5889 comment 'allow vertcoin core'`
451`root@raspberrypi:/home/pi# ufw enable`
452```
453Command may disrupt existing ssh connections. Proceed with operation (y|n)? y
454Firewall is active and enabled on system startup
455```
456`root@raspberrypi:/home/pi# systemctl enable ufw`
457```
458Synchronizing state of ufw.service with SysV service script with /lib/systemd/systemd-sysv-install.
459Executing: /lib/systemd/systemd-sysv-install enable ufw
460```
461`root@raspberrypi:/home/pi# ufw status`
462```
463Status: active
464
465To Action From
466-- ------ ----
46722 ALLOW 192.168.1.0/24 # allow SSH from local LAN
4685889 ALLOW Anywhere # allow vertcoin core
4695889 (v6) ALLOW Anywhere (v6) # allow vertcoin core
470```
471\# Give up `root`
472`root@raspberrypi:/home/pi# exit`
473
474Open a browser window and navigate to your router page, from there you can port forward your Raspberry Pi.
475`TCP/UDP Port: 5889`
476
477##### This will make your node public, supporting the health of the Vertcoin network by keeping it decentralized and populated with one more node.
478
479
480## `* OPTIONAL:` Setup p2pool-vtc
481
482This section gives you the option of setting up an instance of a Vertcoin P2Pool on the Raspberry Pi to run alongside the `vertcoind` daemon.
483
484>P2Pool is a decentralized Bitcoin mining pool that works by creating a peer-to-peer network of miner nodes.
485
486>P2Pool creates a new block chain in which the difficulty is adjusted so a new block is found every 30 seconds. The blocks that get into the P2Pool block chain (called the "share chain") are the same blocks that would get into the Bitcoin block chain, only they have a lower difficulty target. Whenever a peer announces a new share found (new block in the P2Pool block chain), it is received by the other peers, and the other peers verify that this block contains payouts for all the previous miners who found a share (and announced it) that made it into the P2Pool share chain. This continues until some peer finds a block that has a difficulty that meets the Bitcoin network's difficulty target. This peer announces this block to the Bitcoin network and miners who have submitted shares for this block are paid in the generation transaction, proportionally to how many shares they have found in the last while. - Unknown author [3]
487>
488> Decentralized payout pooling solves the problem of centralized mining pools degrading the decentralization of Bitcoin and avoids the risk of hard to detect theft by pool operators.
489>
490> Miners are configured to connect to a P2Pool node that can be run locally, alongside the miner. P2Pool users must run a full Bitcoin node which serves the purpose of independently validating transactions and the Bitcoin blockchain.
491>
492> P2Pool nodes work on a chain of shares similar to Bitcoin's blockchain. Each node works on a block that includes payouts to the previous shares' owners and the node itself, which can also result in a share if it meets P2Pool's difficulty.
493
494\# Install `p2pool-vtc` dependencies and `python-pip`
495
496`pi@raspberrypi:~ $ sudo apt-get install python-rrdtool python-pygame python-scipy python-twisted python-twisted-web python-imaging python-pip`
497
498\# Install `bitcoin` dependencies and `libffi-dev`
499
500`pi@raspberrypi:~/p2pool-vtc $ sudo apt-get install build-essential libtool autotools-dev automake pkg-config libffi-dev libssl-dev libevent-dev bsdmainutils python3`
501
502\# Clone `p2pool-vtc`
503```
504pi@raspberrypi:~ $ git clone https://github.com/vertcoin-project/p2pool-vtc.git
505Cloning into 'p2pool-vtc'...
506remote: Counting objects: 8393, done.
507remote: Total 8393 (delta 0), reused 0 (delta 0), pack-reused 8393
508Receiving objects: 100% (8393/8393), 2.54 MiB | 0 bytes/s, done.
509Resolving deltas: 100% (5611/5611), done.
510```
511
512\# Change directory to `p2pool-vtc`
513`pi@raspberrypi:~ $ cd p2pool-vtc/`
514
515\# Install `requirements.txt` dependencies
516`pi@raspberrypi:~/p2pool-vtc $ pip install -r requirements.txt`
517
518\# Configure P2Pool
519`pi@raspberrypi:~/p2pool-vtc $ cd lyra2re-hash-python/`
520`pi@raspberrypi:~/p2pool-vtc/lyra2re-hash-python $ git submodule init`
521`pi@raspberrypi:~/p2pool-vtc/lyra2re-hash-python $ git submodule update`
522`pi@raspberrypi:~/p2pool-vtc/lyra2re-hash-python $ sudo python setup.py install`
523
524\# Download alternate web frontend for P2Pool
525`pi@raspberrypi:~/p2pool-vtc/lyra2re-hash-python $ cd`
526`pi@raspberrypi:~ $ git clone https://github.com/hardcpp/P2PoolExtendedFrontEnd.git`
527`pi@raspberrypi:~ $ cd P2PoolExtendedFrontEnd`
528
529\# Move all files in `P2PoolExtendedFrontEnd` to the `web-static` folder in `p2pool-vtc`
530`pi@raspberrypi:~/P2PoolExtendedFrontEnd $ mv * /home/pi/p2pool-vtc/web-static/`
531`pi@raspberrypi:~/P2PoolExtendedFrontEnd $ cd`
532
533\# Clean up
534`pi@raspberrypi:~ $ sudo rm -r P2PoolExtendedFrontEnd/`
535
536
537#### Network 1 - Firewall Configuration
538> If you are a smaller miner with 2 graphics cards or less or are using your CPU, it is recommended to use Network 2. If you are a larger miner with multiple cards and/or a hash rate larger than 100Mh, it is recommended to use Network 1.
539
540\# Escalate to `root`
541`pi@raspberrypi:~ $ sudo su`
542`root@raspberrypi:/home/pi# ufw allow 9346 comment 'allow --network 1 p2p port'`
543`root@raspberrypi:/home/pi# ufw allow 9171 comment 'allow --network 1 mining port'`
544
545\# Give up `root`
546`root@raspberrypi:/home/pi# exit`
547
548#### Network 2 - Firewall Configuration
549> If you are a smaller miner with 2 graphics cards or less or are using your CPU, it is recommended to use Network 2. If you are a larger miner with multiple cards and/or a hash rate larger than 100Mh, it is recommended to use Network 1.
550
551\# Escalate to `root`
552`pi@raspberrypi:~ $ sudo su`
553`root@raspberrypi:/home/pi# ufw allow 9347 comment 'allow --network 2 p2p port'`
554`root@raspberrypi:/home/pi# ufw allow 9181 comment 'allow --network 2 mining port'`
555
556\# Give up `root`
557`root@raspberrypi:/home/pi# exit`
558
559##
560
561#### `* OPTIONAL:` Setup P2Pool bash script for execution on reboot
562###### Note: This walkthrough uses the default settings.
563```
564pi@raspberrypi:~/p2pool-vtc $ python run_p2pool.py --help
565usage: run_p2pool.py [-h] [--version]
566 [--net {bitcoin,btcregtest,fastcoin,litecoin,terracoin,vertcoin,vertcoin2}]
567 [--testnet] [--debug] [-a ADDRESS] [-i NUMADDRESSES]
568 [-t TIMEADDRESSES] [--datadir DATADIR]
569 [--logfile LOGFILE] [--web-static WEB_STATIC]
570 [--merged MERGED_URLS]
571 [--give-author DONATION_PERCENTAGE] [--iocp]
572 [--irc-announce] [--no-bugreport] [--p2pool-port PORT]
573 [-n ADDR[:PORT]] [--disable-upnp] [--max-conns CONNS]
574 [--outgoing-conns CONNS] [--external-ip ADDR[:PORT]]
575 [--disable-advertise] [-w PORT or ADDR:PORT]
576 [-f FEE_PERCENTAGE]
577 [--miner-share-rate SHARES_PER_MINUTE]
578 [--address-share-rate SHARES_PER_MINUTE]
579 [--min-difficulty DIFFICULTY]
580 [--bitcoind-config-path BITCOIND_CONFIG_PATH]
581 [--bitcoind-address BITCOIND_ADDRESS]
582 [--bitcoind-rpc-port BITCOIND_RPC_PORT]
583 [--bitcoind-rpc-ssl]
584 [--bitcoind-p2p-port BITCOIND_P2P_PORT]
585 [BITCOIND_RPCUSERPASS [BITCOIND_RPCUSERPASS ...]]
586
587```
588
589#### `* OPTIONAL:` Setup P2Pool bash script for execution on reboot
590`pi@raspberrypi:~ $ nano start-p2pool.sh`
591```
592#!/bin/bash
593#
594# run p2pool with pre-configured settings
595#
596# network 1 = --net vertcoin
597# network 2 = --net vertcoin2
598#
599cd p2pool-vtc
600python run_p2pool.py --net vertcoin
601```
602
603\# Give execute privileges to `start-p2pool.sh`
604`pi@raspberrypi:~ $ chmod +x start-p2pool.sh`
605
606\# Configure `crontab` file to execute `start-p2pool.sh` on reboot
607`pi@raspberrypi:~ $ crontab -u pi -e`
608```
609# Edit this file to introduce tasks to be run by cron.
610#
611# Each task to run has to be defined through a single line
612# indicating with different fields when the task will be run
613# and what command to run for the task
614#
615# To define the time you can provide concrete values for
616# minute (m), hour (h), day of month (dom), month (mon),
617# and day of week (dow) or use '*' in these fields (for 'any').#
618# Notice that tasks will be started based on the cron's system
619# daemon's notion of time and timezones.
620#
621# Output of the crontab jobs (including errors) is sent through
622# email to the user the crontab file belongs to (unless redirected).
623#
624# For example, you can run a backup of all your user accounts
625# at 5 a.m every week with:
626# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
627#
628# For more information see the manual pages of crontab(5) and cron(8)
629# m h dom mon dow command
630@reboot vertcoind -daemon
631@hourly vertcoind -daemon
632
633# sleep 15 minutes then start p2pool
634@reboot sleep 900; /home/pi/start-p2pool.sh
635```
636Note: Running P2Pool 15 minutes after reboot allows the Raspberry Pi resources and time to verify, load the blockchain and catch up if needed.
637
638\# `* OPTIONAL:` Display output of P2Pool's `debug` log; `ctrl+c` to stop
639`pi@raspberrypi:~ $ tailf p2pool-vtc/data/vertcoin/log`
640
641#### Documentation
642`https://github.com/vertcoin-project/p2pool-vtc`
643`https://github.com/bitcoin/bitcoin/blob/master/doc/build-unix.md`
644
645## Congratulations!
646You 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'!
647```
648pi@raspberrypi:~ $ vertcoin-cli getblockchaininfo
649{
650 "chain": "main",
651 "blocks": 888507,
652 "headers": 915979,
653 "bestblockhash": "c56f7d9fbddd4073c68d18e901944dd50cad072b3fa39bbd0047e476b5297898",
654 "difficulty": 45108.82829895391,
655 "mediantime": 1520320068,
656 "verificationprogress": 0.9595547815279806,
657 "initialblockdownload": true,
658 "chainwork": "0000000000000000000000000000000000000000000000015f56d79735e934ce",
659 "size_on_disk": 3240624105,
660 "pruned": false,
661 "bip9_softforks": {
662 "csv": {
663 "status": "active",
664 "startTime": 1488326400,
665 "timeout": 1519862400,
666 "since": 691488
667 },
668 "segwit": {
669 "status": "active",
670 "startTime": 1488326400,
671 "timeout": 1519862400,
672 "since": 713664
673 },
674 "nversionbips": {
675 "status": "active",
676 "startTime": 1488326400,
677 "timeout": 1519862400,
678 "since": 691488
679 }
680 },
681 "warnings": ""
682}
683```
684
685
686
687## References
688`[1] How to Create Your Own Bitcoin Full Node With a Raspberry Pi http://www.raspberrypifullnode.com/`
689`[2] Jameson Lopp - Bitcoin Nodes, how many is enough? https://medium.com/@lopp/bitcoin-nodes-how-many-is-enough-9b8e8f6fd2cf`
690`[3] Bitcoin Wiki - P2Pool https://en.bitcoin.it/wiki/P2Pool`
691
692``