Skip to main content

babylond testnet

Create a multi-validator testnet with necessary configuration files.

Overview

The babylond testnet command creates a complete testnet environment by generating directories for multiple validators, each populated with essential files including private validator keys, genesis configuration, and node configuration. This command is essential for development, testing, and local network setup.

Key Features
  • Creates multiple validator directories with complete configurations
  • Generates genesis file with all validators
  • Sets up peer-to-peer networking configuration
  • Configures Bitcoin staking parameters
  • Initializes economic and consensus parameters

Usage

babylond testnet [flags]

Quick Start

Basic 4-Validator Testnet

babylond testnet --v 4 --output-dir ./testnet --starting-ip-address 192.168.10.2

This creates a testnet with:

  • 4 validators (node0, node1, node2, node3)
  • Output directory: ./testnet
  • IP addresses starting from 192.168.10.2

Configuration Flags

Network Setup

FlagTypeDescriptionDefault
--vintNumber of validators to initialize4
-o, --output-dirstringDirectory to store testnet data"./mytestnet"
--starting-ip-addressstringStarting IP address for persistent peers"192.168.0.1"
--chain-idstringGenesis file chain-id (randomly created if blank)
--node-daemon-homestringHome directory of node's daemon configuration"babylond"
--node-dir-prefixstringPrefix for node directory names"node"
--keyring-backendstringKeyring backend (os|file|test)"os"
--key-typestringKey signing algorithm"secp256k1"

Bitcoin Configuration

FlagTypeDescriptionDefault
--btc-networkstringBitcoin network (simnet|testnet|regtest|mainnet)"simnet"
--btc-base-headerstringHex of the base Bitcoin header"0100000000000000..."
--btc-base-header-heightuint32Height of the base Bitcoin header0
--btc-confirmation-depthuint32Confirmation depth for Bitcoin headers6
--btc-finalization-timeoutuint32Finalization timeout for Bitcoin headers20
--checkpoint-tagstringHex encoded tag for Babylon checkpoint on BTC"01020304"

Bitcoin Staking Parameters

FlagTypeDescriptionDefault
--covenant-pksstringCovenant public keys (comma separated)Multiple keys
--covenant-quorumuint32Bitcoin staking covenant quorum3
--max-staking-amount-satintMaximum staking amount in satoshis100000000000
--min-staking-amount-satintMinimum staking amount in satoshis500000
--max-staking-time-blocksuint16Maximum staking time in blocks10000
--min-staking-time-blocksuint16Minimum staking time in blocks100
--min-slashing-fee-satintMinimum slashing fee in satoshis1000
--slashing-pk-scriptstringSlashing pk script (hex encoded)"76a914010101..."
--slashing-ratestringBitcoin staking slashing rate"0.1"
--unbonding-fee-satintRequired unbonding transaction fee in satoshis1000
--unbonding-timeuint16Unbonding timelock in BTC blocks21

Consensus & Validation

FlagTypeDescriptionDefault
--max-active-validatorsuint32Maximum number of validators10
--max-active-finality-providersuint32Maximum active finality providers100
--epoch-intervaluintBlocks between epochs (must be > 0)400
--activation-heightuintFinality activation height1
--vote-extension-enable-heightintVote extension enable height1
--time-between-blocks-secondsuintTime between blocks in seconds5
--blocks-per-yearuintBlocks per year6311520

Economic Parameters

FlagTypeDescriptionDefault
--inflation-maxfloatMaximum inflation rate0.2
--inflation-minfloatMinimum inflation rate0.07
--inflation-rate-changefloatInflation rate change0.13
--goal-bondedfloatBonded tokens goal0.67
--minimum-gas-pricesstringMinimum gas prices"0.000006ubbn"
--block-gas-limitintBlock gas limit50000000
--min-commission-ratestringMinimum validator commission rate"0"

Finality & Liveness

FlagTypeDescriptionDefault
--finality-sig-timeoutintFinality vote timeout in blocks3
--jail-durationstringMinimum jail duration"24h0m0s"
--min-signed-per-windowstringMinimum signing ratio to avoid jail"0.500000000000000000"
--signed-blocks-windowintSliding window size for liveness tracking100

Additional Options

FlagTypeDescriptionDefault
--genesis-timeintGenesis time (Unix timestamp)1747294051
--additional-sender-accountbooleanAdd extra pre-funded account per validatorfalse
--allowed-reporter-addressesstringBitcoin header reporter addresses

Examples

Development Testnet (Local)

babylond testnet \
--v 3 \
--output-dir ./devnet \
--chain-id babylon-dev \
--starting-ip-address 127.0.0.1

Bitcoin Testnet Integration

babylond testnet \
--v 5 \
--output-dir ./btc-testnet \
--btc-network testnet \
--btc-confirmation-depth 3 \
--min-staking-amount-sat 100000 \
--max-staking-amount-sat 10000000000

Custom Economic Parameters

babylond testnet \
--v 4 \
--output-dir ./custom-testnet \
--inflation-max 0.15 \
--inflation-min 0.05 \
--goal-bonded 0.75 \
--minimum-gas-prices "0.001ubbn"

Performance Testing Network

babylond testnet \
--v 10 \
--output-dir ./perfnet \
--time-between-blocks-seconds 2 \
--block-gas-limit 100000000 \
--epoch-interval 100

Finality Provider Testing

babylond testnet \
--v 4 \
--output-dir ./finality-test \
--max-active-finality-providers 50 \
--finality-sig-timeout 5 \
--signed-blocks-window 50 \
--min-signed-per-window "0.8"

Generated Directory Structure

After running the command, the output directory contains:

./testnet/
├── node0/
│ ├── babylond/
│ │ ├── config/
│ │ │ ├── app.toml
│ │ │ ├── config.toml
│ │ │ ├── genesis.json
│ │ │ └── priv_validator_key.json
│ │ └── data/
│ └── babylond.log
├── node1/
│ └── ...
├── node2/
│ └── ...
├── node3/
│ └── ...
└── gentxs/
├── node0.json
├── node1.json
├── node2.json
└── node3.json

Starting the Testnet

Start All Nodes

# Start each node in separate terminals
cd ./testnet/node0 && babylond start --home ./babylond
cd ./testnet/node1 && babylond start --home ./babylond
cd ./testnet/node2 && babylond start --home ./babylond
cd ./testnet/node3 && babylond start --home ./babylond

Docker Compose Example

version: '3.8'
services:
node0:
image: babylon:latest
command: babylond start --home /babylon/node0/babylond
volumes:
- ./testnet:/babylon
ports:
- "26656:26656"
- "26657:26657"
- "1317:1317"
- "9090:9090"

node1:
image: babylon:latest
command: babylond start --home /babylon/node1/babylond
volumes:
- ./testnet:/babylon
ports:
- "26756:26656"
- "26757:26657"