Staking via CLI

How to Stake BTC with Babylon via b14g and earn boosted co-staking rewards

b14g Babylon BTC Staking Tool

A CLI tool that lets you stake BTC natively on the Bitcoin network and earn co-staking rewards from the Babylon Genesis network via b14g.

Staking Workflow

The stake command starts the BTC staking process. It communicates with the Babylon Genesis chain, the Covenant emulators, and the Bitcoin network to:

  • Creates your co-staking order (if it’s your first time)

  • Builds and registers your staking transaction on Babylon Genesis chain

  • Waits for signature verification from the Covenant emulators

  • Broadcasts the staking transaction to the Bitcoin network

1. Create Order

  • First, the system checks if you have an existing order on the b14g marketplace

  • If no order exists:

    • A new order is created with your chosen validator address specified in the parameters.

    • The btcsharing percentage defines how rewards are split between you and the Babylon stakers

    • This order is linked 1:1 to your Babylon address

2. Staking Transaction Creation

  • Uses preStakeRegistrationBabylonTransaction() from @babylonlabs-io/btc-staking-ts to create an unsigned staking transaction with:

    • Your staking amount (in satoshis)

    • Timelock period (blocks until unlock)

    • Finality provider public key

    • Your public key

    • Available UTXOs (unspent transaction outputs)

    • Current Bitcoin tip height

  • This function generates:

    • Staking transaction

    • Slashing transactions

    • Unbonding transaction

    • Proof of Possession (PoP) signature

3. Babylon Delegation

  • Creates a delegation message containing:

    • Staking transaction data

    • Slashing transaction signatures

    • Unbonding transaction and signatures

    • Proof of possession (PoP) signature

  • Broadcasts the delegation to Babylon network through the order smart contract

  • Waits for verification (delegation state becomes VERIFIED)

4. Bitcoin Broadcasting

  • Once verified on Babylon, uses createSignedBtcStakingTransaction() from @babylonlabs-io/btc-staking-ts to:

    • Sign the staking transaction with your private key

    • Validate that transaction hash matches expected hash from Babylon

  • Broadcasts the signed transaction to Bitcoin network

  • Your BTC is now locked and staking begins

Last updated