Pub

Based on a powerful Orange Pi One, one MicroSD 16GB (or less) and a 5V power supplier Pub is the first poor-man Liquid node (~20$ total cost 💵).

💻 Hardware

Install OS

Download the Armbian Bionic image based on Ubuntu Bionic for the board at the Armbian page

Install OS on the 16GB MicroSD.

First run

Install the MicroSD in the OrangePi, attach ethernet cable and turn on the power. After some minutes you will be able to connect via SSH using the board IP address (in my case 192.168.1.101), the root user and the default password 1234.


ssh root@192.168.1.101
root@192.168.1.101's password:


You are required to change your password immediately (root enforced)
  ___                               ____  _    ___
 / _ \ _ __ __ _ _ __   __ _  ___  |  _ \(_)  / _ \ _ __   ___
| | | | '__/ _` | '_ \ / _` |/ _ \ | |_) | | | | | | '_ \ / _ \
| |_| | | | (_| | | | | (_| |  __/ |  __/| | | |_| | | | |  __/
 \___/|_|  \__,_|_| |_|\__, |\___| |_|   |_|  \___/|_| |_|\___|
                       |___/

Welcome to ARMBIAN 5.75 stable Ubuntu 18.04.1 LTS 4.19.20-sunxi
System load:   0.38 0.31 0.13  	Up time:       2 min
Memory usage:  14 % of 493MB  	IP:            192.168.1.101
CPU temp:      28°C
Usage of /:    5% of 15G

Change the root password.


Last login: Sat Mar 16 09:32:35 2019 from 192.168.1.102
Changing password for root.
(current) UNIX password:
Enter new UNIX password:
Retype new UNIX password:


Thank you for choosing Armbian! Support: www.armbian.com

And create a new user for the OrangePi.


Creating a new user account. Press Ctrl-C to abort

Please provide a username (eg. your forename): drunkoshi
Trying to add user drunkoshi
Adding user `drunkoshi' ...
Adding new group `drunkoshi' (1000) ...
Adding new user `drunkoshi' (1000) with group `drunkoshi' ...
Creating home directory `/home/drunkoshi' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for drunkoshi
Enter the new value, or press ENTER for the default
	Full Name []: Drunkoshi Franziskanoto
	Room Number []:
	Work Phone []:
	Home Phone []:
	Other []:
Is the information correct? [Y/n]

Dear Drunkoshi Franziskanoto, your account drunkoshi has been created and is sudo enabled.
Please use this account for your daily work from now on.
               

Install tor and enable hidden service on port 5000 and 22.


apt update
apt install -y tor
echo "HiddenServiceDir /var/lib/tor/hidden_service/" >> /etc/tor/torrc
echo "HiddenServicePort 5000 127.0.0.1:5000" >> /etc/tor/torrc
echo "HiddenServicePort 22 127.0.0.1:22" >> /etc/tor/torrc
/etc/init.d/tor restart
               

Enable a big swap file (repeat this procedure when you need it).


swapoff -a
touch /swapfile
dd if=/dev/zero of=/swapfile bs=1M count=4096
mkswap /swapfile
swapon /swapfile
               

Install Liquid

Install requirements and libraries.


apt updated
apt install -y build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-program-options-dev libboost-test-dev libboost-thread-dev install libboost-all-dev libzmq3-dev
apt install -y software-properties-common
add-apt-repository ppa:bitcoin/bitcoin
apt update
apt install -y libdb4.8-dev libdb4.8++-dev
               

Compile Liquid binaries.


./autogen.sh
./configure CXXFLAGS="--param ggc-min-expand=1 --param ggc-min-heapsize=32768"
make
make install
               

Configure and run

Create a configuration file in the /root/.liquid folder.


mkdir /root/.liquid
cat << EOF > /root/.liquid/liquid.conf
# Standard Liquid stuff
rpcuser=username
rpcpassword=password
rpcallowip=0.0.0.0/0

daemon=1
listen=1
txindex=1

# Low memory
blocksonly=1
dbcache=20
maxsigcachesize=4
maxconnections=4
rpcthreads=1

# Pegin
validatepegin=1
mainchainrpchost=coreip
mainchainrpcuser=coreuser
mainchainrpcpassword=corepassword
mainchainrpcport=8332
EOF
               

Create a systemd unit in order to start and stop the server.


cat << EOF > /etc/systemd/system/liquidd.service
# Systemd unit for Liquid
# /etc/systemd/system/liquidd.service

[Unit]
Description=Liquid daemon
After=network.target

[Service]
ExecStart=/usr/local/bin/liquidd -daemon -conf=/root/.liquid/liquid.conf -pid=/run/liquid/liquid.pid
RuntimeDirectory=liquid
Type=forking
PIDFile=/run/bitcoind/bitcoind.pid
Restart=on-failure

# Hardening measures
####################

# Provide a private /tmp and /var/tmp.
PrivateTmp=true

# Mount /usr, /boot/ and /etc read-only for the process.
ProtectSystem=full

# Disallow the process and all of its children to gain
# new privileges through execve().
NoNewPrivileges=true

# Use a new /dev namespace only populated with API pseudo devices
# such as /dev/null, /dev/zero and /dev/random.
PrivateDevices=true

# Deny the creation of writable and executable memory mappings.
MemoryDenyWriteExecute=true

[Install]
WantedBy=multi-user.target
EOF
systemctl enable liquidd.service
systemctl start liquidd.service
               

Pub dashboard

In order to install the Pub dashboard you can type the following commands.


apt install -y virtualenv libffi-dev libssl-dev zlib1g-dev libjpeg-dev
cd /opt
git clone https://github.com/valerio-vaccaro/pub-dashboard.git
cd pub-dashboard
virtualenv -p python3 venv3
. venv3/bin/activate
pip install -r requirements.txt
deactivate
sh start.sh
               

You need to create a configuration file like the sample present in the repository.


cp liquid.conf.sample liquid.conf
               

Then you can start your dashboard with the start command.


sh start.sh
               

Your pub dasboard will be available at http://127.0.0.1:5000 and you can log in with user "admin" and password "password".

Backup your wallet

Remember to backup your wallet.dat on a secure device.