Self Custody
By combining Taproot with DHC, HelloBTU enable cryptographic trust for Bitcoin-Collateralized Stablecoin on native Bitcoin.
What is Taproot?
Taproot is a significant advancement in contract publication on the blockchain, addressing various concerns by enabling settlement through the publication of only relevant contract portions. This innovation not only enhances security but also introduces a new, expansive language for improved flexibility and scalability.
Schnorr Signatures (BIP 340) SigHash(Signature Hash) is applied to the transactions, meaning that once a SigHash is applied, the information becomes immutable(unchangeable). If the information is changed, the trasaction loses validity. Nothing can be changed without destorying the SigHash. Previously, a small amount of information could be changed through "malleability" that would not result in the transaction losing its validity.
Taproot (BIP 341) [MAST] Bitcoin Script Update allows the scripting language to use Schnorr signatures and integrates the Merkelized Alternative Script Trees(MAST).
Tapscript Tapscript is a collection of "opcodes", which are essentially just lines of codes that execute commands on the Bitcoin protocol that have been updated to make way for the new changes installed by Taproot. It can be referred to as a language, but it is more like an update to Bitcoin Script.
What is TimeLock?
A Timelock is a smart contract primitive in Bitcoin that restricts the spending of bitcoins until a specified future time or block height. Simply put, Timelocks hinder miners from confirming a transaction until certain conditions are met.
There are four major options for Bitcoin timelocks - nLocktime, nSequence, OP_CHECKLOCKTIMEVERIFY (OP_CLTV), and OP_CHECKSEQUENCEVERIFY (OP_CSV). Two of these options are script-level time locks, while the other two are transaction-level time locks.
Multi-Sign Escape Hatch
Multi-Sign Escape Hatch uses the multi-sign tapscript and timelock tapscript to support joint asset maintenance by multiple parties. It has two payment methods, when all signers agree on a certain spending output, then execute a multi-sign trapscript script. If any of them do not agree and the time expires, the time lock trapscript is executed and the output is spent by the validator specified in the script.
How to build the Multi-Sign Escape Hatch address
Standard Taproot address generation formula:
To sign a transaction with our private key, adjust the private key using the same hash value H (P|c) as the public key and commitment.
Taproot uses a simple trick involving something called a "merkle tree".
Combine the previous knowledge to finally generate the Escape Hatch address:
Working Flow
The diagram illustrates the process of creating and spending various Bitcoin outputs through different transactions as described in the following paragraphs:
Types of transactions
There are four types of transactions in the HelloBTU system:
Mapping Credential Transaction
Burning Credential Transaction
Forced Withdrawal Transaction
Escape Hatch Transaction
Mapping Credential Transaction
The mapper generates WBTC by creating a mapping transaction. This is a Bitcoin transaction where a certain amount of bitcoins to be minted is submitted to a mapping script approved by HelloBTU. These scripts lock a selected number of BTC. The requirements for a valid mapping transaction are:
It can contain an arbitrary number of inputs.
It can contain any number of outputs. One of these outputs must be the taproot output submitted to the BTC mapping script recognized by HelloBTU. Hereafter called the mapping output. The output must also contain an OP_RETURN with the information that needs to be map.
OP_RETURN output description:
MapOpReturnScript = 0x6a || 0x47 || SerializedMapOpReturnData
Fields description:
dst_chain: 4 bytes, u32 format of the EVM chain ID of the target chain.
receiver_bytes_len: 1 byte, Represents the length of the recipient's address.
receiver_bytes:The address of the recipient on the destination chain, expressed in bytes.
Burning Credential Transaction
When BTC mappers want to redeem their assets before the originally promised time lock expires, they use the burning credential transaction. The requirements for a valid burning credential transaction are:
It can contain any number of inputs that point to the mapping output of the mapping credential transaction。
It can contain at least two outputs, the first is the address of the BTC mapper. the second must also contain an OP_RETURN with burn information. If the selected input amount has excess BTC assets after deducting the burn amount, a taproot output of the BTC mapping script identified by HelloBTU is added.
OP_RETURN output description:
BurnOpReturnScript = 0x6a || 0x47 || SerializedBurnOpReturnData
Fields description:
uid: Unique identifier for the burn operation。
Forced Withdrawal Transaction
When the BTC mapper does not burn the assets before the time lock expires, due to disagreements over the content of the burning credential transaction, the committee will use a forced withdrawal transaction to transfer the assets out of the mapping script. The requirements for a valid forced withdrawal transaction are:
It can contain any number of inputs that point to the mapping output of the mapping transaction.
It contains only one output, which must be the taproot output submitted to the mapping script recognized by HelloBTU. Unlike mapping credential transaction, the output of a forced withdrawal transaction does not require an additional OP_RETURN.
Escape Hatch Transaction
When the BTC mapper did not burn the assets before the time expired, because the private key of the committee was lost, the validator used the escape hatch transaction to transfer the assets from the mapping script. The requirements for a valid escape hatch transaction are:
It can contain any number of inputs that point to the mapping output of the mapping credential transaction.
It can contain an arbitrary number of outputs.
Mapping Output Script
Mapping output is a taproot output that can only be spent via script spend paths. For the key spend path, we consider it unavailable by default because the internal key is a combination of the committee private key and the user private key. Minting output can be spent via three script spend paths.
1. Escaping path
Escaping path transfers the minter's Bitcoin to DAO. Its script form:
<
TIME
> : It’s unbinding time.<
ValidatorPk
>: The validator public key of the HelloBTU system.
2. Enforcing path
Enforcing path transfers assets locked by the mapper to the committee. Its script form:
<
TIME
> : It's unbinding time. The enforcing timelock is much smaller than the escaping timelock.<
CommitteePk
>: The public key of the committee of the Bool Network system.
3. multi-sign path
The multi-sign path is used to burn the mapper's assets in case of double signatures. Its script form:
<
MapperPK
>:BTC mapper public key.<
CommitteePK
>:Dynamic committee public key for Bool Network system.
How to use
Verify
For multi-sign-threshold-escape-enforce
taproot, we get the committee's taproot build-related information from the public panel:
Then execution command includes the above parameters.
We will enter the following and check the authenticity of the address.
Sign
Get the available utxos of the account.
Build transaction
Broadcast Transaction
Psbt
psbt is used to process partially signed transactions, which is beneficial to threshold escape hatches. In the case of multiple users, members sign in turn.
After the first member selects the input and output and signs the transaction, the result is in base58 format, indicating that the conditions for being uploaded to the chain have not been met, and subsequent members can sign psbt:
Last updated