πŸ§‘β€πŸ­ Standard Hardware Guide
This guide is written for liquidity providers to turn a Raspberry Pi into an always-on OpenDEX node.
Two options are available:
    1.
    Light setup using Neutrino and a random open eth provider or optionally Infura. This keeps the setup light-weight & cheap, but creates a certain dependency on other people's full nodes. Supported by all Pi3/4 models.
    2.
    Full setup using bitcoind, litecoind and geth. Requires more resources and an SSD, but keeps the setup trustless. Supported only by the Pi4 with 4GB RAM or more.
If you are not sure, we recommend to start with the light setup. If you opt for the Pi4 4/8GB, you can switch to the full setup at any time.

Light Reference Shopping List (Spain): ~65 €

Full Reference Shopping List (Spain): ~290 €

Pi Basic Setup

    1.
    ​Download Ubuntu 20.04 for the Pi onto your computer, choosing 64-bit. Any other 64-bit (also called arm64, aarch64, armv8) linux os for the Pi is fine too. Systems like Raspberry Pi OS, which, at the time of writing, are still based on the 32-bit (armv7) architecture , are not supported. This guide was written using Ubuntu 20.04.
    2.
    Insert the microSD card into your computer and follow the flash instructions.
    3.
    Optional: If you don't have a screen, usb keyboard and even an ethernet cable available, you can pre-configure Wifi for a headless setup.
1
# on your linux computer, cd to the mounted microSD card partition "writable" and copy the wifi sample file. If you can't see any partition called "writable", then you are probably running something other than linux and need to figure out how to mount an ext4 filesystem.
2
sudo cp ./usr/share/doc/netplan/examples/wireless.yaml ./etc/netplan/
3
# open the file to edit
4
sudo nano ./etc/netplan/wireless.yaml
5
# strip down the file to the bare minmum for the Pi to get an IP automatically assigned by your router
6
network:
7
version: 2
8
wifis:
9
wlan0:
10
dhcp4: yes
11
dhcp6: no
12
access-points:
13
"<YOUR WIFI SSID>":
14
password: "<YOUR WIFI PASSWORD>"
15
# if you can't access your router to read out your Pi's IP, you can also configure a static IP now
16
addresses: [192.168.1.42/24]
17
gateway4: 192.168.1.1
18
nameservers:
19
addresses: [192.168.1.1, 8.8.8.8]
20
# CTRL+S, CTRL+X.
Copied!
    1.
    Insert the microSD card into your Pi, connect it to your router via ethernet cable and to a power supply. Connecting a screen via HDMI and a USB keyboard makes life easier, but checking the assigned IP in your router and SSHing in from your computer works too.
    2.
    Follow the inital setup instructions. Default user + password is ubuntu. You will be asked to change the password on first login.
    3.
    Update ubuntu via sudo apt update && sudo apt upgrade
    4.
    If you are using Ubuntu 20.04, install docker & docker-compose by running sudo apt install docker.io. Otherwise if you are using any version besides Ubuntu 20.04, follow the official instructions (select arm64 in step 4 of "Set up the repository") to install docker.
    5.
    Add new user opendex:
1
[email protected]:~$ sudo adduser opendex
2
Adding user `opendex' ...
3
Adding new group `opendex' (1001) ...
4
Adding new user `opendex' (1001) with group `opendex' ...
5
Creating home directory `/home/opendex' ...
6
Copying files from `/etc/skel' ...
7
New password:
8
Retype new password:
9
passwd: password updated successfully
10
Changing the user information for opendexd
11
Enter the new value, or press ENTER for the default
12
Full Name []:
13
Room Number []:
14
Work Phone []:
15
Home Phone []:
16
Other []:
17
Is the information correct? [Y/n] [email protected]:~$ Y
Copied!
    1.
    Add the opendex user to the sudo group (advanced users can skip this and use another user to run sudo commands), the docker group and test if docker is working:
1
[email protected]:~$ sudo usermod -aG sudo opendex
2
[email protected]:~$ sudo usermod -aG docker opendex
3
# switch to user opendexd
4
[email protected]:~$ sudo su - opendex
5
[email protected]:~$ docker run hello-world
6
Hello from Docker!
7
This message shows that your installation appears to be working correctly.
Copied!
    1.
    Looking good! Optionally, add an alias to enter your opendexd environment by simply typing "opendex":
1
[email protected]:~$ sudo nano ~/.bash_aliases
2
# add the line
3
alias opendex='bash ~/opendex.sh'
4
# CTRL+S, CTRL+X. Then run
5
[email protected]:~$ source ~/.bashrc
Copied!
    1.
    Connect the USB stick to your Pi and set it up. It is very important to do this for a mainnet setup (given you do not want to lose money)!
1
# check the USB stick's path with
2
[email protected]:~$ ls -la /dev/ | grep sd
3
crw------- 1 root root 2, 61 Dec 3 16:27 ptysd
4
brw-rw---- 1 root disk 8, 0 Dec 3 16:27 sda
5
brw-rw---- 1 root disk 8, 1 Dec 3 16:27 sda1 #this is your USB Stick
6
crw------- 1 root root 3, 61 Dec 3 16:27 ttysd
7
# set it to automount via fstab
8
[email protected]:~$ sudo nano /etc/fstab
9
# add the line
10
/dev/sda1 /media/USB ext4 defaults 0 2
11
# CTRL+S, CTRL+X. Then mount it
12
[email protected]:~$ sudo mkdir /media/USB
13
[email protected]:~$ sudo mount -a
14
# check if mounting worked
16
# make sure opendexd can use it
17
[email protected]:~$ sudo chown opendex:opendex /media/USB
Copied!
From here the light and full setup require different settings. Continue choosing one.

Pi Light Setup

If you are using a Pi model with 2GB of RAM or more, you can continue here. If you are using a Pi model with <2GB of RAM, we will have to catch a temporary RAM spike when creating the opendex environment by creating a swap file (overflow RAM) of 2GB on the internal sd card:
1
# create the swap file
2
[email protected]:~$ sudo fallocate -l 2G /home/opendex/swapfile
3
# mark it as swap file
4
[email protected]:~$ sudo chmod 600 /home/opendex/swapfile && sudo mkswap /home/opendex/swapfile
5
# enable it
6
[email protected]:~$ sudo swapon /home/opendex/swapfile
7
# set it to automount via fstab
8
[email protected]:~$ sudo nano /etc/fstab
9
# add the line
10
/home/opendex/swapfile none swap sw 0 0
11
# # CTRL+S, CTRL+X. Let's verify it's working & reboot
12
[email protected]:~$ sudo swapon --show
13
NAME TYPE SIZE USED PRIO
14
/home/opendex/swapfile file 2G 0B -2
15
[email protected]:~$ sudo reboot
16
# after reboot, let's check if the swapfile is still active
17
[email protected]:~$ sudo swapon --show
18
NAME TYPE SIZE USED PRIO
19
/home/opendex/swapfile file 2G 0B -2
Copied!
Light setup - DONE! Continue here.

Pi Full Setup

Connect the SSD to your Pi4 and set it up:
1
# let's check the SSD's path
2
[email protected]:~$ ls -la /dev/ | grep sd
3
crw------- 1 root root 2, 61 Dec 3 16:27 ptysd
4
brw-rw---- 1 root disk 8, 0 Dec 3 16:27 sda
5
brw-rw---- 1 root disk 8, 1 Dec 3 16:27 sda1 #this is your USB Stick
6
brw-rw---- 1 root disk 8, 16 Jan 28 10:45 sdb
7
brw-rw---- 1 root disk 8, 17 Jan 28 10:45 sdb1 #this is your SSD
8
crw------- 1 root root 3, 61 Dec 3 16:27 ttysd
9
# set it to automount via fstab
10
[email protected]:~$ sudo nano /etc/fstab
11
# add the line
12
/dev/sdb1 /media/SSD ext4 defaults 0 2
13
# CTRL+S, CTRL+X. Then mount it
14
[email protected]:~$ sudo mkdir /media/SSD
15
[email protected]:~$ mount -a
16
# check if mounting worked
18
# make sure opendexd can use it without sudo privileges
19
[email protected]:~$ sudo chown opendexd:opendexd /media/SSD
Copied!
Let's do a quick performance test of the SSD. If you are close to these values, you are good to go, whereas <100 MB/s would be too slow:
1
[email protected]:~$ sudo dd if=/dev/zero of=/media/SSD/deleteme.dat bs=32M count=64 oflag=direct
2
64+0 records in
3
64+0 records out
4
2147483648 bytes (2.1 GB, 2.0 GiB) copied, 12.8709 s, 167 MB/s
5
[email protected]:~$ sudo dd if=/media/SSD/deleteme.dat of=/dev/null bs=32M count=64 iflag=direct
6
64+0 records in
7
64+0 records out
8
2147483648 bytes (2.1 GB, 2.0 GiB) copied, 15.5791 s, 138 MB/s
9
[email protected]:~$ sudo rm /media/SSD/deleteme.dat
Copied!
Important: geth needs loads of RAM when syncing, so we need to create a swap file (overflow RAM) of 8GB on the external SSD:
1
# create a swap file on the SSD, we recommend a size of 8GB
2
[email protected]:~$ sudo fallocate -l 8G /media/SSD/swapfile
3
# mark it as swap file
4
[email protected]:~$ sudo chmod 600 /media/SSD/swapfile && sudo mkswap /media/SSD/swapfile
5
# enable it
6
[email protected]:~$ sudo swapon /media/SSD/swapfile
7
# set it to automount via fstab
8
[email protected]:~$ sudo nano /etc/fstab
9
# add the line
10
/media/SSD/swapfile none swap sw 0 0
11
# # CTRL+S, CTRL+X. Let's verify it's working & reboot
12
[email protected]:~$ sudo swapon --show
13
NAME TYPE SIZE USED PRIO
14
/media/SSD/swapfile file 8G 0B -2
15
[email protected]:~$ sudo reboot
16
# after reboot, let's check if the swapfile is still active
17
[email protected]:~$ sudo swapon --show
18
NAME TYPE SIZE USED PRIO
19
/media/SSD/swapfile file 8G 0B -2
Copied!
Full setup - DONE! Continue here.
Last modified 4d ago