CoinCashew
English
Ask or search…
K

Guide | Ethereum Staking on Zhejiang Testnet

Become a validator, start staking and help secure Ethereum, a proof-of-stake blockchain. Anyone with 32 ETH can join.

Your Mission - #TestingTheWithdrawalsShanghai

  • Overview: To participate in the public testnet known as Zhejiang, the first public effort to test Ethereum’s upgrade to enabling validator withdrawals with a hardfork called "Shanghai-Capella" or also known as EIP 4855.
  • Goals: To test your staking setups, practice voluntary exits and validator withdrawals.
  • Staked ETH: With the new ability to withdraw staked ETH since beacon chain genesis on December 1 2020, this upgrade to Ethereum POS will add flexibility and attract the next wave of stakers and innovation.
  • Client Diversity: Within the Ethereum network of nodes, you want to improve Ethereum's client diversity by choosing a minority execution and consensus client combination.
  • Timeline: Assuming this testnet is thoroughly tested, mainnet Ethereum could be upgraded sometime in March 2023.
As of early February 2023, Besu is the most minority execution client with 6.8% of nodes. Lodestar is by far the most minority consensus client with 0.29% representation.
Client Diversity

How Staking on Ethereum Works

  1. 1.
    Acquire some hardware (laptop, desktop, server) or rent a VPS (cloud server): You need to run a node to stake.
  2. 2.
    Sync an execution layer client
  3. 3.
    Sync a consensus layer client
  4. 4.
    Generate your validator keys and import them into your validator client
  5. 5.
    Monitor and maintain your node
A Ethereum node consists of the Execution Layer + Consensus Layer.
A Ethereum Staking node is the previous plus a Validator client.
Client Stack
Big picture: Execution / Consensus / Validator

Prerequisites

This guide was written for aspiring Ethereum stakers who have basic familiarity with command line tools and it was tested against Ubuntu 22.04.1 LTS client. You’ll want a dedicated cloud VPS or local desktop/server/laptop running a clean install of Ubuntu preferably.
If using a VPS or remote server, install and start the SSH client for your operating system:
Windows: PuTTY
MacOS and Linux: from the Terminal, use the native command:
ssh <YourUserName>@<YourServersIP>

How to Run Commands

  • Commands are to be run in a terminal window or ssh terminal.
  • Commands preceded by sudo will prompt for your password at first, and periodically afterwards.

Minimum Hardware Requirements

  • Operating system: 64-bit Linux (i.e. Ubuntu 22.04 LTS Server or Desktop)
  • Processor: Dual core CPU, Intel Core i5–760 or AMD FX-8100 or better
  • Memory: 16GB RAM
  • Storage: 40GB SSD
Once done with testnet staking, this hardware configuration would be suitable for a mainnet staking node.
  • Operating system: 64-bit Linux (i.e. Ubuntu 22.04 LTS Server or Desktop)
  • Processor: Intel i5 or AMD Ryzen 5 or better.
  • Memory: 32GB RAM
  • Storage: 2TB SSD or NVME
  • Network: 100 Mbit or faster connection with at least 2TB per month data plan
For examples of actual staking hardware builds, check out RocketPool’s hardware guide.
Ethereum Staking Node
Pro Staking Tip: Highly recommend you begin with a brand new instance of an OS, VM, and/or machine. Avoid headaches by NOT reusing testnet keys, wallets, or databases for your validator.

How to participate with Zhejiang

Step 1. Install dependencies and updates
Install packages and update OS.
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install git ufw curl ccze -y
Reboot your machine to update installation.
sudo reboot
Step 2. Configure Firewall
Initialize the firewall with Ethereum’s p2p ports and ssh.
# By default, deny all incoming and outgoing traffic
sudo ufw default deny incoming
sudo ufw default allow outgoing
# Allow SSH access
sudo ufw allow ssh
# Allow execution client port
sudo ufw allow 30303/tcp
# Allow consensus client port
sudo ufw allow 9000/tcp
sudo ufw allow 9000/udp
# Enable UFW
sudo ufw enable
Confirm the settings are in effect.
sudo ufw status numbered
Example output:
Status: active
To Action From
-- ------ ----
[ 1] 9000/udp ALLOW IN Anywhere
[ 2] 22/tcp ALLOW IN Anywhere
[ 3] 30303/tcp ALLOW IN Anywhere
[ 4] 9000/tcp ALLOW IN Anywhere
[ 5] 9000/udp (v6) ALLOW IN Anywhere (v6)
[ 6] 22/tcp (v6) ALLOW IN Anywhere (v6)
[ 7] 30303/tcp (v6) ALLOW IN Anywhere (v6)
[ 8] 9000/tcp (v6) ALLOW IN Anywhere (v6)
For optimal connectivity, ensure Port Forwarding is setup for your router. Learn to port foward with guides found at https://portforward.com/how-to-port-forward
Step 3. Synchronize Time with Chrony
Install Chrony with the following.
sudo apt-get install chrony -y
Wait a few seconds, then verify that Chrony is syncing time.
chronyc tracking
Step 4. Download Zhejiang configuration files
#Setup git directory
mkdir ~/git && cd ~/git
#Clone the testnet config files
git clone https://github.com/ethpandaops/withdrawals-testnet.git
#Make a directory to store config files
sudo mkdir -p /var/lib/ethereum/zhejiang
#Copy config files to default location
sudo cp -R ~/git/withdrawals-testnet/zhejiang-testnet/custom_config_data /var/lib/ethereum/zhejiang

Step 5. Setup Execution Layer Client

Setup your execution layer client, your choice of Nethermind, Erigon, Geth or Besu.
Only one execution layer client is required per node.
Hyperledger Besu is an open-source Ethereum client designed for demanding enterprise applications requiring secure, high-performance transaction processing in a private network. It's developed under the Apache 2.0 license and written in Java.
Nethermind is all about performance and flexibility. Built on .NET core, a widespread, enterprise-friendly platform, Nethermind makes integration with existing infrastructures simple, without losing sight of stability, reliability, data integrity, and security.
Erigon is an implementation of Ethereum innovating on the efficiency frontier, written in Go.
Geth - Go-ethereum (aka Geth) is an Ethereum client built in Go. It is one of the original and most popular Ethereum clients.
Install Nethermind
Install dependencies.
sudo apt-get update
sudo apt-get install curl libsnappy-dev libc6-dev jq libc6 unzip -y
Run the following to automatically download the latest linux release, un-zip and cleanup.
cd $HOME
curl -s https://api.github.com/repos/NethermindEth/nethermind/releases/latest | jq -r ".assets[] | select(.name) | .browser_download_url" | grep linux-x64 | xargs wget -q --show-progress
unzip -o nethermind*.zip -d $HOME/nethermind
rm nethermind*linux*.zip
Install the binaries.
sudo cp -a $HOME/nethermind /usr/local/bin/nethermind
Download the testnet configs.
cd /usr/local/bin/nethermind/configs
wget https://raw.githubusercontent.com/NethermindEth/nethermind/master/src/Nethermind/Nethermind.Runner/configs/withdrawals_devnet.cfg
Create a service user for the execution service, as this improves security, then create data directories.
sudo adduser --system --no-create-home --group execution
sudo mkdir -p /var/lib/nethermind/zhejiang
sudo chown -R execution:execution /var/lib/nethermind/zhejiang
Generate the JWT secret, a file used by both the execution and consensus client, add read access privileges for the consensus client and setup ownership permissions
openssl rand -hex 32 | tr -d "\n" | sudo tee "/var/lib/ethereum/zhejiang/jwtsecret"
sudo chmod +r /var/lib/ethereum/zhejiang/jwtsecret
Create a systemd unit file to define your execution.service configuration.
sudo nano /etc/systemd/system/execution.service
Paste the following configuration into the file.
[Unit]
Description=Nethermind Execution Layer Client service for Zhejiang
Wants=network-online.target
After=network-online.target
Documentation=https://www.coincashew.com
[Service]
Type=simple
User=execution
Group=execution
Restart=on-failure
RestartSec=3
KillSignal=SIGINT
TimeoutStopSec=900
WorkingDirectory=/var/lib/nethermind/zhejiang
Environment="DOTNET_BUNDLE_EXTRACT_BASE_DIR=/var/lib/nethermind/zhejiang"
ExecStart=/usr/local/bin/nethermind/Nethermind.Runner \
--config withdrawals_devnet \
--datadir="/var/lib/nethermind/zhejiang" \
--JsonRpc.JwtSecretFile="/var/lib/ethereum/zhejiang/jwtsecret" \
--Init.ChainSpecPath="/var/lib/ethereum/zhejiang/custom_config_data/chainspec.json" \
--Discovery.Bootnodes="enode://691c66d0ce351633b2ef8b4e4ef7db9966915ca0937415bd2b408df22923f274873b4d4438929e029a13a680140223dcf701cabe22df7d8870044321022dfefa@64.225.78.1:30303,enode://89347b9461727ee1849256d78e84d5c86cc3b4c6c5347650093982b726d71f3d08027e280b399b7b6604ceeda863283dcfe1a01e93728b4883114e9f8c7cc8ef@146.190.238.212:30303,enode://c2892072efe247f21ed7ebea6637ade38512a0ae7c5cffa1bf0786d5e3be1e7f40ff71252a21b36aa9de54e49edbcfc6962a98032adadfa29c8524262e484ad3@165.232.84.160:30303,enode://71e862580d3177a99e9837bd9e9c13c83bde63d3dba1d5cea18e89eb2a17786bbd47a8e7ae690e4d29763b55c205af13965efcaf6105d58e118a5a8ed2b0f6d0@68.183.13.170:30303,enode://2f6cf7f774e4507e7c1b70815f9c0ccd6515ee1170c991ce3137002c6ba9c671af38920f5b8ab8a215b62b3b50388030548f1d826cb6c2b30c0f59472804a045@161.35.147.98:30303"
[Install]
WantedBy=multi-user.target
To exit and save, press Ctrl + X, then Y, then Enter.
Install Besu
Install dependencies.
sudo apt install -y openjdk-17-jdk libjemalloc-dev
Build the binaries.
cd $HOME/git
git clone -b main https://github.com/hyperledger/besu.git
cd besu
./gradlew installDist
Verify Besu was properly built by checking the version.
./build/install/besu/bin/besu --version
Sample output of a compatible version.
besu/v23.1.0-dev-e18e407c/linux-x86_64/openjdk-java-17
2023-02-02 01:22:12.000+00:00 | main | INFO | Besu | Using jemalloc
Install the binaries.
sudo cp -a $HOME/git/besu/build/install/besu /usr/local/bin/besu
Create a service user for the execution service, as this improves security, then create data directories.
sudo adduser --system --no-create-home --group execution
sudo mkdir -p /var/lib/besu/zhejiang
sudo chown -R execution:execution /var/lib/besu/zhejiang
Generate the JWT secret, a file used by both the execution and consensus client, add read access privileges for the consensus client and setup ownership permissions
openssl rand -hex 32 | tr -d "\n" | sudo tee "/var/lib/ethereum/zhejiang/jwtsecret"
sudo chmod +r /var/lib/ethereum/zhejiang/jwtsecret
Create a systemd unit file to define your execution.service configuration.
sudo nano /etc/systemd/system/execution.service
Paste the following configuration into the file.
[Unit]
Description=Besu Execution Layer Client service for Zhejiang
Wants=network-online.target
After=network-online.target
Documentation=https://www.coincashew.com
[Service]
Type=simple
User=execution
Group=execution
Restart=on-failure
RestartSec=3
KillSignal=SIGINT
TimeoutStopSec=900
Environment="JAVA_OPTS=-Xmx5g"
ExecStart=/usr/local/bin/besu/bin/besu \
--network-id=1337803 \
--rpc-ws-enabled=true \
--rpc-http-enabled=true \
--rpc-http-cors-origins="*" \
--host-allowlist="*" \
--engine-jwt-secret="/var/lib/ethereum/zhejiang/jwtsecret" \
--metrics-enabled=true \
--data-storage-format=BONSAI \
--sync-mode=X_CHECKPOINT \
--Xplugin-rocksdb-high-spec-enabled \
--genesis-file="/var/lib/ethereum/zhejiang/custom_config_data/besu.json" \
--data-path="/var/lib/besu/zhejiang" \
--bootnodes="enode://691c66d0ce351633b2ef8b4e4ef7db9966915ca0937415bd2b408df22923f274873b4d4438929e029a13a680140223dcf701cabe22df7d8870044321022dfefa@64.225.78.1:30303,enode://89347b9461727ee1849256d78e84d5c86cc3b4c6c5347650093982b726d71f3d08027e280b399b7b6604ceeda863283dcfe1a01e93728b4883114e9f8c7cc8ef@146.190.238.212:30303,enode://c2892072efe247f21ed7ebea6637ade38512a0ae7c5cffa1bf0786d5e3be1e7f40ff71252a21b36aa9de54e49edbcfc6962a98032adadfa29c8524262e484ad3@165.232.84.160:30303,enode://71e862580d3177a99e9837bd9e9c13c83bde63d3dba1d5cea18e89eb2a17786bbd47a8e7ae690e4d29763b55c205af13965efcaf6105d58e118a5a8ed2b0f6d0@68.183.13.170:30303,enode://2f6cf7f774e4507e7c1b70815f9c0ccd6515ee1170c991ce3137002c6ba9c671af38920f5b8ab8a215b62b3b50388030548f1d826cb6c2b30c0f59472804a045@161.35.147.98:30303"
[Install]
WantedBy=multi-user.target
To exit and save, press Ctrl + X, then Y, then Enter.
Install Erigon
Install Go dependencies
wget -O go.tar.gz https://go.dev/dl/go1.19.6.linux-amd64.tar.gz
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go.tar.gz
echo export PATH=$PATH:/usr/local/go/bin >> $HOME/.bashrc
source $HOME/.bashrc
Verify Go is properly installed by checking the version and cleanup files.
go version
rm go.tar.gz
Install build dependencies.
sudo apt-get update
sudo apt install build-essential git
Build the binary.
cd $HOME/git
git clone https://github.com/ledgerwatch/erigon.git
cd erigon
make erigon
Install the binary.
sudo cp $HOME/git/erigon/build/bin/erigon /usr/local/bin
Create a service user for the execution service, as this improves security, then create data directories.
sudo adduser --system --no-create-home --group execution
sudo mkdir -p /var/lib/erigon/zhejiang
sudo chown -R execution:execution /var/lib/erigon/zhejiang
Generate the JWT secret, a file used by both the execution and consensus client, add read access privileges for the consensus client and setup ownership permissions
openssl rand -hex 32 | tr -d "\n" | sudo tee "/var/lib/ethereum/zhejiang/jwtsecret"
sudo chmod +r /var/lib/ethereum/zhejiang/jwtsecret
Create a systemd unit file to define your execution.service configuration.
sudo nano /etc/systemd/system/execution.service
Paste the following configuration into the file.
[Unit]
Description=Erigon Execution Layer Client service for Zhejiang
Wants=network-online.target
After=network-online.target
Documentation=https://www.coincashew.com
[Service]
Type=simple
User=execution
Group=execution
Restart=on-failure
RestartSec=3
KillSignal=SIGINT
TimeoutStopSec=900
ExecStart=/usr/local/bin/erigon \
--datadir=/var/lib/erigon/zhejiang \
--externalcl \
--networkid=1337803 \
--authrpc.jwtsecret=/var/lib/ethereum/zhejiang/jwtsecret \
--http --http.api=engine,net,eth \
--http.corsdomain "*" \
--bootnodes="enode://691c66d0ce351633b2ef8b4e4ef7db9966915ca0937415bd2b408df22923f274873b4d4438929e029a13a680140223dcf701cabe22df7d8870044321022dfefa@64.225.78.1:30303,enode://89347b9461727ee1849256d78e84d5c86cc3b4c6c5347650093982b726d71f3d08027e280b399b7b6604ceeda863283dcfe1a01e93728b4883114e9f8c7cc8ef@146.190.238.212:30303,enode://c2892072efe247f21ed7ebea6637ade38512a0ae7c5cffa1bf0786d5e3be1e7f40ff71252a21b36aa9de54e49edbcfc6962a98032adadfa29c8524262e484ad3@165.232.84.160:30303,enode://71e862580d3177a99e9837bd9e9c13c83bde63d3dba1d5cea18e89eb2a17786bbd47a8e7ae690e4d29763b55c205af13965efcaf6105d58e118a5a8ed2b0f6d0@68.183.13.170:30303,enode://2f6cf7f774e4507e7c1b70815f9c0ccd6515ee1170c991ce3137002c6ba9c671af38920f5b8ab8a215b62b3b50388030548f1d826cb6c2b30c0f59472804a045@161.35.147.98:30303"
[Install]
WantedBy=multi-user.target
To exit and save, press Ctrl + X, then Y, then Enter.
Initialize database
sudo -u execution /usr/local/bin/erigon init \
--datadir=/var/lib/erigon/zhejiang /var/lib/ethereum/zhejiang/custom_config_data/genesis.json
Install Geth
Install Go dependencies
wget -O go.tar.gz https://go.dev/dl/go1.19.6.linux-amd64.tar.gz
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go.tar.gz
echo export PATH=$PATH:/usr/local/go/bin >> $HOME/.bashrc
source $HOME/.bashrc
Verify Go is properly installed by checking the version and cleanup files.
go version
rm go.tar.gz
Install build dependencies.
sudo apt-get update
sudo apt install build-essential git
Build the binary.
cd $HOME/git
git clone -b master https://github.com/ethereum/go-ethereum.git
cd go-ethereum
make geth
Install the binary.
sudo cp $HOME/git/go-ethereum/build/bin/geth /usr/local/bin
Create a service user for the execution service, as this improves security, then create data directories.
sudo adduser --system --no-create-home --group execution
sudo mkdir -p /var/lib/geth/zhejiang
sudo chown -R execution:execution /var/lib/geth/zhejiang
Generate the JWT secret, a file used by both the execution and consensus client, add read access privileges for the consensus client and setup ownership permissions
openssl rand -hex 32 | tr -d "\n" | sudo tee "/var/lib/ethereum/zhejiang/jwtsecret"
sudo chmod +r /var/lib/ethereum/zhejiang/jwtsecret
Create a systemd unit file to define your execution.service configuration.
sudo nano /etc/systemd/system/execution.service
Paste the following configuration into the file.
[Unit]
Description=Geth Execution Layer Client service for Zhejiang
Wants=network-online.target
After=network-online.target
Documentation=https://www.coincashew.com
[Service]
Type=simple
User=execution
Group=execution
Restart=on-failure
RestartSec=3
KillSignal=SIGINT
TimeoutStopSec=900
ExecStart=/usr/local/bin/geth \
--networkid=1337803 \
--datadir=/var/lib/geth/zhejiang \
--authrpc.jwtsecret=/var/lib/ethereum/zhejiang/jwtsecret \
--http --http.api=engine,net,eth \
--http.corsdomain "*" \
--bootnodes="enode://691c66d0ce351633b2ef8b4e4ef7db9966915ca0937415bd2b408df22923f274873b4d4438929e029a13a680140223dcf701cabe22df7d8870044321022dfefa@64.225.78.1:30303,enode://89347b9461727ee1849256d78e84d5c86cc3b4c6c5347650093982b726d71f3d08027e280b399b7b6604ceeda863283dcfe1a01e93728b4883114e9f8c7cc8ef@146.190.238.212:30303,enode://c2892072efe247f21ed7ebea6637ade38512a0ae7c5cffa1bf0786d5e3be1e7f40ff71252a21b36aa9de54e49edbcfc6962a98032adadfa29c8524262e484ad3@165.232.84.160:30303,enode://71e862580d3177a99e9837bd9e9c13c83bde63d3dba1d5cea18e89eb2a17786bbd47a8e7ae690e4d29763b55c205af13965efcaf6105d58e118a5a8ed2b0f6d0@68.183.13.170:30303,enode://2f6cf7f774e4507e7c1b70815f9c0ccd6515ee1170c991ce3137002c6ba9c671af38920f5b8ab8a215b62b3b50388030548f1d826cb6c2b30c0f59472804a045@161.35.147.98:30303"
[Install]
WantedBy=multi-user.target
To exit and save, press Ctrl + X, then Y, then Enter.
Initialize database
sudo -u execution /usr/local/bin/geth init \
--datadir=/var/lib/geth/zhejiang /var/lib/ethereum/zhejiang/custom_config_data/genesis.json
Run the following to enable auto-start at boot time.
sudo systemctl daemon-reload
sudo systemctl enable execution
Finally, start your execution layer client and check it's status.
sudo systemctl start execution
sudo systemctl status execution
Press Ctrl + C to exit the status.

Step 6. Setup Consensus Layer Client

To strengthen Ethereum's resilience against potential attacks or consensus bugs, it's best practice to run a minority client in order to increase client diversity. Find the latest distribution of consensus clients here: https://clientdiversity.org
Set up your consensus layer client. Your choice of Lighthouse, Nimbus, Teku, Prysm or Lodestar.
Lodestar is a Typescript implementation by the Chainsafe.io team. In addition to the beacon chain client, the team is also working on 22 packages and libraries. Finally, the Lodestar team is leading the Ethereum space in light client research and development and has received funding from the EF and Moloch DAO for this purpose.
Lighthouse is an Ethereum client with a heavy focus on speed and security. The team behind it, Sigma Prime is an information security and software engineering firm who have funded Lighthouse along with the Ethereum Foundation, Consensys, and private individuals. Lighthouse is built in Rust and offered under an Apache 2.0 License.
Teku is a Java-based Ethereum 2.0 client designed & built to meet institutional needs and security requirements. Dedicated to building enterprise-ready clients and tools for interacting with the core Ethereum platform, Teku is Apache 2 licensed and written in Java, a language notable for its maturity & ubiquity.
Nimbus is a research project and a client implementation for Ethereum 2.0 designed to perform well on embedded systems and personal mobile devices, including older smartphones with resource-restricted hardware. The Nimbus team are from Status the company best known for their messaging app/wallet/Web3 browser by the same name. Nimbus (Apache 2) is written in Nim, a language with Python-like syntax that compiles to C.
Prysm is a Go implementation of Ethereum 2.0 protocol with a focus on usability, security, and reliability. Prysm is developed by Prysmatic Labs, a company with the sole focus on the development of their client. Prysm is written in Go and released under a GPL-3.0 license.
Install Lighthouse Consensus Client
Install rust dependency
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
When prompted, enter '1' to proceed with the default install.
Update your environment variables.
echo export PATH="$HOME/.cargo/bin:$PATH" >> ~/.bashrc
source ~/.bashrc
Install rust dependencies.
sudo apt-get update
sudo apt install -y git gcc g++ make cmake pkg-config libssl-dev libclang-dev clang protobuf-compiler
Build the binaries.
mkdir ~/git
cd ~/git
git clone -b capella https://github.com/sigp/lighthouse.git
cd lighthouse
make
Verify lighthouse was built properly by checking the version number.
lighthouse --version
Install the binary.
sudo cp $HOME/.cargo/bin/lighthouse /usr/local/bin/lighthouse
Create a service user for the consensus service, as this improves security, then create data directories.
sudo adduser --system --no-create-home --group consensus
sudo mkdir -p /var/lib/lighthouse/zhejiang
Setup ownership permissions.
sudo chown -R consensus:consensus /var/lib/lighthouse
Create a systemd unit file to define your consensus.service configuration.
sudo nano /etc/systemd/system/consensus.service
Paste the following configuration into the file. Replace <enter-eth-address-here> with your suggested fee recipient ETH address.
[Unit]
Description=Lighthouse Consensus Layer Client service for Zhejiang
Wants=network-online.target
After=network-online.target
Documentation=https://www.coincashew.com
[Service]
Type=simple
User=consensus
Group=consensus
Restart=on-failure
RestartSec=3
KillSignal=SIGINT
TimeoutStopSec=900
ExecStart=/usr/local/bin/lighthouse bn \
--datadir /var/lib/lighthouse/zhejiang \
--testnet-dir /var/lib/ethereum/zhejiang/custom_config_data \
--http \
--validator-monitor-auto \
--metrics \
--port 9000 \
--checkpoint-sync-url=https://beacon.zhejiang.ethpandaops.io \
--execution-endpoint http://127.0.0.1:8551 \
--execution-jwt /var/lib/ethereum/zhejiang/jwtsecret \
--boot-nodes="enr:-Iq4QMCTfIMXnow27baRUb35Q8iiFHSIDBJh6hQM5Axohhf4b6Kr_cOCu0htQ5WvVqKvFgY28893DHAg8gnBAXsAVqmGAX53x8JggmlkgnY0gmlwhLKAlv6Jc2VjcDI1NmsxoQK6S-Cii_KmfFdUJL2TANL3ksaKUnNXvTCv1tLwXs0QgIN1ZHCCIyk,enr:-Ly4QOS00hvPDddEcCpwA1cMykWNdJUK50AjbRgbLZ9FLPyBa78i0NwsQZLSV67elpJU71L1Pt9yqVmE1C6XeSI-LV8Bh2F0dG5ldHOIAAAAAAAAAACEZXRoMpDuKNezAAAAckYFAAAAAAAAgmlkgnY0gmlwhEDhTgGJc2VjcDI1NmsxoQIgMUMFvJGlr8dI1TEQy-K78u2TJE2rWvah9nGqLQCEGohzeW5jbmV0cwCDdGNwgiMog3VkcIIjKA,enr:-MK4QMlRAwM7E8YBo6fqP7M2IWrjFHP35uC4pWIttUioZWOiaTl5zgZF2OwSxswTQwpiVCnj4n56bhy4NJVHSe682VWGAYYDHkp4h2F0dG5ldHOIAAAAAAAAAACEZXRoMpDuKNezAAAAckYFAAAAAAAAgmlkgnY0gmlwhJK-7tSJc2VjcDI1NmsxoQLDq7LlsXIXAoJXPt7rqf6CES1Q40xPw2yW0RQ-Ly5S1YhzeW5jbmV0cwCDdGNwgiMog3VkcIIjKA"
[Install]
WantedBy=multi-user.target
To exit and save, press Ctrl + X, then Y, then Enter.
Install Teku Consensus Client
Install Java 17 LTS.
sudo apt update
sudo apt install openjdk-17-jdk -y
Verify Java 17+ is installed.
java --version
Build the binaries.
mkdir ~/git
cd ~/git
git clone -b master https://github.com/ConsenSys/teku.git
cd teku
./gradlew distTar installDist
Verify Teku was built properly by displaying the version.
cd $HOME/git/teku/build/install/teku/bin
./teku --version
Install the binaries.
sudo cp -a $HOME/git/teku/build/install/teku /usr/local/bin/teku
Create a service user for the consensus service, as this improves security, then create data directories.
sudo adduser --system --no-create-home --group consensus
sudo mkdir -p /var/lib/teku/zhejiang
Setup ownership permissions.
sudo chown -R consensus:consensus /var/lib/teku
Create a systemd unit file to define your consensus.service configuration.
sudo nano /etc/systemd/system/consensus.service
Paste the following configuration into the file. Replace <enter-eth-address-here> with your suggested fee recipient ETH address.
[Unit]
Description=Teku Consensus Layer Client service for Zhejiang
Wants=network-online.target
After=network-online.target
Documentation=https://www.coincashew.com
[Service]
Type=simple
User=consensus
Group=consensus
Restart=on-failure
RestartSec=3
KillSignal=SIGINT
TimeoutStopSec=900
Environment=JAVA_OPTS=-Xmx5g
ExecStart=/usr/local/bin/teku-dev/bin/teku \
--network /var/lib/ethereum/zhejiang/custom_config_data/config.yaml \
--data-path /var/lib/teku/zhejiang \
--data-storage-mode="prune" \
--initial-state="https://beacon.zhejiang.ethpandaops.io/eth/v2/debug/beacon/states/finalized" \
--ee-endpoint http://127.0.0.1:8551 \
--ee-jwt-secret-file /var/lib/ethereum/zhejiang/jwtsecret \
--validator-keys /var/lib/teku/validator_keys/zhejiang:/var/lib/teku/validator_keys/zhejiang \
--rest-api-enabled true \
--metrics-enabled true \
--metrics-port 8008 \
--p2p-discovery-bootnodes="enr:-Iq4QMCTfIMXnow27baRUb35Q8iiFHSIDBJh6hQM5Axohhf4b6Kr_cOCu0htQ5WvVqKvFgY28893DHAg8gnBAXsAVqmGAX53x8JggmlkgnY0gmlwhLKAlv6Jc2VjcDI1NmsxoQK6S-Cii_KmfFdUJL2TANL3ksaKUnNXvTCv1tLwXs0QgIN1ZHCCIyk,enr:-Ly4QOS00hvPDddEcCpwA1cMykWNdJUK50AjbRgbLZ9FLPyBa78i0NwsQZLSV67elpJU71L1Pt9yqVmE1C6XeSI-LV8Bh2F0dG5ldHOIAAAAAAAAAACEZXRoMpDuKNezAAAAckYFAAAAAAAAgmlkgnY0gmlwhEDhTgGJc2VjcDI1NmsxoQIgMUMFvJGlr8dI1TEQy-K78u2TJE2rWvah9nGqLQCEGohzeW5jbmV0cwCDdGNwgiMog3VkcIIjKA,enr:-MK4QMlRAwM7E8YBo6fqP7M2IWrjFHP35uC4pWIttUioZWOiaTl5zgZF2OwSxswTQwpiVCnj4n56bhy4NJVHSe682VWGAYYDHkp4h2F0dG5ldHOIAAAAAAAAAACEZXRoMpDuKNezAAAAckYFAAAAAAAAgmlkgnY0gml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QrcuUFUwtQmH,/ip4/68.183.13.170/udp/9000/p2p/16Uiu2HAmHXzTmWAtVexas5YskEpbcyDQ5Qck3jdLgErWumjKExUx" \
--validators-graffiti "" \
--validators-proposer-default-fee-recipient <enter-eth-address-here>
[Install]
WantedBy=multi-user.target
To exit and save, press Ctrl + X, then Y, then Enter.
Install Nimbus Consensus Client
Install dependencies.
sudo apt-get update
sudo apt-get install curl build-essential git -y
Build the binary.
mkdir ~/git
cd ~/git
git clone -b unstable https://github.com/status-im/nimbus-eth2
cd nimbus-eth2
make update
make -j$(nproc) nimbus_beacon_node
Verify Nimbus was built properly by displaying the version.
cd $HOME/git/nimbus-eth2/build
./nimbus_beacon_node --version
Install the binary.
sudo cp $HOME/git/nimbus-eth2/build/nimbus_beacon_node /usr/local/bin
Create a service user for the consensus service, as this improves security, then create data directories.
sudo adduser --system --no-create-home --group consensus
sudo mkdir -p /var/lib/nimbus/zhejiang
Setup ownership permissions.
sudo chown -R consensus:consensus /var/lib/nimbus
Create a systemd unit file to define your consensus.service configuration.
sudo nano /etc/systemd/system/consensus.service
Paste the following configuration into the file. Replace <enter-eth-address-here> with your suggested fee recipient ETH address.
[Unit]
Description=Nimbus Consensus Layer Client service for Zhejiang
Wants=network-online.target
After=network-online.target
Documentation=https://www.coincashew.com
[Service]
Type=simple
User=consensus
Group=consensus
Restart=on-failure
RestartSec=3
KillSignal=SIGINT
TimeoutStopSec=900
ExecStart=/usr/local/bin/nimbus_beacon_node \
--data-dir="/var/lib/nimbus/zhejiang" \
--network="/var/lib/ethereum/zhejiang/custom_config_data" \
--web3-url=ws://127.0.0.1:8551 \
--rest \
--metrics \
--metrics-port=8008 \
--jwt-secret="/var/lib/ethereum/zhejiang/jwtsecret" \
--bootstrap-node=enr:-Iq4QMCTfIMXnow27baRUb35Q8iiFHSIDBJh6hQM5Axohhf4b6Kr_cOCu0htQ5WvVqKvFgY28893DHAg8gnBAXsAVqmGAX53x8JggmlkgnY0gmlwhLKAlv6Jc2VjcDI1N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2VjcDI1NmsxoQNIf37JZx-Lc8pnfDwURcHUqLbIEZ1RoxjZuBRtEODseYN0Y3CCIyiDdWRwgiMo \
--bootstrap-node=enr:-KG4QLNORYXUK76RPDI4rIVAqX__zSkc5AqMcwAketVzN9YNE8FHSu1im3qJTIeuwqI5JN5SPVsiX7L9nWXgWLRUf6sDhGV0aDKQ7ijXswAAAHJGBQAAAAAAAIJpZIJ2NIJpcIShI5NiiXNlY3AyNTZrMaECpA_KefrVAueFWiLLDZKQPPVOxMuxGogPrI474FaS-x2DdGNwgiMog3VkcIIjKA \
--suggested-fee-recipient=<enter-eth-address-here>
[Install]
WantedBy=multi-user.target
To exit and save, press Ctrl + X, then Y, then Enter.
Run the following to quickly sync with Checkpoint Sync.
sudo -u consensus /usr/local/bin/nimbus_beacon_node trustedNodeSync \
--data-dir="/var/lib/nimbus/zhejiang" \
--network="/var/lib/ethereum/zhejiang/custom_config_data" \
--trusted-node-url=https://beacon.zhejiang.ethpandaops.io \
--backfill=false
Install Lodestar Consensus Client
Install dependencies.
sudo apt-get install gcc g++ make git curl -y
Install yarn.
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update
sudo apt install yarn -y
Install nodejs.
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs
Build the binaries.
cd $HOME/git
git clone -b unstable https://github.com/chainsafe/lodestar.git
cd lodestar
yarn install --ignore-optional
yarn run build
Verify Lodestar was built properly by displaying the version.
./lodestar --version
Sample output of a compatible version.
🌟 Lodestar: TypeScript Implementation of the Ethereum Consensus Beacon Chain.
  • Version: v1.4.1/bff1438
  • by ChainSafe Systems, 2018-2022
Install the binaries.
sudo cp -a $HOME/git/lodestar /usr/local/bin/lodestar
Create a service user for the consensus service, as this improves security, then create data directories.
sudo adduser --system --no-create-home --group consensus
sudo mkdir -p /var/lib/lodestar/zhejiang
Setup ownership permissions.
sudo chown -R consensus:consensus /var/lib/lodestar
Create a systemd unit file to define your consensus.service configuration.
sudo nano /etc/systemd/system/consensus.service
Paste the following configuration into the file. Replace <enter-eth-address-here> with your suggested fee recipient ETH address.
[Unit]
Description=Lodestar Consensus Layer Client service for Zhejiang
Wants=network-online.target
After=network-online.target
Documentation=https://www.coincashew.com
[Service]
Type=simple
User=consensus
Group=consensus
Restart=on-failure
RestartSec=3
KillSignal=SIGINT
TimeoutStopSec=900
WorkingDirectory=/usr/local/bin/lodestar
ExecStart=/usr/local/bin/lodestar/lodestar beacon \
--dataDir="/var/lib/lodestar/zhejiang" \
--paramsFile