Bitcoin - ICP integration: The ONLY guide you Need!

It is official! The BTC-ICP integration is now live on the mainnet! This breakthrough innovation now gives the Internet Computer’s canister smart contracts the ability to host Bitcoin natively and fully on-chain.

Bitcoin - ICP integration: The ONLY guide you Need!

It is official! The BTC-ICP integration is now live on the mainnet! This breakthrough innovation now gives the Internet Computer’s canister smart contracts the ability to host Bitcoin natively and fully on-chain. You may be wondering what this means to you. Read this article to learn everything you need to know about the BTC-ICP integration.

Bitcoin, the world’s largest cryptocurrency, can now be used on the Internet Computer (IC) blockchain for decentralized finance (DeFi) activities, providing services with a trustless foundation. This innovation results from advanced smart contract functionality via the Internet Computer’s enhanced Chain-key cryptography. This direct integration with Bitcoin eliminates the error-prone and often hacked bridges that facilitated interactions between blockchains using wrapped Bitcoin.

However, before we dive into everything there is to know about the integration, let us look at the timeline of events from when it started to where we are at the current release.


Timeline of Integration

2021

July - Discussion begins, and a topic is created on the developer forum for “Direct integration with Bitcoin.”

September -  The Internet Computer community voted for Proposal 20586: “Direct integration of Internet Computer with Bitcoin network,” which saw Thomas Locher and Dieter Sommer as the key people involved.

Two days later, the final results of the proposal were ready. 96.55% of the voting power logged “Yes” votes at a voting power of 301,806,620.

2022

January - The first phase is completed; smart contracts are unlocked in Bitcoin, and the threshold ECDSA signatures (more on this below) DEMO is live.

February - Phase two is completed; DFINITY cryptographers and engineers release a new Bitcoin integration Application Programming Interface (API).

August - Pre-Phase three (testnet) is completed; integration beta release and testnet API is now available!

December - BTC-ICP integration is live on the mainnet; canister smart contracts on the Internet Computer can now sign Bitcoin transactions on the Bitcoin mainnet.


What this Integration means

This integration is intended to enable fast Bitcoin transactions between smart contracts on the Internet Computer, as the DFINITY Foundation is currently working on Chain-Key Bitcoin (ckBTC). Here, ckBTC will play the role of a local ledger facilitating fast transactions with low fees and only settling transactions using the Bitcoin network when necessary. This interoperability has been part of the IC’s vision to integrate IC technologies and mechanisms with existing blockchain networks and systems, fulfilling its mission to provide a powerful general-purpose blockchain that is open, secure, and scalable for everybody.

Trustless and Bridgeless Intermediary

Before Bitcoin was integrated with the Internet Computer Protocol, Wrapped Bitcoin (wBTC), which was created with Ethereum’s ERC-20 token standard, was the only way BTC was traded and hosted in DeFi. This gave BTC the limitation of not being trustless outside of its network, as the wrapper services needed to act as intermediaries to help move Bitcoin from one system to another.

Here’s a pictorial representation of how the movement of Wrapped Bitcoin works:

Before Bitcoin was integrated with the Internet Computer Protocol, Wrapped Bitcoin (wBTC), which was created with Ethereum’s ERC-20 token standard, was the only way BTC was traded and hosted in DeFi.

How it works

Blockchain bridges are known to be advantageous and an easy route for interoperability between Web3 services, but they are especially vulnerable to cyberattacks and present significant security risks.

But the Internet Computer has stepped up with its integration with Bitcoin to provide a more secure alternative to centralized bridging in the form of the threshold ECDSA (Elliptic Curve Digital Signature Algorithm). This ECDSA implementation empowers Internet Computer canister smart contracts to transact Bitcoin directly without an intermediary or bridge. Applying this mechanism will use Chain-key cryptography to assign each smart contract canister its own Bitcoin public key, thus directly linking the Internet Computer to the Bitcoin network, as Geoffrey has already written in this article. As a result, smart contract canisters on the Internet Computer will then be able to host, send and receive their own Chain-Key linked Bitcoin (referred to as ckBTC, already explained above).


Benefits and Expected aftermath of the Integration

Bitcoin could become one of the main tokens on the Internet Computer, other than $ICP, to be used for conceivable use cases. For example, social platforms like OpenChat will allow users to transfer Bitcoins via instant messages, and decentralized applications (dApps) like Spinner will also support private Bitcoin transactions using zero-knowledge proofs.

At the center of DeFi, the properties of Internet Computer's Bitcoin integration will make it a primary foundation for applications incorporating Bitcoin, enhancing the functionality and value of the existing DeFi ecosystem while sparking a wave of new projects that will also come from new developers taking advantage of the liquidity of Bitcoin, such as InfinitySwap.

There would be the possibility of Bitcoin crypto lending on a more robust trust model than is available on other platforms thanks to the direct and trustless integration of Internet Computer, making it a natural choice for DeFi developers.

Some ICP community projects are already creating solutions, taking advantage of this integration. Examples are:

  • Decentralized Exchange (DEX) projects, such as IC Lighthouse and Helix Markets, which build on the signature features of Bitcoin and Chain-Key to offer cross-chain token exchanges without bridges.
  • Platforms like Finterest will enable cross-chain lending and unbridged borrowing of cryptocurrencies, including Bitcoin.
  • Projects like CrowdfundNFT — an NFT-based crowdfunding platform, will start accepting funding for projects in BTC,  opening up a whole new form of crowdfunding.

Other examples of interesting use cases in development are BTC transactions on NFT marketplaces and peer-to-peer transfer of BTC directly on social media and instant messaging, as Spinner and OpenChat are already developing.

With the programmability of this integration, many more unique and imaginative use cases will be developed in the near future. We cannot wait to see them show up!

Developer Resources

Developers can immediately start writing canister smart contracts that use the Internet Computer’s new Bitcoin integration API, add Bitcoin to existing IC Web3 services, or build native Bitcoin DeFi.

Here is a DEMO video of direct Internet Computer integration with Bitcoin:

This is a demo video from DFINITY's Islam El-Ashi from an internal DFINITY R&D meeting. Courtesy: DFINITY.

With the Bitcoin API Developer Preview, developers can write canisters that interact with Bitcoin, query the status of the blockchain balances and unspent transaction outputs (UTXO) for any Bitcoin address, and send transactions to the Bitcoin network.

This Bitcoin functionality involves two main features, made possible by;

  • Bitcoin Integration API: This feature is the technical integration of the Bitcoin network with the Internet Computer Protocol stack. A Bitcoin canister (“virtual” canister) performs most of the Bitcoin logic and is implemented as part of the replica. Outside the replica is a Bitcoin Adapter connecting to the main Bitcoin network to retrieve blocks and send outgoing transactions. Integrating Bitcoin functionality into the Internet Computer Protocol stack allows blocks to be placed on the stack and arrive at the Bitcoin Canister via the Internet Computer's consensus mechanism, with transactions coming back on the other side to be sent by the Bitcoin Adapter to the Bitcoin network.
  • Threshold ECDSA API: This feature is an extension of Internet Computer's Chain-Key cryptographic suite. It allows canisters to request an ECDSA signature from ECDSA-enabled subnets, which keep ECDSA master keys secret-shared among all their replicas. The signatures are created at the request of the canisters by the ECDSA-enabled subnets through a multi-part cryptographic protocol using the shared secret private key. Each canister gets its own derived keys, which only it can control for issuing signatures. These actions allow Bitcoin transactions to sign within the trust model of the Internet Computer, i.e., up to less than a third of the replicas in an ECDSA subnet can be compromised without compromising security. Canisters can obtain their public key(s) from the ECDSA subnet to compute their Bitcoin addresses. The threshold ECDSA protocol supports a backwards-compatible generalization of the BIP-32 key derivation scheme to derive an arbitrary number of keys, and thus Bitcoin addresses, per canister.

Here are some important resource links for developers to get started coding Bitcoin:

All other official resources, documents, and sample codes on the BTC-ICP integration are available here: https://internetcomputer.org/bitcoin-integration.

Connect with InfinitySwap

Twitter | Website | Telegram | Discord | Github