Cover photo

Setup the Binary for a t3rn Executor

Setting Up the Binary for a t3rn Executor

This guide will walk you through setting up the t3rn executor binary on your system. It includes installation steps, code snippets, and configuration details.

Prerequisites

Before proceeding, ensure you have the following:

  • A Unix-based system (Linux/MacOS) or WSL2 for Windows.

  • Rust toolchain installed.

  • Basic knowledge of terminal commands.


Steps to Set Up the Executor Binary

1. Clone the t3rn Repository

First, clone the official t3rn repository:

# Clone the repository
git clone https://github.com/t3rn/t3rn

# Navigate into the repository folder
cd t3rn

2. Switch to the Correct Branch

Ensure you are working on the stable or main branch:

# Fetch all branches
git fetch --all

# Switch to the stable branch (if not already)
git checkout stable

3. Build the Binary

Build the executor binary using the Rust toolchain:

# Clean previous builds (optional)
cargo clean

# Build the executor binary
cargo build --release -p t3rn-executor

Once the build completes, you will find the binary in the ./target/release/ directory.

4. Set Up Configuration Files

Create or edit configuration files required by the executor:

  1. Create a config.toml file in the desired directory:

    mkdir -p ~/.t3rn-executor
    nano ~/.t3rn-executor/config.toml
    
  2. Add the following example configuration:

    [executor]
    rpc_endpoint = "ws://127.0.0.1:9944"
    keystore_path = "~/.t3rn-executor/keystore"
    network_id = "0x12345678"
    
    [logging]
    level = "info"
    

5. Initialize Keystore

The executor requires a keystore to sign transactions. Set it up as follows:

# Create the keystore directory
mkdir -p ~/.t3rn-executor/keystore

# Add a keypair (example with a test key)
echo "<your-private-key>" > ~/.t3rn-executor/keystore/keyfile

Replace <your-private-key> with your actual private key.

6. Run the Executor

Start the executor using the built binary:

# Navigate to the release directory
cd ./target/release

# Run the executor binary
./t3rn-executor --config ~/.t3rn-executor/config.toml

You should see logs indicating the executor is connected to the RPC endpoint and ready to handle tasks.


Troubleshooting

  • Dependency Issues: If cargo build fails, run:

    rustup update
    cargo check
    
  • Permission Denied: Ensure the binary has execution permissions:

    chmod +x ./t3rn-executor
    
  • Network Issues: Verify the RPC endpoint is reachable using:

    curl ws://127.0.0.1:9944
    

Additional Resources

With this setup, your t3rn executor binary should be ready to use!