Author: Portal_Kay Source: X, @portal_kay
- Last week, Babylon's community test event bbn-test-3 has ended. I wonder if everyone has participated?
- The biggest highlight of the Babylon project is that it allows BTC to achieve "trustless staking". Simply put, BTC assets can participate in staking activities and gain benefits without leaving the control of their own wallets.
- When I participated in the test before, I found that Babylon's staking process requires a total of 5 steps. The so-called "trustless staking" is achieved through these 5 steps. Next, let's take a look at how these 5 steps work.
【Acknowledgements】When disassembling the entire staking process, I asked X user @raylin51 about the implementation mechanism of BTC UTXO transaction construction and different signature methods. Thank you very much. However, we cannot see the specific source code of Babylon's implementation of staking, so the disassembly process may be wrong. Feel free to criticize.
Create a pledge transaction (BTC network)
- The first step is to create a pledge transaction on the BTC network. This transaction needs to achieve two functions: 1) Using BTC's time-lock script, the BTC involved in the pledge is locked and not allowed to be used; 2) Punishment transaction, which is to prevent users from committing subsequent evil (such as using their own pledged BTC to attack the POS chain) and can be punished (Slashing). The pledged BTC will be destroyed.
- The punishment here is the use of EOTS signatures (Extractable one-time signatures), which allows the private key to be automatically extracted from the signature generated by the malicious behavior when the user commits evil. Babylon will spend the "output" of the pledge transaction to a destruction address, turning it into an unspendable transaction output.
Create a pledge contract and unbond transaction (BTC network)
- This step mainly implements two operations. The first is to create a pledge contract, that is, to create a restriction clause (covenants) to determine the operation of step 1 above in the form of a contract; the other operation is to create an unbonding transaction (unbonding transaction). The core purpose of this operation is to allow users to use their private keys to redeem these assets and reuse these BTC after the lock-up period ends.
Create an unbonding contract (BTC network)
- This step is to create a restriction clause (covenants) to release the BTC pledge. That is, to build a contract to unbond and finally realize the operation of BTC redemption.
- The above three signatures are finally realized in the same BTC transaction (as shown in the figure below). Here, multiple branches in a transaction are actually realized through multiple signatures, which can be understood as a transaction to realize the three operations of pledge, punishment and redemption.
- In addition, we found that in this transaction, our BTC was still sent to an unfamiliar wallet. I was very curious about this at the time. Didn’t Babylon claim that the funds would not be out of the control of the wallet? How could the BTC be sent to an unfamiliar wallet? Later, after consulting, I understood that because the private key was originally the only condition for BTC UTXO, but when conditions such as time-lock were added, a new wallet must be created in the end to achieve multi-condition unlocking. The private key of our original payment wallet is one of the necessary conditions to unlock the new wallet UTXO, so in order to redeem this UTXO in the end, we still need to use the private key of our payment wallet.
Bind Award Account (Babylon Network)
- By the last two steps, the entire pledge process is basically complete. The fourth step is mainly to bind your wallet address to the BTC pledge event completed in the first three steps on the Babylon network, so that your Babylon wallet has the qualification to obtain pledge rewards.
Bind Award Account (BTC Network)
- The last step is still completed on the BTC network, the purpose is to bind your BTC wallet to the pledge behavior of Babylon on the POS chain (this step is more questionable, just look at the literal meaning of the interpretation, in fact, I don’t understand the necessity of this step).
Okay, at this point our pledge operation is complete, and the final confirmation of the transaction will take another 7 BTC blocks.