Skip to main content

Bitcoin integration overview

Advanced
Bitcoin

The integration of Internet Computer (ICP) with Bitcoin allows ICP smart contracts to directly interact with the Bitcoin network.

Why this is important

The Bitcoin integration is important because it brings smart contract functionality to Bitcoin, which does not have a native smart contract platform itself, opening up new possibilities for DeFi and dapp development. For example, ICP smart contracts can directly hold, receive, and send BTC, and also facilitate the creation of a ckBTC token that is backed 1:1 by BTC.

How it works

Smart contracts running on ICP can directly interact with the Bitcoin network without using bridges. This is possible because ICP nodes can fetch and validate the Bitcoin network's blocks, and then make them available for smart contracts to query and read. Smart contracts can also sign and send Bitcoin transactions, allowing them to directly hold BTC.

This direct Bitcoin integration uses two features:

  • Threshold ECDSA and threshold Schnorr: A smart contract can have a secret key that is stored in a secure and decentralized way using chain-key cryptography. This key can be used to digitally sign messages. ECDSA and Schnorr are compatible with the Bitcoin blockchain, enabling smart contracts to sign Bitcoin transactions.

  • Bitcoin adapter: ICP has one subnet whose nodes participate in the Bitcoin network. These nodes are used to fetch the Bitcoin state and blocks and send transactions to the network.

The diagram below shows the flow of interacting with the Bitcoin network from a smart contract.

Bitcoin overview

At the protocol-level, both the Bitcoin adapter and chain-key ECDSA features expose an API on the management canister.

When a canister wants to make a Bitcoin transaction, a request is sent to the Bitcoin subnet that hosts a Bitcoin canister that contains ICP's onchain Bitcoin state. The request is sent to the Bitcoin network through the Bitcoin adapter and is processed by Bitcoin asynchronously.

ckBTC

The primary value of chain-key tokens, such as ckBTC, is that it can be transferred with the low finality time (within seconds) and for a fraction of the cost of a transaction on the token's native network (in this instance, a BTC transaction on Bitcoin).

Use cases and sample dapps

The Bitcoin integration supports both basic and advanced use cases, such as decentralized exchanges or working with Bitcoin inscriptions.

The ckBTC token is suitable for the common use cases of holding, transferring, and trading BTC.

Sample apps:

  • Crowdfunding platforms that accept BTC such as Funded.

  • Social applications that support sending crypto to other users, like OpenChat.

  • Online eCommerce platforms. Bitshop is one example.

  • Mobile payments.

View the full list of Bitcoin ecosystem examples.

Next steps

Learn about the Bitcoin developer workflow on ICP