Converting BTC to bitoBTC

The sequence diagram represents the detailed steps of bridging BTC to a wrapped Bitcoin token, bitoBTC, on a target blockchain. It includes various actors and systems interacting, such as the user, BitoBridge Bitcoin, ckBTCMinter, Bitcoin Address, Bitcoin Canister, KYT Canister, ckBTC Ledger, BitoBridge Hub, BitoBridge Minter, XRC, ICPSwap, and the BitoBridge Ledger.

Here’s a step-by-step breakdown of the process:

  1. User Request for Bitcoin Address:

    • The user initiates the process by requesting a Bitcoin address from the BitoBridge Bitcoin canister using the get_btc_address function.

    • BitoBridge Bitcoin canister responds by providing the btc_address, which is used for depositing BTC.

  2. Deposit and Notify:

    • The user deposits BTC into the provided btc_address.

    • After depositing, the user submits the transaction ID (tx_id) to the BitoBridge Bitcoin canister.

  3. Update Balance and UTXO Retrieval:

    • BitoBridge Bitcoin calls update_balance() to update the user's balance, checking for new UTXOs every five minutes.

  4. KYT Compliance Check:

    • It retrieves UTXO details and sends them to the KYT Canister to ensure compliance with Know Your Transaction (KYT) regulations. It checks both UTXOs and the transaction address for any risk factors.

  5. Minting Process:

    • Upon successful KYT checks, the ckBTC Minter mints the corresponding amount of ckBTC and updates the block index, signaling successful minting.

  6. Approval and Bridging:

    • The BitoBridge Bitcoin canister approves the BitoBridge Hub canister to handle the transaction after validating the minting.

    • Once approved, the BitoBridge Bitcoin canister requests the bridge of the specified amount to the target blockchain.

  7. Price and Fee Queries:

    • In parallel, the BitoBridge Minter queries various price feeds from XRC and ICPSwap to determine the gas fees, ICP price, native token price on the target chain, and the token price in ICP.

    • These queries help calculate the total transaction fee (total_gas_fee()).

  8. Dispatch and Execute Transaction:

    • The BitoBridge Hub dispatches the transaction details to the target chain, including the calculated block index from the minting process.

    • The BitoBridge Minter then sends the transaction to the target chain’s RPC nodes, which handle the final token minting on the blockchain.

  9. Token Minting on Target Blockchain:

    • The target chain's RPC node receives the minting command and mints bitoBTC on the blockchain with the BitoBridge Ledger contract, acknowledging the transaction completion.

This sequence diagram illustrates the integration of blockchain operations, KYT compliance, and real-time price querying to ensure secure, compliant, and efficient bridging between BTC on the Bitcoin blockchain and bitoBTC on other blockchains, such as Ethereum.

Last updated