|description=Building a Ravencoin full node on Raspberry Pi
}}
<div class="floatright"><img src="https://i.gyazo.com/3d630d1f995efdb8ffdd04865a6a12c0.png"><br>By [@]Pathfinder#0001</div>
''By Jeroz - Oct 27th, 2018 -- Updated by [https://twitter.com/pathfinder @Pathfinder] for v4.3.2.1''
''By Jeroz - Oct 27th, 2018''
== General Introduction ==
I will walk you through the steps to set up a full Ravencoin node on a Raspberry Pi running within your home network. A Raspberry Pi node is one of the cheapest options for a Ravencoin node (under $75) and consumes around 3 Watt when running the node and no peripherals are attached to it. The guide runs you through buying and installing hardware, setting up the operating system ([https://www.raspberrypi.org/downloads/noobs/ using NOOBS]), installing the node, and setting up security. Setting up security is highly recommended because you are opening a port to the outside world and you want to make sure it is only used for Ravencoin. Also, as there is no working Raspberry Pi graphical user interface for the Raven Core wallet, you will have to set it up through commands in the terminal. For each step, I will try to explain what you are doing and provide command lines that you need to execute. I will provide links that 1) don't require you to compile the node (which takes about 2 hours if it doesn't crash halfway), and 2) a direct download of 1.8GB of the blockchain, so you don't have to download it from other nodes in the network. These steps likely save you days in getting the node up and running.
My resources for setting up this guide were my previous experiences in working with Bash (linux command line language) and:
#https://www.raspberrypi.org/documentation/
#https://medium.com/@meeDamian/bitcoin-full-node-on-rbp3-revised-88bb7c8ef1d1
== Before you start ==
Before you start, you will need:
* A working internet connection ; via an UTP cable (cable recommended for connection stability) or WIFI).
* '''A PC with an SD card reader'''
* A Mouse, keyboard, and monitor
#Extract the NOOBS zip file and copy its contents on the memory card.
#When this process has finished, safely remove the SD card and insert it into your Raspberry Pi.
#Connect the power cable to the Raspberry Pi to let it boot. If you run into trouble, walk trough through the [https://www.raspberrypi.org/learning/hardware-guide/ Raspberry Pi hardware guide] #If you are using NOOBS and this is the first time your Raspberry Pi and SD card have been used, then you'll have to select an operating system and let it install(Choose the default: Raspbian).#Don't forget to set a password for login when prompted. Otherwise it is too easy for someone else to get in. == A High-End RPi4 Build with SATA SSD ==(by [https://twitter.com/pathfinder @Pathfinder]) If you'd like a higher-end hardware setup that's optimized for expandability and speed (microSD cards are notoriously slow), see my [https://bit.ly/smol-guide-rpi4 smol guide]. <p>You'll end up building something that looks like this:<br>[https://i.gyazo.com/f0eb138514580314976a21a68b8fc68c.jpg <img src="https://i.gyazo.com/f0eb138514580314976a21a68b8fc68c.jpg" width="350">]<br> My [https://bit.ly/smol-guide-rpi4 smol guide] focuses on running Urbit, but the specified hardware config is also ideal for running a Ravencoin or Bitcoin node!<p> For optimal speed and expanadabilty, I suggest using the SATA SSD as the data storage location for the Ravencoin blockchain as well as the Ravencoin binaries. <p>Create a directory on the SSD called <b>/media/pi/SSD/Ravencoin</b> and put the directory with the Ravencoin binaries in there. <p>Then create a directory on the SSD called <b>/media/pi/SSD/Ravencoin/RavencoinData</b> for the blockchain and reference it like this: <p> <b>To START the node:</b><pre>./ravend -daemon --datadir=/media/pi/SSD/Ravencoin/RavencoinData</pre> <b>To STOP the node:</b><pre>./raven-cli -datadir=/media/pi/SSD/Ravencoin/RavencoinData stop</pre> <b>To CHECK the node:</b><pre>./raven-cli -datadir=/media/pi/SSD/Ravencoin/RavencoinData -getinfo</pre> When you're done, it should all look like this: [https://i.gyazo.com/8c02cd94d8012643c2ce2ec5dc5163f7.jpg <img src="https://i.gyazo.com/8c02cd94d8012643c2ce2ec5dc5163f7.jpg" width="800">]
== Setting up the Ravencoin node - The quick way ==
Now that you got the OS running, it is time for the fun part: setting up the Ravencoin node. Normally installing Ravencoin will take hours and syncing to the network will take days. However, I found some nice shortcuts for you.
#Instead of the repository of the The Core Ravencoin developersprovide binaries for ARM architecture, which are needed for the Raspberry Pi. The latest ravencoin core wallet binaries can be found [https://github.com/underdarkskies Under] who is also an active developer, compiled static versions of the RavenProject/Ravencoin wallet/node. Static means that this version works straight out of the box for each operating systemreleases here]. For the Raspberry a Pi, you always need the [https://github.com/underdarkskies/Ravencoin/releases a version that has ARM-linux version of Ravencoin]in its name. Open a console terminal and use the following codecommands to get it:
#:<pre>
#::cd ~/ wget https://github.com/underdarkskiesRavenProject/Ravencoin/releases/download/v2v4.13.2.1/raven-4.3.2.1-arm32v7.zip unzip raven-4.3.2.1-arm-linux-gnueabihfarm32v7.tar.gz zip cd arm32v7 gunzip ./tar -xvzf raven-4.3.2.1.1-arm-linux-gnueabihf.tar.gz </pre> '''Note:''' Under and I just saved you hours of headaches and 2 hours of compiling!# There is no working Ravencoin GUI for the Raspberry Pi. So you will need to get everything working from the command line. I like to put binaries into my default local user binary location so that I can globally access them from anywhere.
#:<pre>
#::cd sudo cp ./raven-4.3.2.1.1/bin sudo cp ./* /usr/local/bin </pre> Two files in this directory are important:
#*''ravend'': which is the Ravencoin deamon, a program that implements the Ravencoin protocol for remote procedure calls (RPCs). In simple terms: it will run a wallet/node as a background process and you can send instructions to it.
#*''raven-cli'': which is the command line interface for Ravencoin that you can use to send instructions to ravend.
#Next up is starting the deamon (''ravend'') process to start the Ravencoin node.
#:<pre>
#::Ravend ravend & </pre>#OPTIONAL: Ravend runs entirely in the background, so you cannot see what is happening. The process will create wallet and blockchain files in <code>~/.raven/</code>. Subsequently, it will start downloading the Ravencoin blockchain. This will '''Unfortunately, this may take forever! So, what we are going over a week due to do is stop the cpu speed of the pi.''ravend'' after ~5 minutes and thank [https://wwwMore advanced users may want to copy a pre-verified blockchain (i.youtubee.com/channel/UCTGFgr_1P8jdiM1Xend0ELw/featured Cryptoslo] for sharing , a link that contains 1bootstrap) from their PC and copy it to their Pi.8GB of the blockchain already.#:Make sure to stop ravend first (<precode>#::raven-cli stop cd </code>) before moving all blockchain files to <code>~/.raven wget http://147.135.10.45/blockchains/current/Raven_blockchain.zip unzip Raven_blockchain.zip </precode>.
#Additionally, we are going to make a configuration file to set up ravencoin optimally for the raspberry pi.
#:<pre>
#::touch ~/.raven/raven.conf nano ~/.raven/raven.conf </pre> Enter the following lines, and adjust user/login settings accordingly:#:<pre>rpcuser=rpcuser #optional rpcpassword=SETYOURPASSWORDHERE #optional rpcallowip=IP_ADDRESS_OF_HOST_YOU_ACCESS_RAVEN-CLI_FROM 127.0.0.1 #optional serverdaemon=1 upnp=1 listen=1 dbcache=800 maxmempool=50 disablewallet=1 logips=1 maxconnections=40 125 prune=42000 maxuploadtarget=5000 server=1 </pre> '''NoteNote1:''' It is important If you are are planning to set <code>server=1only access your node from your pi itself, skip the first 3 optional settings <br /code> otherwise you will not get incoming connections and <code>prune</code> lets '''Note2''': Opening up the RPC port to hosts outside your pi look at local trusted network is NOT RECOMMENDED, because the last X MB of rpcpassword is transmitted over the chain. Adjust this value based on your SD sizenetwork unencrypted. <br /> To save: CTRL+O ENTER, To exit: CTRL+X.
#Now you can start start ravend again to index the blockchain that you downloaded and to download the remaining bit (which may still take a day depending on your connection).
#:<pre>
#::Ravend ravend & </pre># Ok, so suppose you are as impatient as I am and you want to know more about the progress of ''ravend'' downloading the block chain. To make this insightful we are going to make use of a little script that I found using google and slightly adapted ([https://bitcoin.stackexchange.com/users/83847/hiding-ninja original creator]). It will use ''raven-cli'' to get information from the deamon and we will extract the most useful information from it.
#:<pre>
#::touch ~/check_status.sh nano ~/check_status.sh </pre> Enter the following lines:
== Connections and Security ==
First, if you are connecting your Pi with the internet through WIFI (and not an UTP cable), it is important to know that Raspbian power management turns off wifi after a couple of hours idling. Obviously, we don't want that to happen so you need to turn of WIFI power management (and ensure everything is up to date, which seems to have fixed some wifi problems I was having): <pre>sudo apt-get update && sudo apt-get -y dist-upgrade sudo iwconfig wlan0 power off </pre>
Ok, now that the blockchain is downloading, we are going to work on listening ports (to contribute to the Ravencoin network) and security.
# To make sure the necessary ports are open in your Raspberry Pi: <pre>sudo iptables -A INPUT -p tcp --dport 8767 -j ACCEPT sudo iptables -A INPUT -p udp --dport 8767 -j ACCEPT</pre>
# You also need to set port forwarding in your router. The necessary steps to do this differs per router and therefore I need to refer you to the manual of your router. Be sure to forward the port to the IP address of your Raspberry Pi and the port you are forwarding is 8767. You can find the IP address using the <code>ifconfig</code> command. It is either <code>192.168.X.X</code> or <code>10.0.X.X</code>.
#Next, we are going to install ''Uncomplicated Firewall'' (''ufw''). As mentioned in the introduction: this is highly recommended because you are opening a port to the outside world and you want to make sure it is only used for Ravencoin: <pre>sudo apt -get install ufw</pre> '''Note:''' ''ufw'' default rules allow for all outgoing connections, but block all incoming connections. <br /><br /> '''Optional:''' If you plan on using SSH to access your raspberry pi, make sure that ssh access is allowed (but limited): <pre>sudo apt install ufwlimit ssh</pre> '''Optional:''' You might want to add a few more limitations on ssh. For example if you’re planning on accessing your node from local network only. Depending on your local network: <pre>sudo ufw allow from 192.168.1.0/24 to any port 22</pre> Or <pre>sudo ufw allow from 10.0.0.0/24 to any port 22</pre> And/or if you have a dedicated static IP, for example: <pre>sudo ufw allow from 16.32.64.128 to any port 22</pre># To allow Ravencoin traffic: <pre>sudo ufw allow 8767 comment "'Ravencoin"'</pre> You can preview the results using: <pre>sudo ufw status verbose Example output: To Action From -- ------ ---- 22/tcp LIMIT IN Anywhere 8767 ALLOW IN Anywhere # Ravencoin 22/tcp (v6) LIMIT IN Anywhere (v6) 8767 (v6) ALLOW IN Anywhere (v6) # Ravencoin </pre>
# Enable Firewall: <pre>sudo ufw enable</pre>
# To make it a bit more difficult for someone trying to brute force his way in. We are going to give timeouts when the login password was wrong 5 times using Fail2Ban: <pre>sudo apt install fail2ban</pre> To see the banlist: <pre>sudo fail2ban-client status Example output: Status|- Number of jail: 1 `- Jail list: sshd</pre>
Connections using port:8767 on the left side are incoming connections.
== What to do after a reboot ==
I did not take you through steps that would make the node automatically start when you (re)boot your Raspberry Pi. In the case this does happen, execute the following commands to get everything back up: <pre> sudo iwconfig wlan0 power off ravend & </pre>
If you do like to have these commands executed during startup, you can follow the example given [http://thelowercasew.com/disabling-wifi-power-management-permanently-for-raspberry-pi-3-with-raspbian-jessie here], you only need to add an extra line <code>ravend &</code> in step 3.
----
And there you go, a full node on a Raspberry Pi! :)
Thanks to [@]unclear#0122, [@]Name#8397 and [@]Mapple#3283 (Discord handles) for giving valuable feedback. And [@]Under#7846 for sharing some thoughts on the static release and configuration settings.