Eridian
eridian.xyzx.comGitHub
  • 📖Eridian Docs
  • Ethereum Dev
    • ✏️Ethereum Notes
      • 🎛️Technical Basics
      • 🪧Ethereum Addresses
      • 📚Ethereum State Explained
      • ⛽Gas Fees Explained
    • 🔧Useful Tools
      • ☁️Ethers
      • *️⃣Ethernal
    • 📝Solidity Notes
      • ❔Interview Questions
        • 🟢1. Easy - Interview Questions
        • 🟠2. Medium - Interview Questions
        • 🟡3. Hard - Interview Questions
        • 🔴4. Advanced - Interview Questions
      • 💡Note Ideas
      • ABI
      • abi.encodePacked
      • Abstract Contracts
      • Arrays
      • Casting
      • CEI - Checks, Effects, Interactions
      • Comments (NATSPEC)
      • Constructor
      • Contract Structure & Versions
      • Data - Storage vs Memory
      • Data - Storage Layout
      • Enum
      • Errors (require & revert)
      • Events
      • EVM Opcodes
      • External Contract Interaction
      • 🏗️External Dependencies
      • Functions
      • Function Modifiers
      • If / Else / For / While Loops
      • Inheritance
      • Interfaces
      • Keccak256
      • Library
      • Mappings
      • msg.sender
      • Objects & Types
      • OpenZeppelin
      • Payable
      • Public State Variable vs Function
      • Receive & Fallback
      • Security
      • Self Destruct
      • Send ETH (transfer, send, call)
      • Stack Too Deep
      • Structs
      • Style Guide
      • Time Units
      • Try / Catch
      • Typecasting
      • Using Directive
      • Variables, Consts & Immutable
      • Withdraws
    • ⚒️Foundry Notes
      • 📖Docs & GitHub Pages
      • 🤝Useful Commands
        • 🔨Anvil
        • 🪄Cast
        • 🔥Forge
      • 🧪Tests
        • Cheatcodes
      • 📝Useful Scripts
        • Deploy Contract Using Hex
    • 👾DeFi Challenges
      • 👨‍🚀Ethernaut
        • Ethernaut - Template
        • Level 1 - Fallback ⏺
        • Level 2 - Fallout ⏺
        • Level 3 - Coin Flip ⏺⏺
        • Level 4 - Telephone ⏺
        • Level 5 - Token ⏺⏺
        • Level 6 - Delegation ⏺⏺
        • Level 7 - Force ⏺⏺⏺
        • Level 8 - Vault ⏺⏺
        • Level 9 - King ⏺⏺⏺
        • Level 10 - Re-entrancy ⏺⏺⏺
        • Level 11 - Elevator ⏺⏺
        • Level 12 - Privacy ⏺⏺⏺
        • Level 13 - Gatekeeper 1 ⏺⏺⏺⏺
        • Level 14 - Gatekeeper 2 ⏺⏺⏺
        • Level 15 - Naught Coin ⏺⏺⏺
        • Level 16 - Preservation ⏺⏺⏺⏺
        • Level 17 - Recovery ⏺⏺⏺
        • Level 18 - Magic Number ⏺⏺⏺
        • Level 19 - Alien Codex ⏺⏺⏺⏺
        • Level 20 - Denial ⏺⏺⏺
        • Level 21 - Shop ⏺⏺
        • Level 22 - Dex ⏺⏺
        • Level 23 - Dex Two ⏺⏺
        • Level 24 - Puzzle Wallet ⏺⏺⏺⏺
        • Level 25 - Motorbike ⏺⏺⏺
        • Level 26 - DoubleEntryPoint ⏺⏺
        • Level 27 - Good Samaritan ⏺⏺⏺
        • Level 28 - Gatekeeper 3 ⏺⏺⏺
        • Level 29 - Switch ⏺⏺⏺⏺
        • Level 30 - Higher Order ⏺⏺⏺⏺
        • Level 31 - Stake ⏺⏺⏺
      • 💸Damn Vulnerable DeFi
    • 🔍Auditing
      • 🗞️Exploit Resources
      • 🔧Audit Tools
    • 🤖MEV
  • Infrastructure Docs
    • 💻Hardware
    • 🐧Linux
      • 📖Linux Glossary
      • ⌨️Linux Commands
      • 💾Installation
      • 🏗️Maintenance
      • 🖥️Ubuntu Desktop
      • 🛜ZeroTier
      • 🎞️TMUX
      • 🔵Bluetooth
    • ⛓️Ethereum Clients
      • ⚙️Execution Clients
        • ⛏️Geth
          • 💾Installation
          • ⌨️Useful Commands
          • 🏗️Maintenance
        • 🐻Erigon
          • 💾Installation
          • ⌨️Useful Commands
          • 🏗️Maintenance
        • 🧶Besu
          • 💾Installation
          • ⌨️Useful Commands
          • 🏗️Maintenance
      • 🤝Beacon Clients
        • 💡Lighthouse
          • 💾Installation
          • ⌨️Useful Commands
          • 🏗️Maintenance
        • 🪅Teku
          • 💾Installation
          • ⌨️Useful Commands
          • 🏗️Maintenance
      • 💎Validator Clients
        • 💡Lighthouse
          • 💾Installation
          • ⌨️Useful Commands
          • 🏗️Maintenance
      • ➕L2 Clients
        • 🔵Base
          • 💾Installation
          • ⌨️Useful Commands
          • 🏗️Maintenance
      • 💰MEV Boost
        • 💾Installation
        • 🏗️Maintenance
    • 🚨Alerting and Monitoring
      • 🔥Prometheus
      • 🌡️HealthChecks.io
      • 📟PagerDuty
  • General Dev
    • 💾Git Notes
      • Repos
      • Committing changes
      • Branches
      • Merging & Rebasing
      • PRs
Powered by GitBook
On this page
  • Create Aliases
  • Dependency - Install Java
  • Teku - Install
  • Firewall Configuration
  • Teku BN - Configure Service
  • Command Aliases
  • Teku - Update Scripts
Edit on GitHub
  1. Infrastructure Docs
  2. Ethereum Clients
  3. Beacon Clients
  4. Teku

Installation

Teku client installation guide.

Create Aliases

echo "alias teku-version-current='/usr/local/bin/teku/bin/teku --version'" >> ~/.bashrc
echo "alias teku-build='~/teku-build.sh'" >> ~/.bashrc
echo "alias teku-version-new='~/teku/build/install/teku/bin/teku --version'" >> ~/.bashrc
echo "alias teku-deploy='~/teku-deploy.sh'" >> ~/.bashrc

echo "alias teku-beacon-log='journalctl -f -u tekubeacon.service -o cat | ccze -A'" >> ~/.bashrc
echo "alias teku-beacon-start='sudo systemctl start tekubeacon.service'" >> ~/.bashrc
echo "alias teku-beacon-stop='sudo systemctl stop tekubeacon.service'" >> ~/.bashrc
echo "alias teku-beacon-restart='sudo systemctl restart tekubeacon.service'" >> ~/.bashrc
echo "alias teku-beacon-status='sudo systemctl status tekubeacon.service'" >> ~/.bashrc
echo "alias teku-beacon-config='sudo vim /etc/systemd/system/tekubeacon.service'" >> ~/.bashrc
echo "alias teku-beacon-enable='sudo systemctl enable tekubeacon.service'" >> ~/.bashrc
echo "alias teku-beacon-disable='sudo systemctl disable tekubeacon.service'" >> ~/.bashrc
echo "alias teku-beacon-delete-data='sudo rm -rf /var/lib/teku/beacon; sudo mkdir -p /var/lib/teku/beacon; sudo chown -R tekubeacon:tekubeacon /var/lib/teku/beacon'" >> ~/.bashrc

source ~/.bashrc

Dependency - Install Java

Teku requires version 21+ of Java.

sudo apt-get install openjdk-21-jre-headless openjdk-21-jdk -y

sudo apt-get install libsodium23 libnss3 -y

Teku - Install

Build the latest version of Teku.

TEKU_VERSION_COMMIT_HASH=        # e.g.508459f 

cd ~
git clone https://github.com/Consensys/teku.git
cd teku
git checkout ${TEKU_VERSION_COMMIT_HASH}
./gradlew installDist

Move the compiled Teku build to a new directory.

sudo cp -R ~/teku/build/install/teku /usr/local/bin

Check version.

teku-version-current

Create Teku directory.

sudo mkdir -p /var/lib/teku

Firewall Configuration

Teku BN - Configure Service

Create tekubeacon user and set permissions.

sudo useradd --no-create-home --shell /bin/false tekubeacon
sudo mkdir -p /var/lib/teku/
sudo chown -R tekubeacon:tekubeacon /var/lib/teku/

Configure tekubeacon service using the command line flags.

sudo vim /etc/systemd/system/tekubeacon.service
tekubeacon.service
[Unit]
Description=Teku Ethereum Client - Beacon Node
After=network-online.target
Wants=network-online.target

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

EnvironmentFile=/etc/default/beacon-variables.env

ExecStart=/usr/local/bin/teku/bin/teku \
    --network ${NETWORK} \
    --data-path /var/lib/teku/ \
    --ee-jwt-secret-file="/var/lib/jwtsecret" \
    --ee-endpoint ${BEACON_EXECUTION_ENDPOINTS} \
    --p2p-port ${BEACON_P2P_PORT} \
    \
    --rest-api-enabled=true \
    --rest-api-interface=${BEACON_HTTP_ADDRESS} \
    --rest-api-port=${BEACON_HTTP_PORT} \
    --rest-api-host-allowlist "*" \
    \
    --metrics-enabled=true \
    --metrics-interface ${BEACON_METRICS_ADDR} \
    --metrics-port ${BEACON_METRICS_PORT} \
    --metrics-host-allowlist "*" \
    \
    --validators-proposer-default-fee-recipient ${BEACON_SUGGESTED_FEE_RECIPIENT} \
    --initial-state ${BEACON_CHECKPOINT_SYNC_URL} \
    --builder-endpoint ${BEACON_BUILDER} \
    --validators-builder-registration-default-enabled=true \
    # Needed for an SSV block proposal bug
    --validators-graffiti-client-append-format=DISABLED

[Install]
WantedBy=multi-user.target

Start the service and check it's working as expected.

Command Aliases

daemon-reload          # Reload any changes made to the tekubeacon.service
teku-beacon-enable     # Enable the tekubeacon.service
teku-beacon-start      # Start the tekubeacon.service
teku-beacon-status     # View the status of the tekubeacon.service

teku-beacon-log        # View the tekubeacon.service logs

Teku - Update Scripts

Create Teku build script.

vim ~/teku-build.sh
~/teku-build.sh
#!/bin/bash
set -e
cd ~/teku

read -p "Enter the commit hash you want to checkout: " commit_hash

git fetch
git checkout $commit_hash

echo
echo "****************"
echo "Building Teku..."
echo "****************"
./gradlew installDist

Create Teku deploy script.

vim ~/teku-deploy.sh
~/teku-deploy.sh
#!/bin/bash
# set -e     # This isn't working correctly, so comment out for now

while true; do
    read -p "Are you sure you want to deploy Teku? (Y/N) " yn
    case $yn in
        [Yy]* ) break;;
        [Nn]* ) exit;;
        * ) echo "Please answer Y or N.";;
    esac
done

# Check if the services exist before checking their status
if systemctl list-units --full -all | grep -Fq tekubeacon.service; then
    beacon_status=$(sudo systemctl is-active tekubeacon.service)
else
    beacon_status="not_installed"
fi

if systemctl list-units --full -all | grep -Fq tekuvalidator.service; then
    validator_status=$(sudo systemctl is-active tekuvalidator.service)
else
    validator_status="not_installed"
fi

echo "**********************"

if [ "$beacon_status" = "active" ]; then
    echo "Stopping Teku Beacon..."
    sudo systemctl stop tekubeacon.service
elif [ "$beacon_status" = "not_installed" ]; then
    echo "Warning: Teku Beacon service is not installed."
fi

if [ "$validator_status" = "active" ]; then
    echo "Stopping Teku Validator..."
    sudo systemctl stop tekuvalidator.service
elif [ "$validator_status" = "not_installed" ]; then
    echo "Warning: Teku Validator service is not installed."
fi

echo "Replacing previous version..."

# Check if the directory exists before trying to remove it
if [ -d /usr/local/bin/teku ]; then
    sudo rm -rf /usr/local/bin/teku
fi

# Check if the source directory exists before copying
if [ -d ~/teku/build/install/teku ]; then
    sudo cp -R ~/teku/build/install/teku /usr/local/bin
else
    echo "Error: Source directory does not exist. Installation aborted."
    exit 1
fi

if [ "$beacon_status" = "active" ]; then
    echo "Restarting Teku Beacon..."
    sudo systemctl start tekubeacon.service
fi

if [ "$validator_status" = "active" ]; then
    echo "Restarting Teku Validator..."
    sudo systemctl start tekuvalidator.service
fi

Make all scripts executable.

chmod u+x ~/teku-build.sh
chmod u+x ~/teku-deploy.sh

Last updated 6 months ago

Configure the firewall using generic Beacon client UFW settings:

Configure .

⛓️
🤝
🪅
💾
UFW Config
Beacon Service Environment Variables