### Run Teku Beacon Node Source: https://context7.com/consensys/teku/llms.txt Start Teku as a beacon node with essential configurations for network, execution client connection, data path, and API enablement. Includes a Docker example. ```bash # Run Teku beacon node teku \ --network=mainnet \ --ee-endpoint=http://localhost:8551 \ --ee-jwt-secret-file=/path/to/jwt.hex \ --data-path=/var/lib/teku \ --rest-api-enabled=true \ --rest-api-interface=0.0.0.0 \ --rest-api-port=5051 \ --metrics-enabled=true \ --metrics-port=8008 ``` ```bash # Using Docker docker run -d \ -p 9000:9000/tcp -p 9000:9000/udp \ -p 5051:5051 \ -v /data/teku:/var/lib/teku \ consensys/teku:latest \ --network=mainnet \ --ee-endpoint=http://execution-client:8551 \ --ee-jwt-secret-file=/var/lib/teku/jwt.hex \ --data-path=/var/lib/teku \ --rest-api-enabled=true ``` -------------------------------- ### Running Teku - Basic Configuration Source: https://context7.com/consensys/teku/llms.txt Start Teku as a beacon node with an execution client connection. ```APIDOC ## Running Teku - Basic Configuration ### Description Start Teku as a beacon node with an execution client connection. ### Command Line Example ```bash teku \ --network=mainnet \ --ee-endpoint=http://localhost:8551 \ --ee-jwt-secret-file=/path/to/jwt.hex \ --data-path=/var/lib/teku \ --rest-api-enabled=true \ --rest-api-interface=0.0.0.0 \ --rest-api-port=5051 \ --metrics-enabled=true \ --metrics-port=8008 ``` ### Docker Example ```bash docker run -d \ -p 9000:9000/tcp -p 9000:9000/udp \ -p 5051:5051 \ -v /data/teku:/var/lib/teku \ consensys/teku:latest \ --network=mainnet \ --ee-endpoint=http://execution-client:8551 \ --ee-jwt-secret-file=/var/lib/teku/jwt.hex \ --data-path=/var/lib/teku \ --rest-api-enabled=true ``` ``` -------------------------------- ### Import Statement Example Source: https://github.com/consensys/teku/blob/master/CLAUDE.md Demonstrates the preferred way to import and use classes in Teku, favoring explicit imports over fully qualified names. ```java import tech.pegasys.teku.spec.logic.common.util.DataColumnSidecarValidationHelper; ... DataColumnSidecarValidationHelper helper = ...; ``` -------------------------------- ### Get Spec Configuration Source: https://context7.com/consensys/teku/llms.txt Retrieve the specification configuration of the beacon node. Use this to understand the active protocol parameters. ```bash # Get spec configuration curl -X GET "http://localhost:5051/eth/v1/config/spec" \ -H "Accept: application/json" ``` -------------------------------- ### Teku Distribution Package Creation Source: https://github.com/consensys/teku/blob/master/AGENTS.md Creates distribution packages (tar and installable formats) for the Teku project. These packages are ready for deployment. ```bash ./gradlew distTar installDist ``` -------------------------------- ### Run JMH Benchmarks with Gradle Source: https://github.com/consensys/teku/blob/master/eth-benchmark-tests/src/jmh/java/tech/pegasys/teku/benchmarks/README.md Execute JMH benchmarks using the Gradle wrapper. Ensure the JMH plugin is installed in IntelliJ IDEA for easier execution. ```bash ./gradlew jmh ``` -------------------------------- ### Configure Teku with Checkpoint Sync Source: https://context7.com/consensys/teku/llms.txt Use this command to start Teku with checkpoint sync enabled. Ensure you replace placeholder paths and URLs with your actual values. This configuration is suitable for production deployments. ```bash teku \ --network=mainnet \ --ee-endpoint=http://localhost:8551 \ --ee-jwt-secret-file=/path/to/jwt.hex \ --checkpoint-sync-url=https://beaconstate.ethstaker.cc ``` -------------------------------- ### GET /eth/v1/beacon/genesis Source: https://context7.com/consensys/teku/llms.txt Retrieve details of the chain's genesis which can be used to identify the chain and verify the network. ```APIDOC ## GET /eth/v1/beacon/genesis ### Description Retrieve details of the chain's genesis which can be used to identify the chain and verify the network. ### Method GET ### Endpoint /eth/v1/beacon/genesis ### Response #### Success Response (200) - **data** (object) - Genesis information including time, validators root, and fork version. - **genesis_time** (string) - The timestamp of genesis. - **genesis_validators_root** (string) - The root of the genesis validators. - **genesis_fork_version** (string) - The fork version at genesis. ### Response Example ```json { "data": { "genesis_time": "1606824023", "genesis_validators_root": "0x4b363db94e286120d76eb905340fef4a55ae5fbe8b32a3e5e6c83c3e1b4b3e0c", "genesis_fork_version": "0x00000000" } } ``` ``` -------------------------------- ### Config API - Get Spec Source: https://context7.com/consensys/teku/llms.txt Retrieve the specification configuration used by the beacon node including all protocol parameters. ```APIDOC ## GET /eth/v1/config/spec ### Description Retrieve the specification configuration used by the beacon node including all protocol parameters. ### Method GET ### Endpoint /eth/v1/config/spec ### Response #### Success Response (200) - **data** (object) - Contains the specification configuration. - **PRESET_BASE** (string) - The base preset used. - **CONFIG_NAME** (string) - The name of the configuration. - **SECONDS_PER_SLOT** (string) - The number of seconds per slot. - **SLOTS_PER_EPOCH** (string) - The number of slots per epoch. - **MIN_VALIDATOR_WITHDRAWABILITY_DELAY** (string) - Minimum delay for validator withdrawability. - **SHARD_COMMITTEE_PERIOD** (string) - The period of shard committees. - **MAX_EFFECTIVE_BALANCE** (string) - Maximum effective balance for a validator. - **EJECTION_BALANCE** (string) - The balance at which a validator is ejected. - **GENESIS_FORK_VERSION** (string) - The genesis fork version. - **ALTAIR_FORK_VERSION** (string) - The Altair fork version. - **BELLATRIX_FORK_VERSION** (string) - The Bellatrix fork version. - **CAPELLA_FORK_VERSION** (string) - The Capella fork version. - **DENEB_FORK_VERSION** (string) - The Deneb fork version. ### Request Example ```bash curl -X GET "http://localhost:5051/eth/v1/config/spec" -H "Accept: application/json" ``` ### Response Example ```json { "data": { "PRESET_BASE": "mainnet", "CONFIG_NAME": "mainnet", "SECONDS_PER_SLOT": "12", "SLOTS_PER_EPOCH": "32", "MIN_VALIDATOR_WITHDRAWABILITY_DELAY": "256", "SHARD_COMMITTEE_PERIOD": "256", "MAX_EFFECTIVE_BALANCE": "32000000000", "EJECTION_BALANCE": "16000000000", "GENESIS_FORK_VERSION": "0x00000000", "ALTAIR_FORK_VERSION": "0x01000000", "BELLATRIX_FORK_VERSION": "0x02000000", "CAPELLA_FORK_VERSION": "0x03000000", "DENEB_FORK_VERSION": "0x04000000" } } ``` ``` -------------------------------- ### Get Genesis Information Source: https://context7.com/consensys/teku/llms.txt Retrieve the chain's genesis details, including time, validators root, and fork version. This is useful for identifying and verifying the network. ```bash # Get genesis information curl -X GET "http://localhost:5051/eth/v1/beacon/genesis" \ -H "Accept: application/json" ``` ```json # Response { "data": { "genesis_time": "1606824023", "genesis_validators_root": "0x4b363db94e286120d76eb905340fef4a55ae5fbe8b32a3e5e6c83c3e1b4b3e0c", "genesis_fork_version": "0x00000000" } } ``` -------------------------------- ### Get Teku Version Source: https://github.com/consensys/teku/blob/master/CONTRIBUTING.md Run this command in your terminal to retrieve the exact version of the Teku software you are currently using. This is useful for bug reporting and configuration checks. ```bash teku -v ``` -------------------------------- ### Get State Validator by Index or PublicKey Source: https://context7.com/consensys/teku/llms.txt Retrieve information for a specific validator from a given state. You can query using the validator's index or their public key. ```bash # Get validator by index curl -X GET "http://localhost:5051/eth/v1/beacon/states/head/validators/12345" \ -H "Accept: application/json" ``` ```bash # Get validator by public key curl -X GET "http://localhost:5051/eth/v1/beacon/states/head/validators/0x93247f2209abcacf57b75a51dafae777f9dd38bc7053d1af526f220a7489a6d3a2753e5f3e8b1cfe39b56f43611df74a" \ -H "Accept: application/json" ``` ```json # Response { "execution_optimistic": false, "finalized": true, "data": { "index": "12345", "balance": "32000000000", "status": "active_ongoing", "validator": { "pubkey": "0x93247f2209abcacf57b75a51dafae777f9dd38bc7053d1af526f220a7489a6d3a2753e5f3e8b1cfe39b56f43611df74a", "withdrawal_credentials": "0x00...", "effective_balance": "32000000000", "slashed": false, "activation_eligibility_epoch": "0", "activation_epoch": "0", "exit_epoch": "18446744073709551615", "withdrawable_epoch": "18446744073709551615" } } } ``` -------------------------------- ### Get Linux Kernel Version Source: https://github.com/consensys/teku/blob/master/CONTRIBUTING.md Execute this command on a Linux system to obtain detailed information about the running kernel. This is often required when reporting environment-specific issues. ```bash uname -a ``` -------------------------------- ### Example of Proper Import Statement in Java Source: https://github.com/consensys/teku/blob/master/AGENTS.md Use explicit import statements for classes instead of fully qualified names to improve code readability. This is enforced by the project's coding style. ```java import tech.pegasys.teku.spec.logic.common.util.DataColumnSidecarValidationHelper; ... DataColumnSidecarValidationHelper helper = ...; ``` ```java tech.pegasys.teku.spec.logic.common.util.DataColumnSidecarValidationHelper helper = ...; ``` -------------------------------- ### Node API - Get Syncing Status Source: https://context7.com/consensys/teku/llms.txt Check if the beacon node is currently syncing and get synchronization progress details. ```APIDOC ## GET /eth/v1/node/syncing ### Description Check if the beacon node is currently syncing and get synchronization progress details. ### Method GET ### Endpoint /eth/v1/node/syncing ### Response #### Success Response (200) - **data** (object) - Synchronization status details. - **head_slot** (string) - The current head slot of the chain. - **sync_distance** (string) - The number of slots remaining to sync. - **is_syncing** (boolean) - Indicates if the node is currently syncing. - **is_optimistic** (boolean) - Indicates if the node is in optimistic sync mode. - **el_offline** (boolean) - Indicates if the execution layer is offline. ### Request Example ```bash curl -X GET "http://localhost:5051/eth/v1/node/syncing" \ -H "Accept: application/json" ``` ### Response Example ```json { "data": { "head_slot": "5000000", "sync_distance": "0", "is_syncing": false, "is_optimistic": false, "el_offline": false } } ``` ``` -------------------------------- ### Running Teku Application Locally Source: https://github.com/consensys/teku/blob/master/AGENTS.md After building the project with `./gradlew installDist`, this command launches the Teku application with help information displayed. Ensure the build is successful before running. ```bash ./build/install/teku/bin/teku --help ``` -------------------------------- ### Initialize App Home and Base Name Source: https://github.com/consensys/teku/blob/master/teku/src/main/scripts/unixStartScript.txt Sets the application's base name and home directory. It handles potential issues with CDPATH and ensures the APP_HOME is correctly determined. ```shell # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) APP_HOME=$( cd -P "${APP_HOME:-./}${appHomeRelativePath}" > /dev/null && printf '%s ' "$PWD" ) || exit ``` -------------------------------- ### GET /eth/v1/beacon/states/{state_id}/validators Source: https://context7.com/consensys/teku/llms.txt Query multiple validators from a state with filtering by status and validator IDs. ```APIDOC ## GET /eth/v1/beacon/states/{state_id}/validators ### Description Query multiple validators from a state with filtering by status and validator IDs. ### Method GET ### Endpoint /eth/v1/beacon/states/{state_id}/validators ### Parameters #### Path Parameters - **state_id** (string) - Required - Identifier for the state (e.g., 'head', 'finalized', or a specific state root). #### Query Parameters - **status** (string) - Optional - Filter validators by their status (e.g., 'active_ongoing'). - **id** (string) - Optional - Filter validators by their ID (can be specified multiple times for multiple IDs). ### Request Body (for POST method) ```json { "ids": ["string"], "statuses": ["string"] } ``` - **ids** (array of strings) - Optional - A list of validator IDs to query. - **statuses** (array of strings) - Optional - A list of statuses to filter validators by. ### Response #### Success Response (200) - **execution_optimistic** (boolean) - Indicates if the state is execution optimistic. - **finalized** (boolean) - Indicates if the state is finalized. - **data** (array of objects) - A list of validator data objects. - **index** (string) - The validator's index. - **balance** (string) - The validator's current balance in gwei. - **status** (string) - The validator's current status. - **validator** (object) - Detailed validator information (structure similar to single validator response). ### Response Example ```json { "execution_optimistic": false, "finalized": true, "data": [ { "index": "12345", "balance": "32000000000", "status": "active_ongoing", "validator": { ... } } ] } ``` ``` -------------------------------- ### Apply Code Style Source: https://github.com/consensys/teku/blob/master/README.md Use the Gradle spotlessApply task to reformat the project's code according to Google's Java coding conventions. ```shell ./gradlew spotlessApply ``` -------------------------------- ### Debug API - Get Fork Choice Source: https://context7.com/consensys/teku/llms.txt Retrieve the current fork choice context including all proto-array nodes and checkpoints. ```APIDOC ## GET /eth/v1/debug/fork_choice ### Description Retrieve the current fork choice context including all proto-array nodes and checkpoints. ### Method GET ### Endpoint /eth/v1/debug/fork_choice ### Response #### Success Response (200) - **justified_checkpoint** (object) - The justified checkpoint. - **epoch** (string) - The epoch number. - **root** (string) - The block root. - **finalized_checkpoint** (object) - The finalized checkpoint. - **epoch** (string) - The epoch number. - **root** (string) - The block root. - **fork_choice_nodes** (array) - A list of fork choice nodes. - **slot** (string) - The slot number. - **block_root** (string) - The block root. - **parent_root** (string) - The parent block root. - **justified_epoch** (string) - The justified epoch. - **finalized_epoch** (string) - The finalized epoch. - **weight** (string) - The weight of the node. - **validity** (string) - The validity status of the node. - **execution_block_hash** (string) - The execution block hash. ### Request Example ```bash curl -X GET "http://localhost:5051/eth/v1/debug/fork_choice" -H "Accept: application/json" ``` ### Response Example ```json { "justified_checkpoint": { "epoch": "31249", "root": "0x..." }, "finalized_checkpoint": { "epoch": "31248", "root": "0x..." }, "fork_choice_nodes": [ { "slot": "1000000", "block_root": "0x...", "parent_root": "0x...", "justified_epoch": "31249", "finalized_epoch": "31248", "weight": "123456789", "validity": "valid", "execution_block_hash": "0x..." } ] } ``` ``` -------------------------------- ### Executing the Teku Application Source: https://github.com/consensys/teku/blob/master/teku/src/main/scripts/unixStartScript.txt This command executes the Teku application using the configured Java command and arguments. It is typically the final step in the startup script. ```bash exec "\$JAVACMD" "\$@" ``` -------------------------------- ### GET /eth/v1/beacon/blob_sidecars/{block_id} Source: https://context7.com/consensys/teku/llms.txt Retrieve blob sidecars for a given block. Available from the Deneb fork for EIP-4844 blob transactions. ```APIDOC ## GET /eth/v1/beacon/blob_sidecars/{block_id} ### Description Retrieve blob sidecars for a given block. Available from the Deneb fork for EIP-4844 blob transactions. ### Method GET ### Endpoint /eth/v1/beacon/blob_sidecars/{block_id} ### Parameters #### Path Parameters - **block_id** (string) - Required - Identifier for the block (e.g., 'head', 'finalized', or a specific block root). #### Query Parameters - **indices** (string) - Optional - A comma-separated list of blob indices to retrieve. ### Response #### Success Response (200) - **version** (string) - The fork version. - **execution_optimistic** (boolean) - Indicates if the block is execution optimistic. - **finalized** (boolean) - Indicates if the block is finalized. - **data** (array of objects) - A list of blob sidecar objects. - **index** (string) - The index of the blob. - **blob** (string) - The blob data in hex format. - **kzg_commitment** (string) - The KZG commitment for the blob. - **kzg_proof** (string) - The KZG proof for the blob. - **signed_block_header** (object) - The signed block header associated with the blob. - **kzg_commitment_inclusion_proof** (array of strings) - The inclusion proof for the KZG commitment. ### Response Example ```json { "version": "deneb", "execution_optimistic": false, "finalized": false, "data": [ { "index": "0", "blob": "0x...", "kzg_commitment": "0x...", "kzg_proof": "0x...", "signed_block_header": { ... }, "kzg_commitment_inclusion_proof": [ ... ] } ] } ``` ``` -------------------------------- ### Teku Admin API - Readiness Check Source: https://context7.com/consensys/teku/llms.txt Check if the beacon node is ready to accept traffic. Considers sync status, peer count, and execution client availability. ```APIDOC ## GET /teku/v1/admin/readiness ### Description Check if the beacon node is ready to accept traffic. Considers sync status, peer count, and execution client availability. ### Method GET ### Endpoint /teku/v1/admin/readiness ### Query Parameters - **target_peer_count** (integer) - Optional - The target number of peers the node should have. - **require_prepared_proposers** (boolean) - Optional - If true, requires the node to have prepared proposers. - **require_validator_registrations** (boolean) - Optional - If true, requires validator registrations to be completed. ### Response #### Success Response (200) Returns a 200 OK status if the node is ready. #### Error Response (503) Returns a 503 Service Unavailable status if the node is not ready. ### Request Example ```bash # Basic readiness check curl -X GET "http://localhost:5051/teku/v1/admin/readiness" # With target peer count curl -X GET "http://localhost:5051/teku/v1/admin/readiness?target_peer_count=50" # With additional requirements curl -X GET "http://localhost:5051/teku/v1/admin/readiness?target_peer_count=50&require_prepared_proposers=true&require_validator_registrations=true" ``` ``` -------------------------------- ### Build and Test Teku Source: https://github.com/consensys/teku/blob/master/README.md Clone the Teku repository and use Gradle to build the project. Distribution packages will be available in the build/distributions directory. ```shell git clone https://github.com/Consensys/teku.git cd teku && ./gradlew ``` -------------------------------- ### Validator API - Get Proposer Duties Source: https://context7.com/consensys/teku/llms.txt Request validator proposer duties for a specific epoch to determine which validators should propose blocks. ```APIDOC ## GET /eth/v2/validator/duties/proposer/{epoch} ### Description Request validator proposer duties for a specific epoch to determine which validators should propose blocks. ### Method GET ### Endpoint /eth/v2/validator/duties/proposer/{epoch} #### Path Parameters - **epoch** (integer) - Required - The epoch for which to retrieve proposer duties. ### Response #### Success Response (200) - **dependent_root** (string) - Root of the dependent state. - **execution_optimistic** (boolean) - Indicates if the execution layer is optimistic. - **data** (array) - List of proposer duties. - **pubkey** (string) - The validator's public key. - **validator_index** (string) - The validator's index. - **slot** (string) - The slot in which the validator is scheduled to propose a block. ### Request Example ```bash # Get proposer duties for epoch 100 curl -X GET "http://localhost:5051/eth/v2/validator/duties/proposer/100" \ -H "Accept: application/json" ``` ### Response Example ```json { "dependent_root": "0x...", "execution_optimistic": false, "data": [ { "pubkey": "0x93247f2209abcacf57b75a51dafae777f9dd38bc7053d1af526f220a7489a6d3a2753e5f3e8b1cfe39b56f43611df74a", "validator_index": "12345", "slot": "3200" }, { "pubkey": "0xa1...", "validator_index": "12346", "slot": "3201" } ] } ``` ``` -------------------------------- ### Teku Full Build Command Source: https://github.com/consensys/teku/blob/master/AGENTS.md Executes a full build of the Teku project, including running all tests. This is a comprehensive command for ensuring code integrity. ```bash ./gradlew build ``` -------------------------------- ### Get Proposer Duties Source: https://context7.com/consensys/teku/llms.txt Request validator proposer duties for a specific epoch. This helps determine which validators are scheduled to propose blocks. ```bash # Get proposer duties for epoch 100 curl -X GET "http://localhost:5051/eth/v2/validator/duties/proposer/100" \ -H "Accept: application/json" ``` ```json # Response { "dependent_root": "0x...", "execution_optimistic": false, "data": [ { "pubkey": "0x93247f2209abcacf57b75a51dafae777f9dd38bc7053d1af526f220a7489a6d3a2753e5f3e8b1cfe39b56f43611df74a", "validator_index": "12345", "slot": "3200" }, { "pubkey": "0xa1...", "validator_index": "12346", "slot": "3201" } ] } ``` -------------------------------- ### Constructing JVM Command Line Arguments Source: https://github.com/consensys/teku/blob/master/teku/src/main/scripts/unixStartScript.txt This script segment constructs the command line for launching the JVM. It conditionally includes application name system properties and module paths based on configuration. Ensure that CLASSPATH and MODULE_PATH environment variables are correctly set. ```bash set -- \ <% if ( appNameSystemProperty ) { %> -D${appNameSystemProperty}=\$APP_BASE_NAME \<% } %> -classpath \"\$CLASSPATH\" \ <% if ( mainClassName.startsWith('--module ') ) { %> --module-path \"\$MODULE_PATH\" \ <% } %> ${mainClassName} \ \"\$@\" ``` -------------------------------- ### GET /eth/v1/beacon/states/{state_id}/validators/{validator_id} Source: https://context7.com/consensys/teku/llms.txt Retrieve information about a specific validator from a given state by validator index or public key. ```APIDOC ## GET /eth/v1/beacon/states/{state_id}/validators/{validator_id} ### Description Retrieve information about a specific validator from a given state by validator index or public key. ### Method GET ### Endpoint /eth/v1/beacon/states/{state_id}/validators/{validator_id} ### Parameters #### Path Parameters - **state_id** (string) - Required - Identifier for the state (e.g., 'head', 'finalized', or a specific state root). - **validator_id** (string) - Required - The validator index or public key. ### Response #### Success Response (200) - **execution_optimistic** (boolean) - Indicates if the state is execution optimistic. - **finalized** (boolean) - Indicates if the state is finalized. - **data** (object) - The validator data. - **index** (string) - The validator's index. - **balance** (string) - The validator's current balance in gwei. - **status** (string) - The validator's current status (e.g., 'active_ongoing', 'pending_initialized'). - **validator** (object) - Detailed validator information. - **pubkey** (string) - The validator's public key. - **withdrawal_credentials** (string) - The validator's withdrawal credentials. - **effective_balance** (string) - The validator's effective balance in gwei. - **slashed** (boolean) - Whether the validator has been slashed. - **activation_eligibility_epoch** (string) - The epoch at which the validator became eligible for activation. - **activation_epoch** (string) - The epoch at which the validator was activated. - **exit_epoch** (string) - The epoch at which the validator exited or will exit. - **withdrawable_epoch** (string) - The epoch at which the validator's balance can be withdrawn. ### Response Example ```json { "execution_optimistic": false, "finalized": true, "data": { "index": "12345", "balance": "32000000000", "status": "active_ongoing", "validator": { "pubkey": "0x93247f2209abcacf57b75a51dafae777f9dd38bc7053d1af526f220a7489a6d3a2753e5f3e8b1cfe39b56f43611df74a", "withdrawal_credentials": "0x00...", "effective_balance": "32000000000", "slashed": false, "activation_eligibility_epoch": "0", "activation_epoch": "0", "exit_epoch": "18446744073709551615", "withdrawable_epoch": "18446744073709551615" } } } ``` ``` -------------------------------- ### Validator API - Get Attester Duties Source: https://context7.com/consensys/teku/llms.txt Request attester duties for validators in a specific epoch. Submit validator indices in the request body. ```APIDOC ## POST /eth/v1/validator/duties/attester/{epoch} ### Description Request attester duties for validators in a specific epoch. Submit validator indices in the request body. ### Method POST ### Endpoint /eth/v1/validator/duties/attester/{epoch} #### Path Parameters - **epoch** (integer) - Required - The epoch for which to retrieve attester duties. #### Request Body - **validator_indices** (array) - Required - A list of validator indices for which to get duties. ### Response #### Success Response (200) - **dependent_root** (string) - Root of the dependent state. - **execution_optimistic** (boolean) - Indicates if the execution layer is optimistic. - **data** (array) - List of attester duties. - **pubkey** (string) - The validator's public key. - **validator_index** (string) - The validator's index. - **committee_index** (string) - The index of the validator's committee. - **committee_length** (string) - The total number of validators in the committee. - **committees_at_slot** (string) - The number of committees active at this slot. - **validator_committee_index** (string) - The index of the validator within its committee. - **slot** (string) - The slot in which the validator should attest. ### Request Example ```bash # Get attester duties for epoch 100 curl -X POST "http://localhost:5051/eth/v1/validator/duties/attester/100" \ -H "Content-Type: application/json" \ -d '[12345, 12346, 12347]' ``` ### Response Example ```json { "dependent_root": "0x...", "execution_optimistic": false, "data": [ { "pubkey": "0x93247f2209abcacf57b75a51dafae777f9dd38bc7053d1af526f220a7489a6d3a2753e5f3e8b1cfe39b56f43611df74a", "validator_index": "12345", "committee_index": "1", "committee_length": "128", "committees_at_slot": "64", "validator_committee_index": "15", "slot": "3200" } ] } ``` ``` -------------------------------- ### Build Teku Distribution Source: https://github.com/consensys/teku/blob/master/README.md Clone the Teku repository and use Gradle to create a ready-to-run distribution package in tar.gz or zip format. ```shell git clone https://github.com/Consensys/teku.git cd teku && ./gradlew distTar installDist ``` -------------------------------- ### Run Teku Validator Client Source: https://context7.com/consensys/teku/llms.txt Configure Teku to run as a validator client using local keystores or an external builder API (MEV-boost). Specifies fee recipient and builder registration. ```bash # With local keystores teku validator-client \ --beacon-node-api-endpoint=http://localhost:5051 \ --validator-keys=/path/to/keys:/path/to/passwords \ --validators-proposer-default-fee-recipient=0x... ``` ```bash # With builder API (MEV-boost) teku \ --network=mainnet \ --ee-endpoint=http://localhost:8551 \ --ee-jwt-secret-file=/path/to/jwt.hex \ --validators-builder-registration-default-enabled=true \ --builder-endpoint=http://localhost:18550 \ --validator-keys=/path/to/keys:/path/to/passwords ``` -------------------------------- ### Node API - Get Identity Source: https://context7.com/consensys/teku/llms.txt Retrieve information about the node's network presence including peer ID, ENR, and listening addresses. ```APIDOC ## GET /eth/v1/node/identity ### Description Retrieve information about the node's network presence including peer ID, ENR, and listening addresses. ### Method GET ### Endpoint /eth/v1/node/identity ### Response #### Success Response (200) - **data** (object) - Node identity information. - **peer_id** (string) - The node's peer ID. - **enr** (string) - The node's ENR (Ethereum Name Record). - **p2p_addresses** (array) - List of P2P listening addresses. - **discovery_addresses** (array) - List of discovery listening addresses. - **metadata** (object) - Network metadata. - **seq_number** (string) - Sequence number for metadata updates. - **attnets** (string) - Attestation network bitfield. - **syncnets** (string) - Sync network bitfield. ### Request Example ```bash curl -X GET "http://localhost:5051/eth/v1/node/identity" \ -H "Accept: application/json" ``` ### Response Example ```json { "data": { "peer_id": "QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N", "enr": "enr:-IS4QHCYrYZbAKWCBRlAy5zzaDZXJBGkcnh4MHcBFZntXNFrdvJjX04jRzjzCBOonrkTfj499SZuOh8R33Ls8RRcy5wBgmlkgnY0gmlwhH8AAAGJc2VjcDI1NmsxoQPKY0yuDUmstAHYpMa2_oxVtw0RW_QAdpzBQA8yWM0xOIN1ZHCCdl8", "p2p_addresses": [ "/ip4/192.168.1.1/tcp/9000/p2p/QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N" ], "discovery_addresses": [ "/ip4/192.168.1.1/udp/9000/p2p/QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N" ], "metadata": { "seq_number": "1", "attnets": "0x0000000000000000", "syncnets": "0x00" } } } ``` ``` -------------------------------- ### Check Code Formatting with Spotless Source: https://github.com/consensys/teku/blob/master/AGENTS.md Checks if the Teku project's code adheres to the configured formatting standards. This command is used to ensure code style consistency. ```bash ./gradlew spotlessCheck ``` -------------------------------- ### Get Attester Duties Source: https://context7.com/consensys/teku/llms.txt Request attester duties for validators in a specific epoch by submitting their indices in the request body. This is crucial for validator participation. ```bash # Get attester duties for epoch 100 curl -X POST "http://localhost:5051/eth/v1/validator/duties/attester/100" \ -H "Content-Type: application/json" \ -d '[12345, 12346, 12347]' ``` ```json # Response { "dependent_root": "0x...", "execution_optimistic": false, "data": [ { "pubkey": "0x93247f2209abcacf57b75a51dafae777f9dd38bc7053d1af526f220a7489a6d3a2753e5f3e8b1cfe39b56f43611df74a", "validator_index": "12345", "committee_index": "1", "committee_length": "128", "committees_at_slot": "64", "validator_committee_index": "15", "slot": "3200" } ] } ``` -------------------------------- ### Teku Readiness Check Source: https://context7.com/consensys/teku/llms.txt Check if the Teku beacon node is ready to accept traffic, considering sync status, peer count, and execution client availability. Supports various readiness criteria. ```bash # Basic readiness check curl -X GET "http://localhost:5051/teku/v1/admin/readiness" ``` ```bash # With target peer count curl -X GET "http://localhost:5051/teku/v1/admin/readiness?target_peer_count=50" ``` ```bash # With additional requirements curl -X GET "http://localhost:5051/teku/v1/admin/readiness?target_peer_count=50&require_prepared_proposers=true&require_validator_registrations=true" ``` -------------------------------- ### Rewards API - Get Block Rewards Source: https://context7.com/consensys/teku/llms.txt Retrieve block reward information for a specific block including attestation, sync committee, and slashing rewards. ```APIDOC ## GET /eth/v1/beacon/rewards/blocks/{block_id} ### Description Retrieve block reward information for a specific block including attestation, sync committee, and slashing rewards. ### Method GET ### Endpoint /eth/v1/beacon/rewards/blocks/{block_id} ### Parameters #### Path Parameters - **block_id** (string) - Required - The ID of the block for which to retrieve rewards. ### Response #### Success Response (200) - **execution_optimistic** (boolean) - Indicates if the block is execution optimistic. - **finalized** (boolean) - Indicates if the block is finalized. - **data** (object) - Reward data for the block. - **proposer_index** (string) - The index of the block proposer. - **total** (string) - The total reward for the block. - **attestations** (string) - The reward from attestations. - **sync_aggregate** (string) - The reward from the sync aggregate. - **proposer_slashings** (string) - The reward from proposer slashings. - **attester_slashings** (string) - The reward from attester slashings. ### Request Example ```bash curl -X GET "http://localhost:5051/eth/v1/beacon/rewards/blocks/1000000" -H "Accept: application/json" ``` ### Response Example ```json { "execution_optimistic": false, "finalized": true, "data": { "proposer_index": "12345", "total": "50000000", "attestations": "40000000", "sync_aggregate": "8000000", "proposer_slashings": "1000000", "attester_slashings": "1000000" } } ``` ``` -------------------------------- ### Running Teku - Validator Configuration Source: https://context7.com/consensys/teku/llms.txt Configure Teku to run validators with keystores or external signers. ```APIDOC ## Running Teku - Validator Configuration ### Description Configure Teku to run validators with keystores or external signers. ### With Local Keystores ```bash teku validator-client \ --beacon-node-api-endpoint=http://localhost:5051 \ --validator-keys=/path/to/keys:/path/to/passwords \ --validators-proposer-default-fee-recipient=0x... ``` ### With Builder API (MEV-boost) ```bash teku \ --network=mainnet \ --ee-endpoint=http://localhost:8551 \ --ee-jwt-secret-file=/path/to/jwt.hex \ --validators-builder-registration-default-enabled=true \ --builder-endpoint=http://localhost:18550 \ --validator-keys=/path/to/keys:/path/to/passwords ``` ``` -------------------------------- ### Get Fork Choice Context Source: https://context7.com/consensys/teku/llms.txt Retrieve the current fork choice context, including proto-array nodes and checkpoints. Useful for debugging fork choice decisions. ```bash # Get fork choice data curl -X GET "http://localhost:5051/eth/v1/debug/fork_choice" \ -H "Accept: application/json" ``` -------------------------------- ### Produce Block V3 Source: https://context7.com/consensys/teku/llms.txt Request the beacon node to produce a valid block for signing. The response may be a blinded or unblinded block depending on MEV-boost configuration. Requires randao reveal and optionally accepts a builder boost factor. ```bash # Produce block for slot 1000000 curl -X GET "http://localhost:5051/eth/v3/validator/blocks/1000000?randao_reveal=0x8b...&graffiti=0x..." \ -H "Accept: application/json" ``` ```bash # With builder boost factor curl -X GET "http://localhost:5051/eth/v3/validator/blocks/1000000?randao_reveal=0x8b...&builder_boost_factor=100" \ -H "Accept: application/json" ``` ```json # Response { "version": "deneb", "execution_payload_blinded": false, "execution_payload_value": "12345678901234567890", "consensus_block_value": "1000000000", "data": { "slot": "1000000", "proposer_index": "12345", "parent_root": "0x...", "state_root": "0x...", "body": { ... } } } ``` -------------------------------- ### Run Unit Tests Source: https://github.com/consensys/teku/blob/master/README.md Execute all unit tests for the Teku project using the Gradle test task. ```shell ./gradlew test ``` -------------------------------- ### Set Default JVM Options Source: https://github.com/consensys/teku/blob/master/teku/src/main/scripts/unixStartScript.txt Defines default JVM options. These can be overridden by JAVA_OPTS and other environment variables. The variable is defined after path conversions to allow using APP_HOME. ```shell # The DEFAULT_JVM_OPTS variable is intentionally defined here to allow using cygwin-processed APP_HOME. # So far the only way to inject APP_HOME reference into DEFAULT_JVM_OPTS is to post-process the start script; the declaration is a good anchor to do that. # Add default JVM options here. You can also use JAVA_OPTS and ${optsEnvironmentVar} to pass JVM options to this script. DEFAULT_JVM_OPTS=${defaultJvmOpts} ``` -------------------------------- ### Teku Build Without Tests Command Source: https://github.com/consensys/teku/blob/master/AGENTS.md Assembles the Teku project without executing tests. Use this for a quicker build when test results are not immediately required. ```bash ./gradlew assemble ``` -------------------------------- ### Get Node Identity Source: https://context7.com/consensys/teku/llms.txt Retrieve information about the node's network presence, including its peer ID, ENR, and listening addresses. This is useful for network diagnostics. ```bash # Get node identity curl -X GET "http://localhost:5051/eth/v1/node/identity" \ -H "Accept: application/json" ``` ```json # Response { "data": { "peer_id": "QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N", "enr": "enr:-IS4QHCYrYZbAKWCBRlAy5zzaDZXJBGkcnh4MHcBFZntXNFrdvJjX04jRzjzCBOonrkTfj499SZuOh8R33Ls8RRcy5wBgmlkgnY0gmlwhH8AAAGJc2VjcDI1NmsxoQPKY0yuDUmstAHYpMa2_oxVtw0RW_QAdpzBQA8yWM0xOIN1ZHCCdl8", "p2p_addresses": [ "/ip4/192.168.1.1/tcp/9000/p2p/QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N" ], "discovery_addresses": [ "/ip4/192.168.1.1/udp/9000/p2p/QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N" ], "metadata": { "seq_number": "1", "attnets": "0x0000000000000000", "syncnets": "0x00" } } } ```