Espers Wallet on Orange Pi PC 2
After having an Espers wallet on Ubuntu 16.04 for a longer time I decided to put this 24/7 wallet onto an Orange Pi PC2:
The current consumption at 5V is around 200mA (i.e., 1 W) with
- armbian as operating system (Ubuntu Desktop version: ARMBIAN 5.38.180128 nightly Ubuntu 16.04.3 LTS 4.14.15-sunxi64)
- vncserver (no monitor connected)
- lxdm as display manager
- Espers wallet in version 0.8.7.2-Patch 2 Alpha (https://github.com/CryptoCoderz/Espers from 2018–01–30)
- 8 GB SD card
I will explain how to setup such a system as until today I could not find such an implementation. Wherever possible, I will provide links to the corresponding sub-projects as usually time will change some details.
Setup OrangePi 2 PC2 with armbian as OS
At this stage I used a 8 GB SD card flying around and installed the armbian Ubuntu Desktop version following the steps on the armbian documentation.
After bringing up the armbian system you should be able to login via ssh (I use an Ubuntu PC, if you use a Windows PC you might login using putty or something similar):
ssh -l root ip_orangepi
and create a new user. This is asked automatically after the first boot (root password is 1234
.
Now, you should be able to login using the normal user using the password of the newly created user.
ssh -l user ip_of_orangepi
There should appear something like this:
user@normalpc:~$ ssh -l user 192.168.1.5
user@192.168.1.5’s password:
___ ____ _ ____ ____ ____
/ _ \ _ __ __ _ _ __ __ _ ___ | _ \(_) | _ \ / ___|___ \
| | | | ‘__/ _` | ‘_ \ / _` |/ _ \ | |_) | | | |_) | | __) |
| |_| | | | (_| | | | | (_| | __/ | __/| | | __/| |___ / __/
\___/|_| \__,_|_| |_|\__, |\___| |_| |_| |_| \____|_____|
|___/Welcome to ARMBIAN 5.38.180128 nightly Ubuntu 16.04.3 LTS 4.14.15-sunxi64
System load: 0.24 0.10 0.09 Up time: 1:29 hour
Memory usage: 65 % of 994MB IP: 192.168.1.5
CPU temp: 19°C
Usage of /: 69% of 7.1GLast login: Wed Jan 31 14:23:13 2018 from 192.168.1.2user@orangepipc2:~$
You can see that the host computer is at 192.168.1.2 and the OrangePi at 192.168.1.5.
Setup X server settings
As I run the OrangePi without monitor I have to reconfigure some settings of the X server as it might not start without monitor connected:
user@orangepipc2:~$ cat /etc/X11/xorg.conf.d/xorg.conf
Section "ServerFlags"
Option "BlankTime" "0"
Option "StandbyTime" "0"
Option "SuspendTime" "0"
Option "OffTime" "0"
EndSectionSection "Device"
Identifier "Configured Video Device"
Driver "dummy"
EndSectionSection "Monitor"
Identifier "Configured Monitor"
HorizSync 31.5-48.5
VertRefresh 50-70
Option "DPMS" "false"
EndSectionSection "Screen"
Identifier "Default Screen"
Monitor "Configured Monitor"
Device "Configured Video Device"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1024x800"
EndSubSection
EndSection
The dummy driver for the monitor was installed by
sudo apt install xserver-xorg-video-dummy
After this change, restart X server or the system using reboot
.
I want to mention here, that I interfaced some problems to login to sessions. The main reason was, that permission rights have not been set correctly. So I did:
sudo chown user:user ~/.Xauthority
sudo chown user:user ~/.ICEauthority
Setup Displaymanger lxdm
After the successful setup of the armbian on the OrangePi we will try to setup a displaymanager on which we might login using a VNC client.
Login via ssh
on the Orange Pi and install lxdm:
sudo apt install lxdm xfce4 lxsession lxterminal lxpanel lxde-common lxde-core
If necessary you might want to disable the nodm service:
sudo systemctl disable nodm
Now just start & stop the lxdm service for the first time (might not be necessary, though):
sudo service lxdm start
sudo service lxdm stop
Now, we are going to work with the generated config file:
user@orangepipc2:~$ cat /etc/lxdm/lxdm.conf
[base]
...## default session or desktop used when no systemwide config
session=/usr/bin/startxfc4...
A reboot should now start the lxdm displaymanager automatically. However, this cannot be verified if no monitor is connected — so let’s setup the VNC server.
Setup VNC server on OrangePi
In order to access the lxdm displaymanager I went for using VNC. This means setup a VNC server on the OrangePi and using a VNC client on my host computer. I use Remmina from my Ubuntu host PC.
Again, login to the Orange Pi via ssh.
Install vncserver (or vnc4server) package:
sudo apt install vncserver
Run the vncserver for the first time with
vncserver :1
You will be asked to give a password. I would only use 6 symbols as I remember that too long passwords are cut. Then, kill the server again:
vncserver -kill :1
The :1
is the display number.
Now. let’s configure the settings:
user@orangepipc2:~$ cat ~/.vnc/xstartup
#!/bin/sh# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
x-window-manager &
lxterminal &
/usr/bin/lxsession -s LXDE &
Now, we are good to go. Start again the vncserver:
user@orangepipc2:~$ vncserver :1New 'orangepipc2:1 (user)' desktop is orangepipc2:1Starting applications specified in /home/user/.vnc/xstartup
Log file is /home/user/.vnc/orangepipc2:1.log
Now, you should be able to establish a VNC connection frrom the host PC to the OrangePi. In my case I am using Ubuntu and Remmina whioch looks like that:
A double-click connects me to the OrangePi’s displaymanager:
Generate Espers Wallet
Here, I will explain how to directly generate the Espers wallet on the OrangePi from the github sources. So mainly you can grab the information here.
Login to the Orange Pi using ssh and install all necessary stuff:
sudo install git build-essential libssl-dev libdb++-dev libboost-all-dev libqrencode-dev
sudo install qt5-default qt5-qmake qtbase5-dev-tools qttools5-dev-tools
So, let’s grab the sources and put them into ~/Projects/Espers
mkdir ~/Projects
cd ~/Projects
git clone https://github.com/CryptoCoderz/Espers.git
cd Espers
mkdir build
cd build
I had an issue with the boost libraries so I added to the
~/Projects/Espers/Espers-qt.pro
two lines of code:
# Dependency library locations can be customized with:
# BOOST_INCLUDE_PATH, BOOST_LIB_PATH, BDB_INCLUDE_PATH,
# BDB_LIB_PATH, OPENSSL_INCLUDE_PATH and OPENSSL_LIB_PATH respectively# workaround for boost 1.58
BOOST_LIB_PATH = /usr/lib/aarch64-linux-gnu
BOOST_INCLUDE_PATH = /usr/include/boostDEFINES += BOOST_VARIANT_USE_RELAXED_GET_BY_DEFAULTOBJECTS_DIR = build
After performing
qmake ..
in the build directory, this should successfully create the Makefile in the build folder.
Nevertheless, I had some linker issues with the boost libraries, so I adapted the Makefile such that:
head -n 60 ~/Projects/Espers/build/Makefile
#############################################################################
# Makefile for building: Espers-qt
# Generated by qmake (3.0) (Qt 5.5.1)
# Project: ../Espers-qt.pro
# Template: app
# Command: /usr/lib/aarch64-linux-gnu/qt5/bin/qmake -o Makefile ../Espers-qt.pro
#############################################################################MAKEFILE = Makefile...
LIBS = $(SUBLIBS) -lminiupnpc /home/user/Projects/Espers/src/leveldb/libleveldb.a /home/user/Projects/Espers/src/leveldb/libmemenv.a -L/usr/lib/aarch64-linux-gnu/ -lssl -lcrypto -ldb_cxx -lboost_system -lboost_filesystem -lboost_program_options -lboost_thread -lrt -ldl -lQt5Widgets -lQt5Gui -lQt5Network -lQt5Core -lpthread -lGL
AR = ar cqs
RANLIB =
SED = sed
STRIP = strip####### Output directoryOBJECTS_DIR = build/
...
Now, let’s actually build the wallet with
make -j 1
The -j 1
was important. Although the H5 ARM has 4 cores, the memory is limited to 1GByte of RAM and some swap memory. So, generating one step at a time is a good idea.
From the make command (takes some time) should generate a Espers-qt executable:
ls -la ~/Projects/Espers/build/
total 21132
drwxrwxr-x 3 user user 12288 Jan 30 22:25 .
drwxrwxr-x 8 user user 4096 Jan 30 22:01 ..
drwxrwxr-x 2 user user 12288 Jan 30 21:13 build
-rwxrwxr-x 1 user user 9121992 Jan 30 22:25 Espers-qt
-rw-rw-r-- 1 user user 201250 Jan 30 22:25 Makefile
-rw-rw-r-- 1 user user 12276622 Jan 30 21:08 qrc_bitcoin.cpp
This is the file to be launched in the displaymanager.
Memory issues during building
If you, nevertheless, encounter memory issues you might generate some more swap memory directly on the SD card. This is usually not a good idea, but just for building it seems okay to me. I created swap files as followed (the information I got from here):
dd if=/dev/zero of=/var/my_swap bs=1024 count=1048576
creates a 1 GByte file filled with of zeros.
mkswap -f /var/my_swapswapon /var/my_swap
are activating the file.
When you are done with building, perform
swapoff /var/my_swaprm /var/my_swap
to deactivate the swap and delete the file.
Test the Espers wallet
Open your VNC client and connect to the OrangePi. Use the file manager to navigate to you build folder:
Open the Espers-qt by double clicking on it.
Wait a bit and the wallet should appear:
Here we go…
Sync wallets (host → OrangePi)
In case you want to sync your old wallet to the new one on the OrangePi: Just copy all the data in the ~/.ESP
folder from the host to the OrangePi (Wallet should be stopped on the OrangePi). I used ssh copy (scp) for that purpose. On the host comüuter, apply the following command to copy everything (including files and folders):
scp -r ~/.ESP/* user@192.168.1.5:/home/user/.ESP/
That should be it. Restart the wallet and look for sync.
I’m open for any questions, comments and better proposals.