The Internet Computer’s Bitcoin Developer Preview Is Now Available

Developers can immediately begin writing canister smart contracts that make use of the Internet Computer’s new Bitcoin integration API.

DFINITY
The Internet Computer Review
6 min readFeb 3, 2022

--

The DFINITY Foundation has taken a major step toward making powerful smart contract functionality available to the Bitcoin network on the Internet Computer blockchain. Today’s release of the Bitcoin integration developer preview enables developers to immediately begin writing canister smart contracts that make use of the Internet Computer’s new Bitcoin API, with the full release of the Bitcoin integration coming later this year.

The Internet Computer’s direct integration with Bitcoin is bringing advanced smart contracts to the world’s largest cryptocurrency without a trusted intermediary or bridge, providing a foundation for DeFi projects using Bitcoin. Once it is deployed, every canister smart contract on the Internet Computer will be able to function as a Bitcoin wallet, opening up a plethora of use cases and dapp implementations.

InfinitySwap, regarded as the “Uniswap” of the Internet Computer ecosystem, intends to be one of the first AMMs to launch on the Internet Computer and leverage its direct integration with Bitcoin to enable staking directly from Bitcoin wallets. This is a revolutionary new technology that enables smart contracts to take control of a BTC key — a valuable innovation that, when paired with the InfinitySwap AMM, will enable anyone with a BTC wallet to stake the asset through its protocol.

InfinitySwap CEO Max Chamberlin says: “This is Bitcoin’s Big Bang moment — imagine integrating the world’s most decentralized and liquid crypto market (BTC) to staking opportunities on the world’s fastest blockchain network (ICP). The Internet Computer’s Chain Key cryptography breaks the narrative of wrapped BTC being the only option for DeFi, and for the first time empowers DeFi protocols to hold BTC in a completely decentralized way, paving the way for an explosion of staking opportunities. At InfinitySwap, we aim to leverage the Internet Computer to enable users to stake BTC and earn great APYs directly from their wallets through our liquidity pools.”

In the short history of blockchain, there have been numerous incidents of blockchain bridges being compromised, resulting in substantial financial losses. A crucial property of the Bitcoin integration is that it is “trustless,” meaning it does not require trust assumptions in addition to those of the Bitcoin network and the Internet Computer, which is a very strong property for the security of the resulting system: It does not require trusting any bridges or other additional parties for security or for ensuring that the integration is working, and therefore it does not risk having single points of failure.

John Egan, CEO at L’Atelier BNP Paribas, notes that Bitcoin smart contracts on the Internet Computer will be a direct integration, not an indirect substitute like wrapped BTC or a bidirectional payment system for off-ledger transactions like Lightning. He thinks it will have a significant impact on Bitcoin and on crypto more generally.

“This will give birth to a Bitcoin-based DeFi ecosystem. Simply put, IC is extending Ethereum-like functionality to Bitcoin albeit in a manner that is much faster, more scalable, and less expensive than current options,” he says. “Given Bitcoin’s absolute size of almost $1 trillion and its relative size to the cryptocurrency space (almost 40% market share), the resulting DeFi ecosystem could be quite large.”

With the Bitcoin API developer preview, developers can now begin writing canisters that interface with Bitcoin and query the blockchain state (balances and UTXOs for any Bitcoin address), as well as send transactions to the Bitcoin network. This preview is installed on top of the DFINITY Canister SDK; rather than running on the Internet Computer mainnet, as the full integration will, the preview is available only on the local dfx environment.

Technically speaking, the developer preview uses a locally deployed bitcoind node in regression testing (“regtest”) mode instead of integrating with the Bitcoin mainnet or testnet. This is the best choice for the local development environment, as it allows the developer to fully control “their own” local Bitcoin network, which behaves in a fully predictable manner, for testing purposes while avoiding the need to synchronize with the real Bitcoin testnet. You can find a summary page of the developer preview release comprising a link to the resources, installation instructions, API documentation, and sample projects in Motoko and Rust at smartcontracts.org.

The new Bitcoin functionality involves two major features:

  • Bitcoin integration API: This feature is the technical integration of the Bitcoin network with the Internet Computer Protocol stack. A Bitcoin Canister (“virtual” canister) realizing the major part of the Bitcoin logic is implemented as part of the replica. Outside of the replica is a Bitcoin Adapter that connects to the Bitcoin mainnet to retrieve blocks and send outgoing transactions. An integration of Bitcoin functionality into the Internet Computer Protocol stack allows for blocks to be pulled into the stack and reach the Bitcoin Canister through the Internet Computer’s consensus mechanism, with transactions going back the other way to be submitted by the Bitcoin Adapter to the Bitcoin network.
  • Threshold ECDSA API: This feature is an extension of the Internet Computer’s Chain Key cryptography suite. It allows canisters to request an ECDSA signature from ECDSA-enabled subnets, which hold ECDSA master keys secret-shared among all their replicas. Signatures are created on request of canisters by the ECDSA-enabled subnets through a cryptographic multi-party protocol using the secret-shared private key. Each canister gets its own derived keys, which it alone can control for having signatures issued.This allows for signing Bitcoin transactions within the trust model of the Internet Computer, i.e., up to less than one-third of the replicas of 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. Our threshold ECDSA protocol supports a backward-compatible generalization of the BIP-32 key derivation scheme to derive an arbitrary number of keys, and thus Bitcoin addresses, per canister.

Please note: The Bitcoin Canister is exposed as a regular WebAssembly-based canister in the Developer Preview release that needs to be installed by the developer. Canisters on the Bitcoin Developer Preview will not yet be able to access the Threshold ECDSA API, which means they will need to run their own ECDSA library to compute ECDSA signatures until the full Bitcoin integration is released as part of the Internet Computer’s Chromium milestone.

In addition to the above, the next steps will involve releasing a form of wrapped BTC on the Internet Computer by wrapping BTC obtained through the direct integration. This builds on the Bitcoin integration, and will be accomplished by a ledger-based implementation that realizes wrapped BTC without requiring additional trust assumptions. The wrapped BTC can be used on the Internet Computer without any of Bitcoin’s limitations (high transaction costs, low transaction throughput, long finality times, etc.), leveraging the Internet Computer blockchain’s ability to process more than 11,500 transactions per second with finality of 1 second on dapp subnets.

The availability of the Bitcoin integration is only one part of the larger integrations and DeFi strategy planned for the Internet Computer. Here are some of the crucial integrations that will be particularly beneficial also for Bitcoin integration use cases and help the DeFi ecosystem grow:

  • Allowing smart contracts to directly make HTTP(S) calls, thereby realizing, among other things, functionality that is otherwise provided by oracle networks, but without the need to trust any third-party oracle and with the additional flexibility the direct requests provide.
  • Direct Ethereum integration: This will follow the same basic principles of our direct integration with Bitcoin to achieve a trustless integration without intermediaries we need to trust. Specifically, all ERC-20 tokens on Ethereum can then be transferred in a “trustless” way between Ethereum and the Internet Computer and smart contracts on the Internet Computer can call smart contracts on Ethereum and vice versa.
  • Integrations with other blockchains: This has the intention to integrate with other blockchains and be able to transfer assets between them and the Internet Computer. This will help bring multiple other cryptocurrencies into the Internet Computer for use cases such as decentralized exchanges.

Links:

_____

Start building at smartcontracts.org and join the developer community at forum.dfinity.org.

--

--

DFINITY
The Internet Computer Review

The Internet Computer is a revolutionary blockchain that hosts unlimited data and computation on-chain. Build scalable Web3 dapps, DeFi, games, and more.