Lock BTC with CLTV and create BB chain staking record.
- Bitcoin Core v22.0+ (with RPC enabled)
- Python 3.7+
git clone https://github.com/BounceBit-Labs/btcstake.git
cd btcstake
pip install -r requirements.txtYou can test the functionality on Bitcoin regtest network using:
cd src
./regtest.shThis script performs a complete test of the staking functionality on a local Bitcoin regtest network, including:
- Setting up regtest environment
- Creating and funding test addresses
- Testing stake and unlock operations
- Verifying OP_RETURN data
Generate BB chain staking record:
./opreturn.py \
--bb_address=<bb_chain_address> \
--days=<lock_days> \
--amount_btc=<amount>Example output:
BB Address: 0x1234...
Amount BTC: 0.001
Amount mBTC: 1
Days: 30
OP_RETURN: 46535450177100...
The following tools are provided as reference only:
./stake.py \
--pubkey=<public_key> \
--days=<lock_days> \
--amount-btc=<amount> \
--bb-address=<bb_chain_address> \
--change-address=<btc_address> \
--utxos=<txid:vout,...>./spend.py \
--utxo=<txid:vout> \
--redeem-script=<script> \
--address=<destination>-v, --verbose: Show detailed output-t, --test: Test mode--config: Load config from JSON file
- Inputs: Simple UTXOs (pubkeyhash/pubkey)
- Outputs: P2WSH + Change + OP_RETURN
- Signing: Only requires scriptPubKey for inputs