gen-helpers
Useful commands for creating the genesis state with Babylon-specific Bitcoin staking data. These specialized utilities help network coordinators bootstrap the Babylon chain with initial Bitcoin delegations, headers, and finality providers.
Overview
The gen-helpers command group provides utilities for incorporating Bitcoin staking-specific data into the genesis.json file. These commands are essential for initializing the Babylon network with pre-existing Bitcoin staking relationships and finality provider configurations.
babylond gen-helpers [command] [flags]
Quick Reference
| Command | Description | Use Case |
|---|---|---|
set-btc-delegations | Set BTC delegations from JSON file | Initialize BTC staking delegations |
set-btc-headers | Set BTC headers from JSON file | Bootstrap Bitcoin header chain |
set-finality-providers | Set finality providers from JSON file | Configure initial finality providers |
Global Flags
| Flag | Type | Default | Description |
|---|---|---|---|
--home | string | ~/.babylond | Directory for config and data |
--log_format | string | plain | The logging format (json|plain) |
--log_level | string | info | The logging level (trace|debug|info|warn|error|fatal|panic|disabled or '*:<level>,<key>:<level>') |
--log_no_color | Disable colored logs | ||
--trace | Print out full stack trace on errors |
set-btc-delegations
Reads BTC delegation structures from a JSON file and updates the genesis.json file in place to include the delegations in the btcstaking module's genesis state. This command is used to bootstrap the network with existing Bitcoin staking delegations.
Usage
babylond gen-helpers set-btc-delegations [path/to/btc_delegations.json] [flags]
Arguments
| Argument | Description |
|---|---|
path/to/btc_delegations.json | Path to the JSON file containing BTC delegation structures |
BTC Delegations JSON Structure
{
"btc_delegations": [
{
"babylon_pk": {
"key": "AkCmkLYWjr0/49MCK3lzTqKC1MiPSldXgoqP0EdtV8m1"
},
"btc_pk": "5ea8d7dfe920f5aecb1f4411b1b3e6684031ecb7a282df65107a615adc562a48",
"pop": {
"btc_sig_type": "BIP340",
"babylon_sig": "gjqXTQdgzC6AX/lnj3T3QV5vV+jtKDKwJOP9jMpZdb90MoIKRGV7j/A6lwbgsnUzbsvd4L19U7/3cOZqYBfQAg==",
"btc_sig": "Gx0VxuXgjiLvdCIIx1eN9JE9mqo+qvIv48cUhTCbM6uTxt59HTJiVGloHE518OXk+vQrNcHB+bZFqX+T5wMS9w=="
},
"fp_btc_pk_list": [
"3d6a1db7bffaebed71831fae74d32bf78e97884c41634cc1a80b0ebbffe1c7dd"
],
"start_height": "127",
"end_height": "10127",
"total_sat": "1000000",
"staking_tx": "...",
"staking_output_idx": 0,
"slashing_tx": "...",
"delegator_sig": "...",
"covenant_sigs": [...],
"unbonding_time": 101,
"btc_undelegation": {...},
"params_version": 0
}
]
}
Examples
babylond gen-helpers set-btc-delegations ./genesis-data/btc_delegations.json
babylond gen-helpers set-btc-delegations \
./btc_delegations.json \
--home /custom/babylon/home
Duplicated BTC delegations are not allowed and will cause an error. Ensure all delegations in the JSON file are unique.
set-btc-headers
Reads BTC header structures from a JSON file and updates the genesis.json file in place to include the Bitcoin headers in the btcstaking module's genesis state. This bootstraps the chain with the Bitcoin header chain history.
Usage
babylond gen-helpers set-btc-headers [path/to/btc_headers.json] [flags]
Arguments
| Argument | Description |
|---|---|
path/to/btc_headers.json | Path to the JSON file containing BTC header structures |
BTC Headers JSON Structure
{
"btc_headers": [
{
"header": "0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a45068653ffff7f2002000000",
"hash": "683e86bd5c6d110d91b94b97137ba6bfe02dbbdb8e3dff722a669b5d69d77af6",
"height": "0",
"work": "2"
},
{
"header": "00000020f67ad7695d9b662a72ff3d8edbbb2de0bfa67b13974bb9910d116d5cbd863e682259b3c6351788d4456e8fbb738dd51fd6aea615f63b10f634021f930c9c34be02150466ffff7f2000000000",
"hash": "6fceca20e50018d9f54632b791144eef4b3f9cb2ced9fa2702c376857a550e03",
"height": "1",
"work": "4"
}
]
}
Examples
babylond gen-helpers set-btc-headers ./genesis-data/btc_headers.json
babylond gen-helpers set-btc-headers \
./testnet_btc_headers.json \
--home ~/.babylond-testnet
BTC headers should form a continuous chain. Ensure headers are properly ordered and connected to maintain chain integrity.
set-finality-providers
Reads finality provider structures from a JSON file and updates the genesis.json file in place to include the finality providers in the btcstaking module's genesis state. This sets up the initial set of finality providers for the network.
Usage
babylond gen-helpers set-finality-providers [path/to/finality_providers.json] [flags]