Converting bitoBTC to BTC
Last updated
Last updated
This sequence diagram describes the process of bridging bitoBTC on other blockchains, such as Ethereum, to the Bitcoin blockchain by the BitoBridge. This process involves several components, such as the BitoBridge Helper, RPC Nodes, BitoBridge Minter, BitoBridge Hub, ckBTC Ledger, and ckBTC Minter.
The detailed breakdown of each step in the sequence is as follows:
User Interaction:
The user initiates the bridging process by calling the bridge
function on the BitoBridge Helper, specifying the target blockchain (target_btc
), the amount of bitoBTC (amount
), and the recipient's address (recipient
).
The BitoBridge Helper burns the corresponding bitoBTC and returns an "ok" response to the user.
Event Emission:
Following the burning of bitoBTC, the BitoBridge Helper emits an event labeled Bridge(target_btc, amount, recipient, from)
to indicate that a bridging operation is set to occur. This event is picked up by the RPC Nodes involved in the process.
Listening and Processing Events:
RPC Nodes continuously listen for events related to bridging. They run a loop that checks for new events every three minutes.
Upon capturing the bridge event, the RPC Nodes forward this information to the BitoBridge Minter.
BitoBridge Minter to BitoBridge Hub Communication:
After receiving the event details from the RPC Nodes, the BitoBridge Minter communicates with the BitoBridge Hub to facilitate the actual token transfer. The BitoBridge Minter sends a bridge request (bridge(target_btc, amount)
) to the Hub and receives ok
.
Token Retrieval Approval:
The BitoBridge Hub calls ckBTC Ledger's approve()
to allow the ckBTC minter to withdraw the desired amount from a user-controlled account.
Bitcoin Retrieval:
After receiving approval from the ckBTC Ledger, the ckBTC Minter performs the retrieve_btc_with_approval
operation, specifying the recipient and the amount of Bitcoin to transfer. This operation also results in a block_index
response, signifying the completion and recording of the transaction on the blockchain.
Completion:
The sequence completes with the retrieval of BTC, effectively bridging the bitoBTC from other blockchains, such as Ethereum, to its native environment as specified by the user in the initial request.