Skip to main content

relay_utils app

Overview

The relay_utils app is a command-line utility tool that provides key management, network operations, and operator functions for the Symbiotic Relay system

Application Structure

The relay_utils binary is built from the ./cmd/utils directory and provides four main command categories:

  • Keys: Manages encrypted keystore operations (list, add, remove, update keys)
  • Network: Handles network configuration and genesis operations
  • Operator: Provides operator-related functionality

Usage Examples

Global Flags

The application supports global logging configuration

# Set log level and mode
./relay_utils --log-level debug --log-mode production <command>

# Available log levels: error, warn, info, debug
./relay_utils --log-level error keys print-keys

# Available log modes: debug, production
./relay_utils --log-mode production network info

Key Management Examples

Add Keys

# Add a Symbiotic key with specific key tag
./relay_utils keys add-key --key-tag 15 --private-key 0x1234567890abcdef... --path ./keystore.jks

# Generate a random Symbiotic key
./relay_utils keys add-key --key-tag 15 --generate --force --path ./keystore.jks

# Add EVM key for specific chain
./relay_utils keys add-evm --chain-id 1 --private-key 0xabcdef... --path ./keystore.jks

# Add default EVM key (chain ID 0)
./relay_utils keys add-evm --default-key --generate --path ./keystore.jks

# Force overwrite existing key
./relay_utils keys add-evm --chain-id 137 --generate --force --path ./keystore.jks

Remove Keys

# Remove Symbiotic key by tag
./relay_utils keys remove-key --key-tag 15 --path ./keystore.jks

# Remove EVM key for specific chain
./relay_utils keys remove-evm --chain-id 1 --path ./keystore.jks

# Remove default EVM key
./relay_utils keys remove-evm --default-key --path ./keystore.jks

Update and List Keys

# Update existing key
./relay_utils keys update-key --key-tag 15 --private-key 0xnewkey... --path ./keystore.jks

# List all keys in keystore
./relay_utils keys print-keys --path ./keystore.jks

Network Operations Examples

Genesis Generation

# Generate genesis with multiple chains
./relay_utils network generate-genesis \\
--chains <comma-separated>,<rpc-urls> \\
--driver-chainid 1 \\
--driver-address 0x4826533B4897376654Bb4d4AD88B7faFD0C98528

# Generate and commit genesis to blockchain
./relay_utils network generate-genesis \\
--chains <comma-separated>,<rpc-urls> \\
--driver-chainid 31337 \\
--driver-address 0x4826533B4897376654Bb4d4AD88B7faFD0C98528 \\
--commit

# Output genesis in JSON format
./relay_utils network generate-genesis \\
--chains <comma-separated>,<rpc-urls> \\
--driver-chainid 1 \\
--driver-address 0x4826533B4897376654Bb4d4AD88B7faFD0C98528 \\
--json

# Save genesis to file
./relay_utils network generate-genesis \\
--chains <comma-separated>,<rpc-urls> \\
--driver-chainid 1 \\
--driver-address 0x4826533B4897376654Bb4d4AD88B7faFD0C98528 \\
--output genesis.json

Network Information

# Display basic network information
./relay_utils network info \\
--chains <comma-separated>,<rpc-urls> \\
--driver-chainid 1 \\
--driver-address 0x4826533B4897376654Bb4d4AD88B7faFD0C98528

# Show network info with addresses
./relay_utils network info \\
--chains <comma-separated>,<rpc-urls> \\
--driver-chainid 1 \\
--driver-address 0x4826533B4897376654Bb4d4AD88B7faFD0C98528 \\
--addresses

# Include settlement information
./relay_utils network info \\
--chains <comma-separated>,<rpc-urls> \\
--driver-chainid 1 \\
--driver-address 0x4826533B4897376654Bb4d4AD88B7faFD0C98528 \\
--settlement

# Show validator information (table format)
./relay_utils network info \\
--chains <comma-separated>,<rpc-urls> \\
--driver-chainid 1 \\
--driver-address 0x4826533B4897376654Bb4d4AD88B7faFD0C98528 \\
--validators

# Show full validator tree
./relay_utils network info \\
--chains <comma-separated>,<rpc-urls> \\
--driver-chainid 1 \\
--driver-address 0x4826533B4897376654Bb4d4AD88B7faFD0C98528 \\
--validators-full

# Query specific epoch
./relay_utils network info \\
--chains <comma-separated>,<rpc-urls> \\
--driver-chainid 1 \\
--driver-address 0x4826533B4897376654Bb4d4AD88B7faFD0C98528 \\
--epoch 100

Operator Examples

Operator Registration

# Register operator with private key input
./relay_utils operator register \\
--chains <comma-separated>,<rpc-urls> \\
--driver-chainid 1 \\
--driver-address 0x4826533B4897376654Bb4d4AD88B7faFD0C98528

# Register with secrets file
./relay_utils operator register \\
--chains <comma-separated>,<rpc-urls> \\
--driver-chainid 1 \\
--driver-address 0x4826533B4897376654Bb4d4AD88B7faFD0C98528 \\
--secrets secrets.yaml

Key Registration

# Register operator key in key registry
./relay_utils operator register-key \\
--chains <comma-separated>,<rpc-urls> \\
--driver-chainid 1 \\
--driver-address 0x4826533B4897376654Bb4d4AD88B7faFD0C98528 \\
--key-tag 15 \\
--path ./keystore.jks \\
--password mypassword

# Register key with interactive password prompt
./relay_utils operator register-key \\
--chains <comma-separated>,<rpc-urls> \\
--driver-chainid 1 \\
--driver-address 0x4826533B4897376654Bb4d4AD88B7faFD0C98528 \\
--key-tag 15 \\
--path ./keystore.jks

Operator Information

# Display operator information
./relay_utils operator info \\
--chains <comma-separated>,<rpc-urls> \\
--driver-chainid 1 \\
--driver-address 0x4826533B4897376654Bb4d4AD88B7faFD0C98528 \\
--key-tag 15 \\
--path ./keystore.jks

# Query operator info for specific epoch
./relay_utils operator info \\
--chains <comma-separated>,<rpc-urls> \\
--driver-chainid 1 \\
--driver-address 0x4826533B4897376654Bb4d4AD88B7faFD0C98528 \\
--key-tag 15 \\
--path ./keystore.jks \\
--epoch 100

Output Formatting

# JSON output for automation
./relay_utils network generate-genesis --json | jq '.header.epoch'

# Save output to file
./relay_utils network info --output network-info.json

# Combine with other tools
./relay_utils network info --json | jq '.validators | length'

Dependencies

  • Go 1.24.3
  • Uses pterm for terminal UI formatting
  • Built with cobra CLI framework