Teku

Installing and configuring the Teku Beacon Node.

Teku

Teku is a full Ethereum 2.0 client designed and built to meet institutional needs and security requirements. Developed by ConsenSys, it is written in Java and maintains Apache 2.0 licensing.

🛡️ Role: Teku is widely used by staking-as-a-service providers due to its robust support for external key managers (like Web3Signer) and its stability in enterprise environments.


1. Install Dependencies (Java)

Like Besu, Teku requires a Java Runtime Environment (JRE). We recommend Java 21 LTS for optimal performance.

Bash

# Update repositories
sudo apt update

# Install OpenJDK 21
sudo apt install -y openjdk-21-jre-headless

# Verify Java installation
java -version

2. Download & Install

We will download the latest binary release from the official ConsenSys repository.

A. Create the Application Directory

Bash

# Create a folder for the binary
sudo mkdir -p /usr/local/lib/teku

# Download the latest Linux release (Check https://github.com/Consensys/teku/releases)
# Example for v24.3.0:
sudo wget https://artifacts.consensys.net/public/teku/raw/names/teku.tar.gz/versions/24.3.0/teku-24.3.0.tar.gz -O teku.tar.gz

# Extract the archive
sudo tar -xvzf teku.tar.gz -C /usr/local/lib/teku --strip-components=1

# Cleanup
rm teku.tar.gz

B. Set Permissions Ensure the ethereum user owns the directory.

Bash

sudo chown -R ethereum:ethereum /usr/local/lib/teku

3. Configure Systemd Service

We will configure Teku to run as a background service.

⚡ Checkpoint Sync: Teku uses the --initial-state flag to perform checkpoint syncs. This downloads a recent state from a trusted peer to sync in minutes.

Create the service file:

Bash

sudo nano /etc/systemd/system/teku.service

Paste the following configuration:

Ini, TOML

[Unit]
Description=Teku Consensus Client
After=network.target

[Service]
User=ethereum
Group=ethereum
Type=simple
Restart=always
RestartSec=5

# Java Options (Adjust memory to 50% of available RAM)
Environment="JAVA_OPTS=-Xmx6g"

# Execution Command
ExecStart=/usr/local/lib/teku/bin/teku \
  --network=mainnet \
  --data-path=/home/ethereum/consensus \
  --ee-endpoint=http://localhost:8551 \
  --ee-jwt-secret-file=/home/ethereum/jwt/jwt.hex \
  --initial-state=https://beaconstate.info \
  --rest-api-enabled=true \
  --rest-api-interface=0.0.0.0 \
  --rest-api-port=5051 \
  --metrics-enabled=true \
  --metrics-port=8008 \
  --metrics-interface=0.0.0.0

# Resource Limits
LimitNOFILE=65535

[Install]
WantedBy=multi-user.target

🔍 Flag Explanation:

  • --ee-endpoint: The URL of your local Geth/Nethermind Engine API.

  • --initial-state: Loads the checkpoint state for fast syncing.

  • --rest-api-enabled: Enables the API (Required if you want to check status or connect a Validator Client later).


4. Start the Service

Reload the systemd daemon and start the beacon node.

Bash

# Reload systemd configuration
sudo systemctl daemon-reload

# Enable Teku to start on boot
sudo systemctl enable teku

# Start the service
sudo systemctl start teku

5. Verify Status

Check the logs to ensure Teku is initializing correctly.

Bash

sudo journalctl -fu teku

Expected Output:

  1. Eth1 Connection: Switching to the follower execution engine (This is normal at startup, it means it found Geth/Nethermind).

  2. Sync: Syncing to checkpoint followed by Remote checkpoint loaded.

  3. Head Update: You should start seeing logs like Slot Event or Head updated as it follows the chain.

Last updated