Ethereum on ARM is a project that provides custom Linux images for Raspberry Pi 4 (Ethereum on ARM32 repo [1]),NanoPC-T4 [2] and RockPro64 [3] boards (Ethereum on ARM64 repo [4]) that run Geth or Parity Ethereum clients as a boot service and automatically turns these ARM devices into a full Ethereum node. The images include other components of the Ethereum ecosystem such as Status.im, Raiden, IPFS, Swarm and Vipnode as well as initial support for ETH 2.0 clients.

Images take care of all necessary steps, from setting up the environment and formatting the SSD disk to installing and running the Ethereum software as well as synchronizing the blockchain.

All you need to do is flash the MicroSD card, plug an ethernet cable, connect the SSD disk and power on the device.

The what and why of a 64 bits Raspberry Pi 4 image, 32 vs 64 bits

Following my last post [5], there are a couple of ongoing issues with the Raspberry Pi 4 that prevent Ethereum software to run as expected.

  • 32 bits Raspbian OS has issues handling the RAM memory [6]. This was partially solved by enabling an official 64 bits kernel but it still crashes eventually (although the node is totally usable).

  • Eth2 clients only support 64 bits architectures (as of today) so Raspberry Pi 4 users can not join public testnets from Prysm and Lighthouse implementations (as the userspace is still on 32 bits)

Given the massive adoption of the Raspberry Pi device, a 64 bit image would allow users to run full nodes without RAM issues and join ETH 2.0 testnets. While Raspbian certainly has a plan to migrate the OS to a full 64bit image there is not an official statement or roadmap about this. In the meanwhile, as ETH 2.0 phase 0 is around the corner, it is worth to try to find a viable alternative to run a 64bit OS on the Pi.

Installation of an Ubuntu server 64bit image for the Raspberry Pi 4 with Ethereum 1.0/2.0 ecosystem. Step by step guide.

James Chambers released an 18.04 Ubuntu server 64 bit image for the Raspberry Pi 4 using the latest Raspbian and the official 19.04 Ubuntu images [7] (amazing job, by the way). Obviously, this is work in progress, has no official support and is not considered stable. But it runs reasonably well and, as stated before, a native 64 bits image opens the door for joining the ETH 2.0 public test networks for Raspberry Pi 4 users as well as solving the 32 bits “out of memory” RAM issues. So it is worth it to give it a try.

DISCLAIMER: As this is a handcrafted image the installation it is not Plug and Play like the stable Ethereum on ARM images so you will need some Linux skills here. I tried to make the process as straightforward as possible though (it should take just 10-15 minutes).

The installation procedure has two main steps.

  1. Install Raspbian, needed to update the raspberry pi 4 to the latest (unstable) available firmware and format the USB disk

  2. Install Ubuntu 64 bits, to have a system with a 64 bit kernel and user space

INSTALL RASPBIAN

DISCLAIMER: In this step we’re going to update the firmware to the latest unstable version. It can break things and even make the Raspberry Pi unbootable (not likely at all, but possible), so, be careful here.

Prerequisites: Make sure you have the USB disk attached (blue USB port) and the network connected to the RPi 4.

1. In your Linux desktop: Open a terminal, download the Raspbian image, insert the MicroSD and flash it:

wget https://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2019-09-30/2019-09-26-raspbian-buster-lite.zip
unzip 2019-09-26-raspbian-buster-lite.zip
sudo dd bs=1M if=2019-09-26-raspbian-buster-lite.img of=/dev/mmcblk0 conv=fdatasync status=progress

2. In your Raspberry Pi 4: Insert the MicroSD, boot up and log in (user:pi password:raspberry). Keep in mind that ssh is not enabled by default so you will need a monitor/TV and a keyboard. Download Ethereum on ARM setup script to update the Firmware and format the USB 3 disk.

wget https://github.com/diglos/pi-gen/raw/ethraspbian2.0/stage2/04-ethereum/files/ethonarm-rpi4-ubuntu64bit-setup.sh
sudo sh ethonarm-rpi4-ubuntu64bit-setup.sh

3. Power off the Raspberry and extract the MicroSD again.

INSTALL UBUNTU SERVER

1. In your Linux desktop: Insert the MicroSD. Open a terminal, download James Chambers Ubuntu image and flash it:

wget https://github.com/TheRemote/Ubuntu-Server-raspi4-unofficial/releases/download/v26/ubuntu-18.04.3-preinstalled-server-arm64+raspi4.img.xz
xz -d ubuntu-18.04.3-preinstalled-server-arm64+raspi4.img.xz
sudo dd bs=1M if=ubuntu-18.04.3-preinstalled-server-arm64+raspi4.img of=/dev/mmcblk0 conv=fdatasync status=progress

2. In your Raspberry Pi 4: Insert the MicroSD, boot up and log in (user:ubuntu password:ubuntu). You will be prompted to change the password so you’ll need to log in twice. SSH is enabled by default.

3. RUN ETHEREUM ON ARM INSTALLATION SCRIPT

Download the install script and run it:

wget https://github.com/diglos/pi-gen/raw/ethraspbian2.0/stage2/04-ethereum/files/ethonarm-rpi4-ubuntu64bit-install.sh
sudo sh ethonarm-rpi4-ubuntu64bit-install.sh

4. Reboot the Pi and you will be running a full ETH 1.0 node / ETH 2.0 test client on a native Ubuntu server 64bit OS. Keep in mind that Geth and Status run by default so if you don’t want to run a full Ethereum node or a Status node you need to stop and disable them by running:

ETH 2.0 testnets on Raspberry Pi 4

Prysm and Lighthouse latest versions are now available so you can join/test the ETH 2.0 implementations with your Raspberry Pi 4:

Prysm 0.3.1: Take into account that at the time of writing this post, the sync process is very slow, see [8]. The packages provides 2 binaries: beacon-chain and validator.

Follow the instructions [9] to join the test network. Basically, get the Goerli ETH (no real value), set the validator password and run both clients. Once you have done all required steps and make sure everything goes as expected you can edit the file etc/ethereum/prysm-validator.conf and define the password previously set in order to run both clients as a systemd service:

sudo systemctl start prysm-beacon
sudo systemctl start prysm-validator

For more information about joining the Prysm testnet check the official docs [10]

Lighthouse 0.1.1: Currently provided as a single binary (no systemd service): lighthouse.

Lighthouse team is doing a fantastic progress as well [11] so expect news regarding the testnet soon. You can check their official documentation here [12]

ETH 2.0 is under heavy development right now [13] so I will be providing clients updates as soon as they are released. You can update the Eth 2.0 clients anytime by running:

sudo apt-get update && sudo apt-get install prysm-beacon prysm-validator lighthouse

If you have the time and the skills to install the image and join the ETH 2.0 testnets, please do. It is a very valuable feedback for all teams involved, particularly at this early stage.

Memory and cache tweaks

Working on enabling swap memory for the Ubuntu 64bit image I realized that Armbian developers put a lot of work trying to maximize the memory usage on these kind of boards [14]. This is something really important with such a limited resource as it needs to be as much efficient as possible (try to avoid “out of RAM” crashes and don’t waste too much CPU as well as disk throughput in swap tasks).

Particularly, I focused on 2 tasks:

  • Enabling Zram + Swap and trying to find a balance between virtual memory and Geth cache. I’m using Armbian scripts to handle Zram on the Raspberry Pi 4. Geth cache is set to 768 and Zram is limited to 25% of the available RAM.

  • Adjusting vm.swappiness parameter to maximize swap behaviour (and give priority to ZRAM over the Swap file) as Armbian does. Setting vm.swappiness to 100 forces Geth to use Zram whenever possible and it seems to work great.

I encourage users to test these parameters and try to find the best combination in order to achieve better sync results. I’m currently running several test on the Rpi4 in order to find an optimal setup.

On top of this, I also ran some tests with the NanoPC (in this case, lowering a little the default Geth cache to 768) that resulted on Sync time improvements:

NanoPC-T4 Fast Sync data

References

  1. https://github.com/diglos/pi-gen

  2. https://www.friendlyarm.com/index.php?route=product/product&product_id=225

  3. Store

  4. https://github.com/diglos/userpatches

  5. Ethereum on ARM. Raspberry Pi 4 "out of memory" crashes solution. ETH 2.0 on ARM progress (includes Prysm and Lighthouse clients for ARM64). Raspberry Pi 4 64bit support. New images available. from ethereum

  6. https://github.com/ethereum/go-ethereum/issues/20190

  7. https://jamesachambers.com/raspberry-pi-4-ubuntu-server-desktop-18-04-3-image-unofficial/

  8. https://github.com/prysmaticlabs/prysm/issues/4508

  9. https://prylabs.net/participate

  10. https://prysmaticlabs.gitbook.io/prysm/how-prysm-works/overview-technical

  11. https://lighthouse-book.sigmaprime.io/intro.html

  12. https://twitter.com/paulhauner/status/1217349576278999041

  13. https://blog.ethereum.org/2020/01/16/eth2-quick-update-no-7/

  14. https://forum.armbian.com/topic/5565-zram-vs-swap/





Source link

Register at Binance