Skip to main content

Build on Bitcoin

Bitcoin

ICP brings smart contract functionality to Bitcoin and opens up new possibilities for dapp development.

Through a protocol-level integration with the Bitcoin network, smart contracts deployed on ICP can interact with the Bitcoin network directly without using a bridge or oracle.

Threshold signing APIs, including threshold ECDSA and threshold Schnorr, enable an ICP smart contract to hold assets like BTC or sign and submit transactions to the Bitcoin network.

When an ICP smart contract wants to submit a Bitcoin transaction, the following steps may occur:

  • Request a public key from the threshold signing APIs
  • Create a Bitcoin address from the public key
  • Read unspent UTXOs from the Bitcoin API
  • Build the transaction payload
  • Request a signature of the transaction hash from the threshold signing API
  • Submit the transaction to the Bitcoin API

The Bitcoin API relays the request to the Bitcoin network, which receives and processes the request asynchronously before returning the result of the transaction to the ICP smart contract that initially created it.

ICP smart contracts can call the Bitcoin API to query the Bitcoin mainnet or testnet for network state information, UTXOs, block information, or the balance of any Bitcoin address.

Additional resources

Building Bitcoin applications is not trivial. It’s beneficial to understand core Bitcoin concepts, including transactions, UTXOs, the Script language, and Bitcoin’s hash formats.