On-page actions for Teku client
Teku client can be used for staking on various supported chains. Client installation is always only one, used by services with an individual configuration (different service name, data path and ports in use).
One-page interactive complete guide to configurate and operate Teku client.
This guide is for informational purposes only. The author nor website owner does not guarantee accuracy of the information in this guide and is not responsible for any damages or losses incurred by following the guide.
Teku client can be used for staking on various supported chains. Client installation is always only one, used by services with an individual configuration (different service name, data path and ports in use).
cd ~/downloads && wget https://download.oracle.com/java/21/latest/jdk-21_linux-x64_bin.deb
sudo apt install ./jdk-21_linux-x64_bin.deb
java --version
This will update the url links in the guide below.
cd ~/downloads && curl -LO https://artifacts.consensys.net/public/teku/raw/names/teku.tar.gz/versions/24.10.3/teku-24.10.3.tar.gz
$ tar xvf teku-24.10.3.tar.gz
sudo cp -a ~/downloads/teku-24.10.3 /usr/local/bin/teku
cd ~/downloads && rm teku-24.10.3.tar.gz && rm -r teku-24.10.3
sudo useradd --system --no-create-home --shell /bin/false tekubeacon
sudo mkdir -p /var/lib/tekubeacon
sudo chown -R tekubeacon:tekubeacon /var/lib/tekubeacon
Each service on the server needs a custom port for communication. Through ports, consensus client communicates with other peers in the network as well as other services running on the server, such as validator clients. There is an IPv4 and IPv6 variant, depending on the ISP support / preference. Each protocol version needs custom port. If you are not sure what to select, continue with default IPv4 port.
9000
ss -tuln | grep ':9000'
If it returns empty response, the port 9000
is free and can be used.
$ sudo ufw allow 9000
sudo ufw status numbered
9000 (V6)
and
remove it with the following line
sudo ufw delete <Number>
9001
ss -tuln | grep ':9001'
If it returns empty response, the port 9001
is free and can be used.
5052
ss -tuln | grep ':5052'
If it returns empty response, the port 5052
is free and can be used.
9090
ss -tuln | grep ':9090'
If it returns empty response, the port 9090
is free and can be used.
$ sudo ufw allow 9090
sudo ufw status numbered
9090
and
remove it with the following line
sudo ufw delete <Number>
9091
ss -tuln | grep ':9091'
If it returns empty response, the port 9091
is free and can be used.
Open Tekubeacon configuration file
sudo nano /etc/systemd/system/tekubeacon.service
Copy configuration
[Unit]
Description=Teku Consensus Client (Ethereum Mainnet)
Wants=network-online.target
After=network-online.target
[Service]
User=tekubeacon
Group=tekubeacon
Type=simple
Restart=always
RestartSec=5
Environment="JAVA_OPTS=-Xmx5g"
Environment="TEKU_OPTS=-XX:-HeapDumpOnOutOfMemoryError"
ExecStart=/usr/local/bin/teku/bin/teku \
--network=mainnet \
--data-path=/var/lib/tekubeacon \
--ee-endpoint=http://127.0.0.1:8551 \
--ee-jwt-secret-file=/var/lib/jwtsecret/ethereum.hex \
--metrics-enabled=true \
--rest-api-enabled=true \
--validators-proposer-default-fee-recipient= 0x... \
#--checkpoint-sync-url= \
--initial-state=https://checkpoint.gnosischain.com/eth/v2/debug/beacon/states/finalized
[Install]
WantedBy=multi-user.target
[Unit]
Description=Teku Consensus Client (Gnosis chain)
Wants=network-online.target
After=network-online.target
[Service]
User=tekubeacon
Group=tekubeacon
Type=simple
Restart=always
RestartSec=5
Environment="JAVA_OPTS=-Xmx5g"
Environment="TEKU_OPTS=-XX:-HeapDumpOnOutOfMemoryError"
ExecStart=/usr/local/bin/teku/bin/teku \
--network=gnosis \
--data-path=/var/lib/tekubeacon \
--ee-endpoint=http://127.0.0.1:8551 \
--ee-jwt-secret-file=/var/lib/jwtsecret/gnosis.hex \
--metrics-enabled=true \
--rest-api-enabled=true \
--validators-proposer-default-fee-recipient= 0x... \
#--checkpoint-sync-url= \
--initial-state=https://checkpoint.gnosischain.com/eth/v2/debug/beacon/states/finalized
[Install]
WantedBy=multi-user.target
ee-jwt-secret-file
, if you use different
CTRL
+ X
then Y
then ENTER
to save and exit the config
file.
sudo systemctl daemon-reload
sudo systemctl start tekubeacon
systemctl status tekubeacon
journalctl -fu tekubeacon
sudo systemctl enable tekubeacon
Do you want to create a new validation instance or extend exisiting instance for more validators?
sudo mkdir -p /var/lib/teku-vi1
deposit_data
file from keystores foldercd $HOME/keystores/ddk_i1 && ls -lh
deposit_data-XXX....json
file, remove it
rm deposit_data-XXX....json
into /var/lib/teku-vi1/keystores
foldersudo mkdir /var/lib/teku-vi1/keystores
sudo cp -a $HOME/keystores/ddk_i1/* /var/lib/teku-vi1/keystores && cd /var/lib/teku-vi1/keystores
Teku requires a .txt
file with encryption password for each .json
validator file.
ls -lh
.json
Vreate a new .txt
file for the keystore-m_12381_3600_X_0_0-XXXXXXXXXX
.json keystore file
nano keystore-m_12381_3600_X_0_0-XXXXXXXXXX.txt
Insert an encryption password for the validator key (the one used during keystores generation) into that file.
Press ctrl
+ x
, then y
to save and exit
sudo chmod 400 keystore-m_12381_3600_X_0_0-XXXXXXXXXX.txt
Now, you can either repeate the process for all other keystores in the folder, or use an automated solution to duplicate the created password file (with modified name) for all remaining keystores, see Shell Script to generate password files for Teku.
With automated process, to generate .txt
file with a content of /var/lib/teku-vi1/keystores/keystore-m_12381_3600_X_0_0-XXXXXXXXXX.txt
for all remaining keystores in the /var/lib/teku-vi1/keystores/
directory, use command
$HOME/bashscripts/create-teku-pswfiles.sh /var/lib/teku-vi1/keystores/keystore-m_12381_3600_X_0_0-XXXXXXXXXX.txt
sudo useradd --system --no-create-home --shell /bin/false teku-vi1
sudo chown -R teku-vi1:teku-vi1 /var/lib/teku-vi1
teku-vi1
servicesudo nano /etc/systemd/system/teku-vi1.service
[Unit]
Description=Teku Validator Instance (Ethereum Mainnet)
Wants=network-online.target
After=network-online.target
[Service]
User=teku-vi1
Group=teku-vi1
Type=simple
Restart=always
RestartSec=5
Environment="JAVA_OPTS=-Xmx8g"
Environment="TEKU_OPTS=-XX:-HeapDumpOnOutOfMemoryError"
ExecStart=/usr/local/bin/teku/bin/teku validator-client \
--network mainnet \
--beacon-node-api-endpoint http://127.0.0.1:5052 \
#--beacon-node-api-endpoint http://127.0.0.1:5051,http://192.10.10.101:5051,http://192.140.110.44:5051 \
--data-path /var/lib/teku-vi1 \
--validator-keys /var/lib/teku-vi1/keystores:/var/lib/teku-vi1/keystores \
--validators-proposer-default-fee-recipient 0xXXXXXXXXXXXXXXXX \
--validators-graffiti "Nethermind+Teku"
[Install]
WantedBy=multi-user.target
[Unit]
Description=Teku Validator Instance (Gnosis Network)
Wants=network-online.target
After=network-online.target
[Service]
User=teku-vi1
Group=teku-vi1
Type=simple
Restart=always
RestartSec=5
Environment="JAVA_OPTS=-Xmx8g"
Environment="TEKU_OPTS=-XX:-HeapDumpOnOutOfMemoryError"
ExecStart=/usr/local/bin/teku/bin/teku validator-client \
--network gnosis \
--beacon-node-api-endpoint http://127.0.0.1:5052 \
#--beacon-node-api-endpoint http://127.0.0.1:5051,http://192.10.10.101:5051,http://192.140.110.44:5051 \
--data-path /var/lib/teku-vi1 \
--validator-keys /var/lib/teku-vi1/keystores:/var/lib/teku-vi1/keystores \
--validators-proposer-default-fee-recipient 0xXXXXXXXXXXXXXXXX \
--validators-graffiti "Nethermind+Teku"
[Install]
WantedBy=multi-user.target
teku-vi1
into clients.conf file that is used by Staking Manager.
sudo nano /usr/local/etc/staking/config/clients.conf
teku-vi1
sudo systemctl stop teku-vi1
deposit_data
file from keystores foldercd $HOME/keystores/ddk_i1 && ls -lh
deposit_data-XXX....json
file, remove it
rm deposit_data-XXX....json
into /var/lib/teku-vi1/keystores
foldersudo mkdir /var/lib/teku-vi1/keystores
sudo cp -a $HOME/keystores/ddk_i1/* /var/lib/teku-vi1/keystores/keystores && cd /var/lib/teku-vi1/keystores
Teku requires a .txt
file with encryption password for each .json
validator file.
ls -lh
.json
Vreate a new .txt
file for the keystore-m_12381_3600_X_0_0-XXXXXXXXXX
.json keystore file
nano keystore-m_12381_3600_X_0_0-XXXXXXXXXX.txt
Insert an encryption password for the validator key (the one used during keystores generation) into that file.
Press ctrl
+ x
, then y
to save and exit
sudo chmod 400 keystore-m_12381_3600_X_0_0-XXXXXXXXXX.txt
Now, you can either repeate the process for all other keystores in the folder, or use an automated solution to duplicate the created password file (with modified name) for all remaining keystores, see Shell Script to generate password files for Teku.
With automated process, to generate .txt
file with a content of /var/lib/teku-vi1/keystores/keystore-m_12381_3600_X_0_0-XXXXXXXXXX.txt
for all remaining keystores in the /var/lib/teku-vi1/keystores/
directory, use command
$HOME/bashscripts/create-teku-pswfiles.sh /var/lib/teku-vi1/keystores/keystore-m_12381_3600_X_0_0-XXXXXXXXXX.txt
sudo systemctl daemon-reload
sudo systemctl start teku-vi1
systemctl status teku-vi1
journalctl -fu teku-vi1
sudo systemctl enable teku-vi1
Exit Validator(s) guide in progress.
Official documentation at https://docs.teku.consensys.io/reference/cli/subcommands/voluntary-exit
teku voluntary-exit --validator-keys=/var/lib/teku-vi1/keystores_i1:/var/lib/teku-vi1/keystores_i1
/usr/local/bin/teku/bin/teku --version
This will update the url links in the guide below.
cd ~/downloads && curl -LO https://artifacts.consensys.net/public/teku/raw/names/teku.tar.gz/versions/24.10.3/teku-24.10.3.tar.gz
$ tar xvf teku-24.10.3.tar.gz
Stop Teku Beacon service and all validators-based services
sudo systemctl stop tekubeacon
sudo systemctl stop teku-vi...
sudo systemctl stop teku-vi...
...
Check services status for state
sudo systemctl status tekubeacon
sudo systemctl status teku-vi...; sudo systemctl status teku-vi...
...
Stop cosnsensus services
/usr/local/bin/staking.sh stop consensus
Check cosnsensus services status
/usr/local/bin/staking.sh check consensus
sudo rm -r /usr/local/bin/teku
sudo cp -a ~/downloads/teku-24.10.3 /usr/local/bin/teku
Start Teku Beacon service and all validators-based services
sudo systemctl start tekubeacon
sudo systemctl start teku-vi...
sudo systemctl start teku-vi...
...
/usr/local/bin/staking.sh start consensus
systemctl status tekubeacon teku-vi..
journalctl -fu tekubeacon
journalctl -f -u lodestar-vi.. -u lodestar-vi..
/usr/local/bin/staking.sh check consensus
/usr/local/bin/staking.sh monitor consensus
cd ~/downloads && rm teku-24.10.3.tar.gz && rm -r teku-24.10.3