Lumaktaw sa main content

Tumulong na i-translate ang page na ito

🌏

Tinitingnan mo ang pahinang ito sa English dahil hindi pa namin ito naisalin. Tulungan kaming isalin ang nilalamang ito.

I-translate ang page

Walang mga bug dito!🐛

Ang pahinang ito ay hindi isinasalin. Sinadya naming iwan ang pahinang ito sa Ingles sa ngayon.

This tutorial is out of date after the merge and may not work. Please raise a PR if you would like to contribute.

How to turn your Raspberry Pi 4 into a node just by flashing the MicroSD card

clients
execution layer
consensus layer
nodes
Intermediate
✍EthereumOnArm
📚Ethereum on ARM
📆June 10, 2022
⏱️7 minute read

Ethereum on Arm is a custom Linux image that can turn a Raspberry Pi into an Ethereum node.

To use Ethereum on Arm to turn a Raspberry Pi into an Ethereum node, the following hardware is recommended:

  • Raspberry 4 (model B 8GB)
  • MicroSD Card (16 GB Class 10 minimum)
  • 2 TB SSD minimum USB 3.0 disk or an SSD with a USB to SATA case.
  • Power supply
  • Ethernet cable
  • Port forwarding (see clients for further info)
  • A case with heatsink and fan
  • USB keyboard, Monitor and HDMI cable (micro-HDMI) (Optional)

Why run Ethereum on ARM?

ARM boards are very affordable, flexible, small computers. They are good choices for running Ethereum nodes because they can be bought cheaply, configured so that all their resources focus just on the node, making them efficient, they consume low amounts of power and have are physically small so they can fit unobtrusively in any home. It is also very easy to spin up nodes because the Raspberry Pi's MicroSD can simply be flashed with a prebuilt image, with no downloading or building software required.

How does it work?

The Raspberry Pi's memory card is flashed with a prebuilt image. This image contains everything needed to run an Ethereum node. With a flashed card, all the user needs to do is power-on the Raspberry Pi. All the processes required to run the node are automatically started. This works because the memory card contains a Linux-based operating system (OS) on top of which system-level processes are automatically run that turn the unit into an Ethereum node.

Ethereum cannot be run using the popular Raspberry Pi Linux OS "Raspbian" because Raspbian still uses a 32-bit architecture which leads Ethereum users to run into memory issues and consensus clients do not support 32-bit binaries. To overcome this, the Ethereum on Arm team migrated to a native 64-bit OS called "Armbian".

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

Note on execution and consensus clients

The Ethereum on Arm documentation explains how to set up either an execution client OR a consensus client, except for two Ethereum testnets (Kiln and Ropsten). This optionality is only possible in advance of Ethereum's upcoming transition from proof-of-work (PoW) to proof-of-stake (PoS) known as The Merge.

After The Merge, it will not be possible to run execution and consensus clients separately—they must be run as a pair. Therefore, in this tutorial we will run a pair of execution and consensus clients together on an Ethereum testnet (Kiln).

The Kiln Raspberry Pi 4 Image

Kiln is a public testnet specifically designed for testing The Merge. Ethereum on Arm developed an image allowing users to rapidly spin up a pair of Ethereum clients on this merge testnet. The Kiln merge has already happened, but the network is still live, so it can be used for this tutorial. Ether on Kiln has no real-world value.

The Kiln Raspberry Pi 4 image is a "plug and play" image that automatically installs and sets up both the execution and consensus clients, configuring them to talk to each other and connect to the Kiln network. All the user needs to do is start their processes using a simple command. The image contains four execution clients (Geth, Nethermind, Besu and Erigon) and four consensus clients (Lighthouse, Prysm, Nimbus, Teku) that the user can choose from.

Download the Raspberry Pi image from Ethereum on Arm and verify the SHA256 hash:

1# From directory containing the downloaded image
2shasum -a 256 ethonarm_kiln_22.03.01.img.zip
3# Hash should output: 485cf36128ca60a41b5de82b5fee3ee46b7c479d0fc5dfa5b9341764414c4c57
4

Note that for users that do not own a Raspberry Pi but do have an AWS account, there are ARM instances available that can run the same image. Instructions and the AWS image are available to download from Ethereum on Arm (https://ethereum-on-arm-documentation.readthedocs.io/en/latest/kiln/kiln-testnet.html).

Flashing the MicroSD

The MicroSD card that will be used for the Raspberry Pi should first be inserted into a desktop or laptop so it can be flashed. Then, the following terminal commands will flash the downloaded image onto the SD card:

1# check the MicroSD card name
2sudo fdisk -I
3
4>> sdxxx
5

It is really important to get the name correct because the next command includes dd which completely erases the existing content of the card before pushing the image onto it. To continue, navigate to the directory containing the zipped image:

1# unzip and flash image
2unzip ethonarm_kiln_22.03.01.img.zip
3sudo dd bs=1M if=ethonarm_kiln_22.03.01.img of=/dev/mmcblk0 conv=fdatasync status=progress
4

The card is now flashed, so it can be inserted into the Raspberry Pi.

Start the node

With the SD card inserted into the Raspberry Pi, connect the ethernet cable and SSD then switch the power on. The OS will boot up and automatically start performing the preconfigured tasks that turn the Raspberry Pi into an Ethereum node, including installing and building the client software. This will probably take 10-15 minutes.

Once everything is installed and configured, log in to the device via an ssh connection or using the terminal directly if a monitor and keyboard is attached to the board. Use the ethereum account to log in, as this has permissions required to start the node.

1User: ethereum
2Password: ethereum
3

The user can then choose the execution-consensus client combination they wish to run, and start their systemctl processes as follows (example runs Geth and Lighthouse):

1sudo systemctl start geth-lh
2sudo systemctl start lh-geth-beacon
3

The logs can be checked using

1# logs for Geth
2sudo journalctl -u geth-lh -f
3#logs for lighthouse
4sudo journalctl -u lh-geth-beacon -f
5

The specific service names for every combination of clients are available at the Ethereum on Arm docs. They can be used to update the commands provided here for any combination.

Validators

In order to run a validator you must first have access to 32 testnet ETH, which must be deposited into the Kiln deposit contract. This can be done by following the step-by-step guide on the Kiln Launchpad. Do this on a desktop/laptop, but do not generate keys—this can be done directly on the Raspberry Pi.

Open a terminal on the Raspberry Pi and run the following command to generate the deposit keys:

1cd && deposit new-mnemonic --num_validators 1 --chain kiln
2

Keep the mnemonic phrase safe! The command above generated two files in the node's keystore: the validator keys and a deposit data file. The deposit data needs to be uploaded into the launchpad, so it must be copied from the Raspberry Pi to the desktop/laptop. This can be done using an ssh connection or any other copy/paste method.

Once the deposit data file is available on the computer running the launchpad, it can be dragged and dropped onto the + on the launchpad screen. Follow the instructions on the screen to send a transaction to the deposit contract.

Back on the Raspberry Pi, a validator can be started. This requires importing the validator keys, setting the address to collect rewards, then starting the preconfigured validator process. The example below is for Lighthouse—instructions for other consensus clients are available on the Ethereum on Arm docs:

1# import the validator keys
2lighthouse-kl account validator import --directory=/home/ethereum/validator_keys --datadir=/home/ethereum/.lh-geth/kiln/testnet-lh
3
4# set the reward address
5sudo sed -i '<ETH_ADDRESS>' /etc/ethereum/kiln/lh-geth-validator.conf
6
7# start the validator
8sudo systemctl start lh-geth-validator
9

Congratulations, you now have a full Ethereum node and validator running on a Raspberry Pi!

Feedback appreciated

We know the Raspberry Pi has a massive user base that could have a very positive impact on the health of the Ethereum network. Please dig into the details in this tutorial, try running on other testnets or even Ethereum Mainnet, check out the Ethereum on Arm GitHub, give feedback, raise issues and pull requests and help advance the technology and documentation!

References

  1. https://ubuntu.com/download/raspberry-pi
  2. https://wikipedia.org/wiki/Port_forwarding
  3. https://prometheus.io
  4. https://grafana.com
  5. https://forum.armbian.com/topic/5565-zram-vs-swap/
  6. https://geth.ethereum.org
  7. https://nethermind.io
  8. https://www.hyperledger.org/projects/besu
  9. https://github.com/prysmaticlabs/prysm
  10. https://lighthouse.sigmaprime.io
  11. https://ethersphere.github.io/swarm-home
  12. https://raiden.network
  13. https://ipfs.io
  14. https://status.im
  15. https://vipnode.org
Huling pag-edit: , Invalid DateTime
I-edit ang pahina

Nakatulong ba ang page na ito?