ckBTC
What is ckBTC?
Chain-key Bitcoin (ckBTC) is an ICRC-1 and ICRC-2 compliant synthetic twin token that is backed 1:1 by BTC.
ckBTC does not rely on a centralized bridge to facilitate the conversion between BTC and ckBTC, which makes it substantially more secure when compared to other traditional 'wrapped' tokens.
ckBTC and BTC have the same value and can be swapped for one another seamlessly; however, ckBTC has several advantages. ckBTC has faster transactions that are finalized within a few seconds, and ckBTC transactions on ICP are significantly cheaper than those on the Bitcoin network.
Why you should use ckBTC
Choosing ckBTC for your dapp or product can provide several advantages:
Trustless commerce: Bitcoin-based commerce can run natively in an ICP smart contract, allowing for custodial solutions without mitigated third-party risks.
Security: ckBTC is decentralized, reducing the risk of compromise or rug pulls.
Low fees: A set fee of 0.0000001 ckBTC, which is equivalent to less than a cent or 10 satoshis.
Fast transactions: ckBTC facilitates fast transactions using a local ledger, only settling transactions on the Bitcoin network when necessary.
Easy integration: ckBTC is compatible with the ICRC-1 and ICRC-2 token standards.
Verifiable: All ckBTC activity is verifiable onchain, and ckBTC transactions go through checks to ensure that no tainted bitcoin is used on ICP or transferred to tainted Bitcoin addresses.
How it works
The ckBTC functionality is provided through an interplay of two canisters:
- The ckBTC minter.
- The ckBTC ledger.
Canister source code | ckBTC deployment (Bitcoin mainnet) | ckTESTBTC deployment (Bitcoin testnet4) |
---|---|---|
Minter | mqygn-kiaaa-aaaar-qaadq-cai | ml52i-qqaaa-aaaar-qaaba-cai |
Checker | oltsj-fqaaa-aaaar-qal5q-cai | o6ude-eyaaa-aaaar-qal6a-cai |
Ledger | mxzaz-hqaaa-aaaar-qaada-cai | mc6ru-gyaaa-aaaar-qaaaq-cai |
Archive | nbsys-saaaa-aaaar-qaaga-cai | m62lf-ryaaa-aaaar-qaacq-cai |
Index | n5wcd-faaaa-aaaar-qaaea-cai | mm444-5iaaa-aaaar-qaabq-cai |
The ckBTC ledger is responsible for keeping account balances and for transferring ckBTC between accounts.
As the number of transactions grows, the ckBTC ledger automatically creates archive nodes holding past transactions.
To simplify access to the transaction history of the ledger, a dedicated index canister is deployed.
The ckBTC minter is responsible for minting and burning ckBTC tokens. It uses the following workflow:
Tokens are minted when a user transfers bitcoins to a specific Bitcoin address under the ckBTC minter's control. The Bitcoin address uniquely identifies the owner of the sent bitcoins.
The ckBTC minter waits for confirmations of all Bitcoin transactions that affect the total supply of ckBTC (because of the lack of finality in Bitcoin).
For Bitcoin retrieval requests, the ckBTC minter burns ckBTC before transferring the corresponding BTC amount (minus fees) using a regular Bitcoin transaction.
A simplified overview of the process to mint and transfer ckBTC is depicted in the following figure.
Note: Before ckBTC is is minted to the user, the ckBTC minter performs a check for the Bitcoin address which transferred the bitcoins. A detailed description of the whole process can be found on the Wiki.
Resources
Source Code
- ckBTC minter Canister that converts BTC to ckBTC and back.
- Bitcoin checker Canister that checks whether the address or transaction may be associated with illicit activities.
- Ledger Canister that implements the ICRC-1 and ICRC-2 token standard and which is used for ckBTC.
- Archive Canister that holds archived ledger transactions.
- Index Canister that syncs the ledger transactions and indexes them by account.
Dashboards
ckBTC on the ICP Dashboard Provides an overview of all ckBTC-related information, including total supply, tracked UTXOs, synced Bitcoin block height, ckBTC canisters, and recent transactions.
ckTESTBTC on the ICP Dashboard Similar to the ckBTC dashboard, just for ckTESTBTC.
ckBTC minter The minters own dashboard that provides all the information about the minter's current state, the available UTXOs, outgoing transactions, current parameters, and the logs.
ckTESTBTC minter Similar to the ckBTC minter dashboard, just for ckTESTBTC.
Docs & Tutorials
- ckBTC technical deep dive
- ckBTC API reference
- Bitcoin integration: technology overview
- Chain-key tokens
- Developer Liftoff: ckBTC and Bitcoin integration
Libraries
JavaScript:
- ckbtc Library for interfacing with the ckBTC minter.
- ledger-icrc Library for interfacing with ICRC-1/2 ledgers.
Rust:
- icrc-ledger-types Package defining types for interfacing with ICRC-1/2 ledgers.
- icrc-ledger-agent Agent that uses
icrc-ledger-types
for interfacing with ICRC-1/2 ledgers. - icrc-ledger-client Package that uses
icrc-ledger-types
and defines functions for interfacing with ICRC-1/2 ledgers. - icrc-ledger-client-cdk Package that defines runtime meant to be used together with the
icrc-ledger-client
library.
Motoko:
- icrc2-types Motoko package that defines types for interfacing with ICRC-1/2 ledgers.
Articles
- ckBTC: A Decentralized Mechanism for Efficient Bitcoin Transfers
- How ckBTC Solves the Dilemma of Blockchain Bridges
- Chain-Key Bitcoin: A Decentralized Bitcoin Twin
- ckBTC Sparks a New Era on the Internet Computer
Videos
- Introduction to Bitcoin Integration
- How to use ICP as a Bitcoin L2
- All about ckBTC DFINITY Twitter Space.