ckBTC: a canister-issued bitcoin twin token on the IC, 1:1-backed by BTC

I had a quick look at the logs and it looks like this indeed happened for two transactions:

P1	1677331938146480076	rs/bitcoin/ckbtc/minter/src/updates/retrieve_btc.rs:136	accepted a retrieve btc request for 0.0031696 BTC to address 1K7BSJbuXxaNVqqkui6N8TA3dJjiuqQCYL (block_index = 14404)
P1	1677345568273247995	rs/bitcoin/ckbtc/minter/src/lib.rs:275	[heartbeat]: signing a new transaction: 0200000001f32cb3c7efa348932e0abc02b11caa0cf52f9dff70e498639d8f942daedcf91f0100000000fdffffff0271ca0400000000001976a914c69d78bd1c8ce61f4ee5cdb5a4a4c284482409a888ac78a9e402000000001600147c86615657a15740439efbc942d8296ed12c034f00000000
P1	1677345576413379841	rs/bitcoin/ckbtc/minter/src/lib.rs:307	[heartbeat]: sending a signed transaction 02000000000101f32cb3c7efa348932e0abc02b11caa0cf52f9dff70e498639d8f942daedcf91f0100000000fdffffff0271ca0400000000001976a914c69d78bd1c8ce61f4ee5cdb5a4a4c284482409a888ac78a9e402000000001600147c86615657a15740439efbc942d8296ed12c034f02483045022100b7fb4ab52b62c6cc4c24305ee9ba37eef54a24bd48e36f30a0d01377e92013c30220649b1ad296c2110a7186acb5daa93060f76729849b01190c37de133470b34dc8012102d631cd2a1f63dbb42614c70a08313715fd86343c53d87195dc5bd8cd17cc186e00000000
P1	1677345613289796731	rs/bitcoin/ckbtc/minter/src/lib.rs:314	[heartbeat]: successfully sent transaction 971a64dd9268b867f45d93611cbfdb88f1219b0f050131c21611eaee8ecfc875

Which had almost 4 hours between the request and a submitted tx, and

P1	1677347432380678643	rs/bitcoin/ckbtc/minter/src/updates/retrieve_btc.rs:136	accepted a retrieve btc request for 0.00231448 BTC to address 1K7BSJbuXxaNVqqkui6N8TA3dJjiuqQCYL (block_index = 14430)
P1	1677359160939521049	rs/bitcoin/ckbtc/minter/src/lib.rs:275	[heartbeat]: signing a new transaction: 02000000017b186e598cceb55a1fddf9ece287dbde75962a027dbc7b53d0f5e89f41669f6f0100000000fdffffff02f87e0300000000001976a914c69d78bd1c8ce61f4ee5cdb5a4a4c284482409a888ac326aeb05000000001600147c86615657a15740439efbc942d8296ed12c034f00000000
P1	1677359169353777472	rs/bitcoin/ckbtc/minter/src/lib.rs:307	[heartbeat]: sending a signed transaction 020000000001017b186e598cceb55a1fddf9ece287dbde75962a027dbc7b53d0f5e89f41669f6f0100000000fdffffff02f87e0300000000001976a914c69d78bd1c8ce61f4ee5cdb5a4a4c284482409a888ac326aeb05000000001600147c86615657a15740439efbc942d8296ed12c034f02473044022008f16b7b6167307c2e9002ffe5c641d6e75d68532f8a64d8e5cea8875e6a46ca02204fdb9b9d07775870b9a4a285033baa1f9898f4c84530282e81e7ff48b41e884c012102d631cd2a1f63dbb42614c70a08313715fd86343c53d87195dc5bd8cd17cc186e00000000
P1	1677359180186257758	rs/bitcoin/ckbtc/minter/src/lib.rs:314	[heartbeat]: successfully sent transaction 954bbc8c83a225ed9ce4534c5a4b4cee4880795681ab2fb6b3201f816bb1b572

which had took just over 3 hours for the BTC tx to be submitted.

Then the following ones were fast again, probably because the change from older withdrawals came back again:

P1	1677382509178690453	rs/bitcoin/ckbtc/minter/src/updates/retrieve_btc.rs:136	accepted a retrieve btc request for 0.0044295 BTC to address 1K7BSJbuXxaNVqqkui6N8TA3dJjiuqQCYL (block_index = 14474)
P1	1677383118853268679	rs/bitcoin/ckbtc/minter/src/lib.rs:275	[heartbeat]: signing a new transaction: 0200000001efcbefd1872ed83b8c6beed4d6185de627481104f9d2ca6dd5c9768ddcc862e60100000000fdffffff02dbb50600000000001976a914c69d78bd1c8ce61f4ee5cdb5a4a4c284482409a888ac02acd705000000001600147c86615657a15740439efbc942d8296ed12c034f00000000
P1	1677383127043626433	rs/bitcoin/ckbtc/minter/src/lib.rs:307	[heartbeat]: sending a signed transaction 02000000000101efcbefd1872ed83b8c6beed4d6185de627481104f9d2ca6dd5c9768ddcc862e60100000000fdffffff02dbb50600000000001976a914c69d78bd1c8ce61f4ee5cdb5a4a4c284482409a888ac02acd705000000001600147c86615657a15740439efbc942d8296ed12c034f02473044022070c1099a001b2a8528252c1b2fa6262a96a25a6021c2271893902d7453f9b6e202205b4daa2e73df50ee56a8ab0b36f6ac848f016acc914ad4038792544a3baf4555012102d631cd2a1f63dbb42614c70a08313715fd86343c53d87195dc5bd8cd17cc186e00000000
P1	1677383137014163160	rs/bitcoin/ckbtc/minter/src/lib.rs:314	[heartbeat]: successfully sent transaction ba41f9c8d71f0fb9227479c24b0625bc6eeff196800701039787bb982f744bcf
P1	1677405816795606063	rs/bitcoin/ckbtc/minter/src/updates/retrieve_btc.rs:136	accepted a retrieve btc request for 0.00934589 BTC to address 1K7BSJbuXxaNVqqkui6N8TA3dJjiuqQCYL (block_index = 14641)
P1	1677406429646151732	rs/bitcoin/ckbtc/minter/src/lib.rs:275	[heartbeat]: signing a new transaction: 020000000175c8cf8eeeea1116c23101050f9b21f188dbbf1c61935df467b86892dd641a970100000000fdffffff0259360e00000000001976a914c69d78bd1c8ce61f4ee5cdb5a4a4c284482409a888acf367d602000000001600147c86615657a15740439efbc942d8296ed12c034f00000000
P1	1677406437799278184	rs/bitcoin/ckbtc/minter/src/lib.rs:307	[heartbeat]: sending a signed transaction 0200000000010175c8cf8eeeea1116c23101050f9b21f188dbbf1c61935df467b86892dd641a970100000000fdffffff0259360e00000000001976a914c69d78bd1c8ce61f4ee5cdb5a4a4c284482409a888acf367d602000000001600147c86615657a15740439efbc942d8296ed12c034f02483045022100bbce87d7c1c185a5137dec08f93ccba3f6d6daaf73f1bb9df0ba722122a4f4ab02202452f619d57ec0708f2e9e585500e9aeee18f7ec787d8d8d68c36bfd42f0f1f4012102d631cd2a1f63dbb42614c70a08313715fd86343c53d87195dc5bd8cd17cc186e00000000
P1	1677406447180035519	rs/bitcoin/ckbtc/minter/src/lib.rs:314	[heartbeat]: successfully sent transaction 5245572a2b6a900d990d49c21c1f334a469fd0804c3208161ac49d86507bfe37
3 Likes

The minter deploy arguments actually changed, and the README for the test canisters is outdated as of now.

For the minter, make sure you add the mode key to the record. This is an example deploy argument

dfx deploy minter --argument "(record {btc_network = variant { Regtest };ledger_id = principal \"$LEDGERID\"; ecdsa_key_name = \"dfx_test_key\";retrieve_btc_min_amount = 5_000;max_time_in_queue_nanos = 420_000_000_000; mode = variant {GeneralAvailability}})"

For the ledger, make sure you wrap the record with a variant (Init to deploy). This is an example deploy argument:

dfx deploy ledger --argument "(variant {Init = record {minting_account = record { owner = principal \"$MINTERID\" };transfer_fee = 0;token_symbol = \"ckBTC\";token_name = \"Token ckBTC\";metadata = vec {};initial_balances = vec {};archive_options = record {num_blocks_to_archive = 10_000;trigger_threshold = 20_000;cycles_for_archive_creation = opt 4_000_000_000_000;controller_id = principal \"$PRINCIPAL\";};}})"

obviously the env variables have to be present for the above to work.

The above also assumes you downloaded the dids and wasm using the latest blessed replica hash (1612a202d030faa496e1694eed98be4179fca856 at the time of writing). You can find the latest one here.
The following commands offer a way to download the dids and wasms for this release, IC_VERSION can be replaced by the hash of a different blessed replica version:

export IC_VERSION=1612a202d030faa496e1694eed98be4179fca856
curl -o wasm/ledger_canister.wasm.gz "https://download.dfinity.systems/ic/$IC_VERSION/canisters/ic-icrc1-ledger.wasm.gz"
curl -o did/ledger.did "https://raw.githubusercontent.com/dfinity/ic/$IC_VERSION/rs/rosetta-api/icrc1/ledger/icrc1.did"
gunzip wasm/ledger_canister.wasm.gz
curl -o wasm/ckbtc_minter.wasm.gz "https://download.dfinity.systems/ic/$IC_VERSION/canisters/ic-ckbtc-minter.wasm.gz"
gunzip wasm/ckbtc_minter.wasm.gz
curl -o did/minter.did "https://raw.githubusercontent.com/dfinity/ic/$IC_VERSION/rs/bitcoin/ckbtc/minter/ckbtc_minter.did"

Those are the deploy arguments for the minter and ledger for that IC_VERSION.

3 Likes

In NNS-dapp for local development purpose and for the time being (until we automate things), I’ve got a script to download the wasms and one to deploy locally. It’s inherited from the work of my colleague Léo (:muscle:). So if it can help here:

Download: https://github.com/dfinity/nns-dapp/blob/main/scripts/ckbtc/download-ckbtc

Deploy: https://github.com/dfinity/nns-dapp/blob/main/scripts/ckbtc/deploy-ckbtc

There is also a bit of badly documented comments about the deployment there https://github.com/dfinity/nns-dapp/blob/main/HACKING.md#ckbtc-deployment

Again, just few notes and scripts I use to develop until we got things tight up but, hope it can help.

7 Likes

thanks a lot @cryptoschindler and @peterparker!

1 Like

Any ETA on BTC to ckBTC opening to the general public?

Thanks!

7 Likes

thank you,it is works!)

3 Likes

hi there, I want to ask a question:
can we use ckbtc in our project now?
I know that there are some problems for btc->ckbtc.

Correct, users cannot yet convert BTC into ckBTC (see ckBTC and KYT Compliance for more context). However, your project can already support ckBTC transactions, just like eg openchat and dscvr already support tipping in ckBTC.

1 Like

@Manu whom do I talk to if i want to use this feature? does dfinity provide customer support? it acts like a web2 company with icp token as its security

ckBTC consists of some NNS-controlled canister smart contracts, so you can just start using it without asking anybody :). If you run into technical problems, I think this forum thread is a great place to ask questions.

1 Like

But few builders in my dms telling me that DFINITY is providing 24/7 direct customer support outside dev forums. This is the worst Security I have ever bought.

I followed the discussion on KYT - and you can see my thoughts on that from my comment… but are we now saying that this is “context” because it plays a part in deciding when to allow others to mint ckBTC?

Personally, I don’t think this should be a blocker, for the same reason that I don’t think the protocol should get involved in implementing KYT… but you can refer to my comment in the relevant thread to pick that up. It’s out of context here :wink:

Yes, the KYT topic is one of the open items that need to be addressed before the minting process can be opened up to everybody.

Just to be clear: KYT functionality will be exposed at the canister level and not implemented at the (Internet Computer) protocol level.

3 Likes

Is there a place to see the amount of ckBTC that has been issued?

You can use the ckTESTBTC dashboard here or the ckBTC dashboard here

3 Likes

Thanks! It’s showing testnet at the moment. Is there one for mainnet as well?

Oh, right, that’s testnet, sorry. I added mainnet in my above message

I believe that some discussion has been exhausted regarding the implementation of KYT.
Is the Foundation currently preparing a proposal?

Yes, proposals to move this forward (and opening up minting) are in the works.

3 Likes

Hello everybody!

DFINITY will submit three proposals today, which matches the outcome of the discussion wrt ckBTC & KYT (ckBTC and KYT Compliance - #414 by Jan).

  1. First, to install this Chainalysis KYT canister without any principals that can set API keys. This will let everybody review the Chainalysis KYT canister code.
  2. Second, a proposal sets an initial list of principals that can provide API keys. This proposal will contain Toniq’s principal. Anybody else that is willing to obtain a chainalysis subscription and perform the role of providing API keys can submit a proposal similar to this to add their own principal (and feel free to ask for help here).
  3. Third, a proposal to upgrade the ckBTC minter to use this KYT canister and enable BTC → ckBTC conversions. This proposal will also reduce the required confirmations from 72 to 12.

We will share the proposals here and I hope everybody takes the time to vote!

12 Likes