Deposit and mint
The main feature of the tBTC bridge is depositing BTC and using it to mint the ERC-20 TBTC token. This guide explains how to perform this process using the SDK.
Initialize the SDK
First, initialize the SDK, as described in the Initialize SDK guide.
Initiate the deposit
Once the SDK is initialized, you can initiate the deposit and get their Bitcoin address in the following way:
Make the Bitcoin deposit transaction
The next step is doing the actual Bitcoin deposit transaction to the deposit address. There are two possible ways to do so:
Recommended: Use an external Bitcoin wallet
Non-recommended: Use the experimental SDK
DepositFunding
component. This code is used for testing purposes and is not safe for production use!
Initiate minting
Once the Bitcoin deposit transaction is done, minting can be initiated. This can be done using the initiateMinting
method exposed by the Deposit
class. This method has two modes:
Automatic: Automatically detect the latest funding UTXO and use it to initiate minting. This mode is the default one that should be used when a single Bitcoin deposit transaction has been made.
Manual: Take a funding UTXO as a parameter and use it to initiate minting. This mode can be useful when multiple Bitcoin deposit transactions target the same deposit address.
Here is an example of both:
Last updated