ckbtc

Integrate ckBTC deposits, transfers, and BTC withdrawals into Internet Computer canisters.

Updated Apr 3, 2026
One-click install
npx skills add https://github.com/phukrit7171/Relationship-Smart-Contract-ICP --skill ckbtc-phukrit7171
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ckbtc
Source: https://github.com/phukrit7171/Relationship-Smart-Contract-ICP/tree/main/.agents/skills/ckbtc
Command: npx skills add https://github.com/phukrit7171/Relationship-Smart-Contract-ICP --skill ckbtc-phukrit7171

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires ic-cdk, icrc-ledger-types, candid, serde.

What problem does it solve? Integrating Bitcoin into an Internet Computer canister requires correctly coordinating the ckBTC ledger and minter canisters, where mistakes like wrong canister IDs, missing fees, or skipped update_balance calls silently break deposits and withdrawals. ## Core Features & Use Cases - BTC Deposit Flow: Generate per-user Bitcoin deposit addresses via the minter's get_btc_address and mint ckBTC with update_balance using principal-derived 32-byte subaccounts. - ckBTC Transfers: Send ckBTC between accounts with icrc1_transfer at a 10 satoshi fee, settling in 1-2 seconds. - BTC Withdrawals: Convert ckBTC back to on-chain BTC using icrc2_approve plus retrieve_btc_with_approval, with full error variant handling. - Use Case: Build a canister where each user gets a unique BTC deposit address; the user sends BTC from any wallet, your canister calls update_balance to mint ckBTC into their subaccount, and they can later withdraw to any Bitcoin address. ## Quick Start Ask the AI to add ckBTC deposit and withdrawal support to your Rust or Motoko canister using the ckBTC ledger and minter canisters.

Frequently Asked Questions about ckbtc

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I accept Bitcoin deposits in an ICP canister?

Call get_btc_address on the ckBTC minter with the user's principal and subaccount to get a unique BTC address. After the user sends BTC, call update_balance on the minter to detect new UTXOs and mint equivalent ckBTC.

How to withdraw ckBTC to a Bitcoin address?

First call icrc2_approve on the ckBTC ledger granting the minter an allowance of amount plus 10 satoshis. Then call retrieve_btc_with_approval on the minter with the destination address and amount, which must be at least 50,000 satoshis.

What is the difference between the ckBTC ledger and minter canisters?

The ledger (mxzaz-hqaaa-aaaar-qaada-cai) handles ICRC-1 balances and transfers of ckBTC tokens. The minter (mqygn-kiaaa-aaaar-qaadq-cai) holds real BTC and handles minting from BTC deposits and burning for BTC withdrawals.

Why does my ckBTC transfer fail with InsufficientFunds?

Every icrc1_transfer deducts a 10 satoshi fee beyond the transfer amount. If an account holds exactly the amount being sent, the transfer fails; send balance minus 10 satoshis instead.

Can I test ckBTC integration on a local network?

There is no local ckBTC minter deployment. For local testing you must mock the minter interface, or test directly against the Bitcoin testnet4 or mainnet ckBTC canisters.