Skip to content

Bitcoin Staking

The BitHive Bitcoin staking protocol allows bitcoin holders to stake their Bitcoin, without needing any third-party custody/bridge/wrapping.

Bitcoin Staking Workflow

Bitcoin Staking Workflow

Deposit

Deposit: To make a deposit, the user transfers the desired amount of BTC to a P2WSH address, where the UTXO of the script can only be spent if one of the following conditions is met:

  • Signed by both the BitHive contract's MPC signature and the user's BTC private key
  • After a lock-up period (e.g., 3 months), signed solely by the user's BTC private key

This approach ensures that even if the BitHive contract has a bug or the Chain Signature’s MPC network is compromised, the user's funds cannot be withdrawn without his/her own signature. Even in the small likelihood of the Chain Signatures system going down, the user can eventually withdraw his deposit after the lock-up period.

Off-Chain Relayers: identify the deposit transaction and submit it to the BitHive Contract. The BitHive Contract then verifies the transaction's validity using the BTC light client and records the user's deposit information. These relayers are permissionless and replaceable; anyone can submit deposit information to the BitHive Contract. However, the relayers are responsible for covering the transaction fees and storage costs on NEAR.

Withdrawal

The users can withdraw their deposits before the lock-up period ends by following a straightforward process.

1. Queue Withdrawal

  1. The user first signs a withdrawal message with their BTC private key.
  2. The signed withdrawal request is then submitted to the BitHive contract via a relayer. The contract verifies signature's validity, records the request and places it in the withdrawal queue. The user must wait a certain period (e.g., 2 days) before the BTC can actually be withdrawn to their wallet.
  3. This step does not require interaction with the BTC network.

2. Complete Withdrawal

  1. After the waiting period, the user needs to ask the relayer to send a "complete withdrawal" request to the BitHive contract on his/her behalf.
  2. Once the BitHive Contract confirms that the withdrawal waiting period has completed, it calls the Chain Signatures contract to sign a withdrawal script.
  3. After receiving the withdrawal script and its signature, the user also needs to sign the withdrawal transaction with his/her private key and use these two signatures to withdraw BTC to his/her own wallet.

Transaction Fees: due to the nature of BTC, the withdrawal transaction naturally contains the fees required to perform the transaction (by the difference between outputs and inputs). Therefore, neither the worker nor the BitHive contract needs to pay the BTC gas fee; it will be covered by the user's deposit.

Partial Withdrawals: Partial withdrawals are supported. The remaining funds can be redeposited by constructing a new transaction and repeating the deposit process, transferring to a new P2WSH, thus continuing the deposit.

Off-Chain Relayers: throughout the process, the relayer acts as a replaceable intermediary; anyone can directly send the relevant messages to the BitHive Contract (but will need to pay NEAR's gas fees), making the system independent of specific relayers.