Start an Ethereum Node on a Raspberry Pi 4 with Geth
Once finished, unmount and unplug the SD Card. Plug it in the Raspberry Pi, then power on the Raspberry Pi.
Once booted, the Raspbian lite will prompt a command line access.
Default credentials are:
Login: pi
Password: raspberry
For security it is highly recommended to change the password if you plan to have a long term use of your node.
7 Advanced Options > A1 Expand Filesystem > Ok
Then, reboot:
Finish > Yes
Next, the Geth client has to be installed to start the blockchain synchronization.
Install Goland
Firstly, Go is required to run Geth (which means Go Ethereum…).
Get Go and install from sources:
$ cd /tmp
$ wget https://storage.googleapis.com/golang/go1.10.1.linux-armv6l.tar.gz
$ sudo tar -C /usr/local -xzf go1.10.1.linux-armv6l.tar.gz
Add /usr/local/go/bin to the PATH environment variable:
$ sudo nano /etc/profile
Add at the end of the file:
# Golang
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$PATH:$GOROOT/bin
Disconnect/reconnect your session. To test if Go is properly installed execute:
$ go version
go version go1.10.1 linux/arm
Install Geth
Go to https://geth.ethereum.org/downloads/ to get the last arm7 version, and extract the archive:
$ cd /tmp
$ wget https://gethstore.blob.core.windows.net/builds/geth-linux-arm7-1.9.1-b7b2f60f.tar.gz
$ tar -zxvf geth-linux-arm7–1.9.1-b7b2f60f.tar.gz
Add the program into /usr/local/bin:
$ cd geth-linux-arm7–1.9.1-b7b2f60f/
$ sudo mv geth /usr/local/bin/
Disconnect/reconnect your session. To test if Geth is successfully installed execute:
$ geth version
Geth
Version: 1.9.1-stable
[…]
Blockchain synchronization
Geth runs with options (https://github.com/ethereum/go-ethereum/wiki/Command-Line-Options). In order to simply synchronize the Raspberry Pi with the Mainnet blockchain, execute:
$ geth --cache=256 --syncmode "fast"
cache option is important to avoid fatal memory error fatal (i.e “fatal error runtime out of memory”).
syncmode options are “fast”, “full” and “light” (https://docs.ethhub.io/using-ethereum/running-an-ethereum-node/).
It should take many hours to synchronize…
Allow RPC
With the command line above, the Node is not accessible in RPC. To open RPC communication, execute:
$ geth --cache=256 --syncmode "fast" --rpc --rpcaddr 0.0.0.0
rpc enable the HTTP-RPC server.
rpcaddr 0.0.0.0 allow other computers on the network to connect to Geth server.
The node is now accessible on http://<rp4_ip_address>:8545
The rp4_ip_address is accessible with ip command:
$ ip addr
[...]
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
[...]
inet 192.168.1.20/24 brd 192.168.1.255 scope global noprefixroute eth0
[...]
In this example, the eth0 IP is 192.168.1.20.
You can use https://metamask.io/ to test the node connection.
- Select Custom RPC Network.
- Add your node name and settings and save.
Metamask should be connected to the Ethereum Mainnet blockchain through your Raspberry Pi node:
Blockchain synchronization
To develop, Ropsten is used instead of the Mainnet. To synchronize with the Ropsten Testnet, execute:
$ geth --testnet --cache=256 --syncmode "fast" --rpc --rpcaddr 0.0.0.0
testnet enable the pre-configured proof-of-work test network.
It should also take many hours to synchronize…
The Raspberry Pi 4 has just been released. It has more power and RAM, so it is easy to run a stable Ethereum blockchain node. Tests on a fully synchronized node are still in progress.
Actually there are three main Ethereum clients: Geth, Parity and Pantheon. For now, only Geth seems to work fine on a Raspberry Pi.
The next step should be sending transactions with web3:
$ geth --testnet --cache=256 --syncmode "fast" --rpc --rpcaddr 0.0.0.0 --rpcapi "db,eth,net,web3"
Published at Sat, 10 Aug 2019 19:33:47 +0000
Bitcoin Pic Of The Moment
✅ Marco Verch is a Professional Photographer and Speaker from Cologne. ? This image can be used under Creative Commons 2.0. Please link to the original photo and the license.
By marcoverch on 2018-08-19 08:43:09
