BTC developer workflow
To build Bitcoin dapps on ICP, a developer needs to make calls and submit transactions to the Bitcoin network from their ICP smart contract.
Before you start building your dapp, you will need to set up a local development environment with Bitcoin support.
Developers should expect to implement the following workflows within their code to build a Bitcoin dapp:
Generate a Bitcoin address. Bitcoin addresses are necessary for your dapp to sign transactions and hold assets like BTC. An ICP smart contract can have multiple addresses that have been generated with different signature types, i.e., ECDSA and Schnorr.
Create a Bitcoin transaction. Bitcoin transactions spend unspent transaction outputs (UTXOs) and create new UTXOs. A UTXO is the output of a Bitcoin transaction. It exists until it is used as the input of another transaction.
Sign the transaction using one of the supported threshold signature APIs. All inputs of a transaction must be signed before the transaction can be submitted to the Bitcoin network.
Submit the transaction by sending a request to the Bitcoin API that specifies the
blob
of the transaction and the target Bitcoin network (mainnet or testnet4).Read information from the Bitcoin network, such as transaction details or address balances.