Lending / Yield·Cosmos
Babylon
Babylon is a Bitcoin staking protocol built as a Cosmos SDK chain (Babylon Genesis) that lets BTC holders self-custodially stake native Bitcoin to provide cryptoeconomic security to Proof-of-Stake chains (Bitcoin Supercharged Networks, BSNs). It uses Bitcoin timestamping, BTC-native time-locked staking scripts, and a finality-provider model — no bridge, no wrapped BTC.
- 01trust-minimized BTC staking yield (no wrap, no bridge)
- 02BSN chains seeking Bitcoin-backed security
- 03BTC-finality services for Cosmos chains
- 04dual-staking BTC + BABY token security
- 05long-form BTC checkpointing for finality
- pnpm add @babylonlabs-io/btc-staking-ts @cosmjs/stargate
- go get github.com/babylonlabs-io/babylon-sdk
| Variable | Scope | Description |
|---|---|---|
| BABYLON_RPC_URL | Client | Babylon Genesis Tendermint RPC endpoint (e.g., `https://rpc.babylon.bbn-1.babylon.chain.kitchen`). Required for chain queries and tx submission. |
| BTC_NETWORK | Client | Bitcoin network for staking scripts: `mainnet`, `signet`, or `testnet`. Must match the Babylon chain's btc-staking parameters. |
For BTC staking from a browser/Node app use `@babylonlabs-io/btc-staking-ts`: build a staking transaction with `stakingTransaction({ scripts, amount, changeAddress, inputUTXOs, feeRate, network, publicKeyNoCoord, lockTime })` — this returns an unsigned PSBT that the user signs in their BTC wallet (OKX, Xverse, OneKey via WalletConnect or native APIs). Submit the signed BTC tx to Bitcoin and then register the staking record on Babylon Genesis via `MsgCreateBTCDelegation { stakerAddr, btcPubKey, fpBtcPkList, stakingTime, stakingValue, stakingTx, slashingTx, delegatorSlashingSig, ... }`. Read finality-provider sets and active delegations via `babylon.btcstaking.v1.QueryClient.FinalityProviders({})` and `BTCDelegations({ status })`. For Cosmos BSN chains integrating Babylon security, import the `x/babylon` module from `babylonlabs-io/babylon-sdk` and wire `BeginBlock`/`EndBlock` to the Babylon CosmWasm contracts.
- ⚑BTC time-locked staking scripts are NETWORK-SPECIFIC — a script generated for signet WILL NOT work on mainnet (different magic bytes, different covenant committee keys). Always parameterize on `BTC_NETWORK` and re-fetch covenant params on every session.
- ⚑Unbonding requires either (a) waiting the full timelock (~weeks-months) on Bitcoin or (b) the covenant committee co-signing an early-unbond. Surface BOTH paths to users; covenant unbonding is faster but requires a quorum signature from the federation.
- ⚑Slashing: equivocating finality providers cause their delegators' BTC to be slashed via a pre-signed slashing tx that anyone can broadcast. Choose finality providers carefully and monitor their voting record. The slashing tx sends BTC to a burn address.
- ⚑IBC channel maintenance: BSN chains use IBC + CosmWasm contracts to consume Babylon security. Channel/light-client expiry (14-day trusting period) freezes the security guarantee until unfrozen — operate a relayer or pay a relayer service.
- ⚑Chain upgrades: Babylon Genesis is on rapid upgrade cadence (v1.x → v2.x). The `babylon-sdk` Go module and `btc-staking-ts` JS SDK each track chain versions; mismatches produce `unknown message type` errors. Pin both in CI.
- ⚑CosmWasm version compatibility: Babylon BSN integration uses CosmWasm contracts (e.g., `babylon-contract`, `btc-staking-contract`); they target specific cosmwasm-std versions. Match the contract version to the BSN chain's wasmd capabilities.
- ⚑Gas token is `ubbn` on Babylon Genesis. Bitcoin fees are paid in BTC sats — fee-rate spikes on Bitcoin can make staking transactions stall; use a dynamic fee oracle (mempool.space) and set a sane max fee cap.
- ⚑BABY/BTC dual-staking: rewards split is governed by parameters that change via gov proposals. Quote yields with current params from chain queries, never hard-code APR estimates.