DeepOnion staking on Raspberry Pi 3

in #deeponion6 years ago

Introduction

DeepOnion (ONION) is an anonymous cryptocurrency utilizing the TOR network to enable truly private transactions. It uses both Proof-of-Work (PoW) and Proof-of-Stake (PoS) for gaining distributed consensus.

This post is about contributing to the Proof-of-Stake (PoS) mechanism and profiting from it.

Aim

Stake coins by running the DeepOnion wallet 24/7 on a Raspberry Pi with low power consumption.

Assumptions

  • You possess some ONION coins. You'll earn a percentage of it as staking reward, i.e. the more coins you have, the higher your profit will be.
  • You are familiar with using the Linux command line for simple tasks like generating and modifying a text file.
  • Helpful: You have a computer with Linux operating system running on it.

Materials

  • Hardware: Raspberry Pi 3 model B with SD card, arbitrary protective case and power supply. Optional USB keyboard and monitor.
  • Operating system: Raspian Lite version Jessie from 2017-06-21
  • Image burning software: Etcher or another tool of your choice
  • Wallet software: Latest source code from git repository compiled on the Raspberry Pi itself

Protocol

Step 1: Installing an operating system on the Raspberry Pi

I am using Raspian Lite which comes without graphical user interface (GUI), however, Raspbian with GUI might also work and simplify things for unexperienced users. I ended up using an older version since compilation of the wallet failed on the most recent version due to dependency issues (that might be caused by a newer openssl version in the repositories with some API changes that break the C++ code).

Step 2: Access your Raspberry Pi

I connect to my Raspberry Pi from my laptop on the command line via SSH. This is not strictly necessary, you can also plug in a USB keyboard and monitor to your Raspberry Pi instead and simply open up a terminal window instead of the following steps a) to f).

To connect via SSH, the Raspberry Pi must have access to the Wi-Fi and SSH must be manually activated. Both can be achieved by placing files onto the SD card before plugging it into the Raspberry Pi.

  • a) To automatically activate SSH on the first (or next) startup of the Raspberry Pi, put an empty file named ssh into the boot partiton, e.g. with the command sudo touch ssh.

  • b) To automatically activate WLAN access on the first (or next) startup of the Raspberry Pi, put a file named wpa_supplicant.conf into the boot partition, e.g. with the command sudo nano wpa_supplicant.conf, with following content (where <wifi name> and <wifi password> is replaced by your own data):

country=GB
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
        ssid="<wifi name>"
        psk="<wifi password>"
}
  • c) Start your Raspberry Pi and find out which IP address it got in your local network, e.g. by taking a look at your WiFi router web interface (if it has one) or using some Linux tool to see network members (google is your friend).

  • d) Connect to your Raspberry Pi with the command ssh pi@<ip address> where <ip address> is for example 10.0.0.42 and the default password is raspberry

  • e) Congratulations, you have now all powers over your mini-computer from within a remote shell! For security reasons, you should create a new user with non-default password and delete the default user named pi. Also change the password of the superuser. This is done with following commands (where <yourusername> is replaced by a name of your choice).

sudo -i
adduser <yourusername>
adduser <yourusername> sudo

sudo deluser pi

sudo passwd root
  • f) Optionally, set a static IP address by editing the file /etc/dhcpcd.conf with the command sudo nano /etc/dhcpcd.conf and appending following text at the end (where <desired Raspberry Pi IP address> could be 10.0.0.42 if your router has an address like 10.0.0.16, more info here)
interface wlan0
static ip_address=<desired Raspberry Pi IP address>/24
static routers=<Router IP address>
static domain_name_servers=<Router IP address>

Step 3: Update your system

sudo apt-get update
sudo apt-get upgrade

Step 4: Install dependencies

I'm not sure if all of the following is actually required but with this the compilation should work:
sudo apt-get install qt5-default qt5-qmake qtbase5-dev-tools build-essential libboost-dev libboost-system-dev libboost-filesystem-dev libboost-program-options-dev libboost-thread-dev libssl-dev libdb++-dev build-essential libtool autotools-dev autoconf pkg-config libssl-dev libboost-all-dev libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler libqrencode-dev autoconf openssl libssl-dev libevent-dev libminiupnpc-dev

Step 5: Download the DeepOnion wallet source files from GitHub and compile them

In your home folder execute following commands. The make lines will start compilations that can take quite some time on the Raspberry Pi. qmakemight only print a help text and probably can be skipped.

cd ~
mkdir deeponion_build
cd deeponion_build
git clone https://github.com/deeponion/deeponion.git

cd deeponion
chmod +x src/leveldb/build_detect_platform
cd src/leveldb
make libleveldb.a libmemenv.a
qmake
make

cd ~/deeponion_build
mkdir berkleydb
cd berkleydb
wget 'http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz'
tar -xzf db-4.8.30.NC.tar.gz
cd db-4.8.30.NC/build_unix/
../dist/configure --enable-cxx
sudo make install

cd ~/deeponion_build/deeponion/src/
make -f makefile.unix
sudo mv DeepOniond ~/DeepOniond

cd ~
chmod +x DeepOniond

If everything worked, you have the executable DeepOniond in your home folder. You don't need the build directory anymore and can delete it with rm -rf ~/deeponion_build.

Step 6: Configure the DeepOnion wallet

mkdir ~/.DeepOnion
cd ~/.DeepOnion
touch DeepOnion.conf

Paste following contents into the configuration textfile DeepOnion.conf with the nano editor by the command nano ~/.DeepOnion/DeepOnion.conf(and STRG+x, y, Enter for saving and closing) but replace the node addresses with recent ones from https://deeponion.org/DeepOnion.conf.php

testnet=0
listen=1
server=1
daemon=1
maxconnections=90
rpcuser=yourIrrelevantUsername
rpcpassword=yourIrrelevantPassword
rpcport=18580
rpcconnect=127.0.0.1
rpcallowip=127.0.0.1

addnode=slz2b7zvopuigglc.onion:17570
addnode=rv5wufytede2ki4q.onion:17570
addnode=mjtsga47m4ehvzc6.onion:17570
addnode=msjtgahbiplfdf7z.onion:17570
addnode=udds4ybjgb7bm5hv.onion:17570
addnode=jynkusuegv3c5kt5.onion:17570
addnode=v45vkus7rfmzkx5n.onion:17570
addnode=dy4x34flsdmnkees.onion:17570
addnode=whtz3syntx57owrg.onion:17570
addnode=ykirxcowpwfas5ny.onion:17570
addnode=4e4pjxcj4hvt6qnh.onion:17570

Step 7: Run the wallet

  • a) Start the DeepOnion Daemon, i.e. the wallet running in the background: ./DeepOniond

  • b) Get a list of available commands: ./DeepOniond help

  • c) Add your address to the wallet by providing the private key (never give this to anybody, it allows to transfer funds!!!): ./DeepOniond setaccount <DeepOnionaddress> <arbitraryAccountName>

  • c) Check the status of the wallet: ./DeepOniond getinfo After some time you should see a number greater than 0 for the number of connections "connection" : <number> The wallet will start to download the blockchain which will require significant amount of time

  • d) Check your balance: ./DeepOniond getbalance Don't flip out if it is zero in the beginning. I think it will only show your balances once you have downloaded enough of the blockchain such that the block containing the first transaction to your address is contained.

  • e) Check if you are staking ./DeepOniond getstakinginfo where "enabled" and "staking" should be true

Used references

Concluding remarks

I hope this guide makes life easier for you. It took me quite some time to get things done and written down. My apologies if not everything is working as smoothly as desired, I'm by far no expert on these things and it also took me a lot of nerves until the wallet was working. If you find errors please let me know and I'll correct it.

I'm a student living on low budget and only recently stumbled into the crypto world, hoping to gain some financial independence. Any gifts are highly appreciated and help me a lot. Thank you sincerely!

My DeepOnion address is: DkB6AxpESuSoSAmthqfARSupjjbmEwR7R3

Sort:  
Loading...

Congratulations @trait, you have decided to take the next big step with your first post! The Steem Network Team wishes you a great time among this awesome community.


Thumbs up for Steem Network´s strategy

The proven road to boost your personal success in this amazing Steem Network

Do you already know that awesome content will get great profits by following these simple steps, that have been worked out by experts?

Man the etcher program is a POS on one computer it gives me an error saying I don't have permission now on a completely different computer it is stuck at "starting...." been about 30 minutes hasn't moved

Congratulations @trait! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 1 year!

Click here to view your Board

Support SteemitBoard's project! Vote for its witness and get one more award!

Congratulations @trait! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Coin Marketplace

STEEM 0.17
TRX 0.13
JST 0.029
BTC 56583.42
ETH 2984.52
USDT 1.00
SBD 2.15