# Failing to convert BTC to CKBTC in local setup

**URL:** <https://forum.dfinity.org/t/failing-to-convert-btc-to-ckbtc-in-local-setup/30447>\
**Category:** Developers\
**Created:** [May 7, 2024, 3:09pm UTC](https://forum.dfinity.org/t/failing-to-convert-btc-to-ckbtc-in-local-setup/30447 "2024-05-07T15:09:42Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![icnerd](https://avatars.discourse-cdn.com/v4/letter/i/e274bd/32.png) [@icnerd](https://forum.dfinity.org/u/icnerd)\
**Post date:** [May 7, 2024, 3:09pm UTC](https://forum.dfinity.org/t/failing-to-convert-btc-to-ckbtc-in-local-setup/30447/1 "2024-05-07T15:09:42Z")

</div>

I’m trying to convert BTC to CkBTC in my local setup, but I’m failing.

here is my [deployment script](https://github.com/pramitgaha21/etcher/blob/main/deploy.sh)

```bash
dfx deploy --specified-id ml52i-qqaaa-aaaar-qaaba-cai ckbtc_minter --argument '(variant{
        Init = record {
                btc_network = variant { Regtest };
                ledger_id = principal "mc6ru-gyaaa-aaaar-qaaaq-cai";
                ecdsa_key_name = "dfx_test_key";
                retrieve_btc_min_amount = 10_000;
                max_time_in_queue_nanos = 420_000_000_000;
                min_confirmations = opt 1;
                mode = variant { GeneralAvailability };
                kyt_fee = opt 1_333;
                kyt_principal = opt principal "pvm5g-xaaaa-aaaar-qaaia-cai"                
}
})'

PRINCIPAL="$(dfx identity get-principal)"

dfx deploy --specified-id mc6ru-gyaaa-aaaar-qaaaq-cai ckbtc_ledger --argument '(variant{
        Init = record{
                token_symbol = "ckBTC";
                token_name = "Chain Ley Local Bitcoin";
                minting_account = record { owner = principal "ml52i-qqaaa-aaaar-qaaba-cai" };
                transfer_fee = 11_500;
                metadata = vec {};
                initial_balances = vec {};
                archive_options = record {
                        num_blocks_to_archive = 10_000;
                        trigger_threshold = 20_000;
                        controller_id = principal "'$PRINCIPAL'";
                        cycles_for_archive_creation = opt 1_000_000_000_000;
                        max_message_size_bytes = null;
                        node_max_memory_size_bytes = opt 3_221_225_472;
        };
        feature_flags = opt record { icrc2 = true };
}
})'

dfx deploy --specified-id pvm5g-xaaaa-aaaar-qaaia-cai ckbtc_kyt --argument '(variant{
        InitArg = record {
                api_key = "";
                minter_id = principal "ml52i-qqaaa-aaaar-qaaba-cai";
                maintainers = vec {principal "'$PRINCIPAL'" };
                mode = variant { AcceptAll };
}
})'

dfx deploy --specified-id mm444-5iaaa-aaaar-qaabq-cai ckbtc_index --argument '(opt variant{
        Init = record{
                ledger_id = principal "mc6ru-gyaaa-aaaar-qaaaq-cai";
}
})'

```

Here is the steps I followed,

```bash
$ dfx identity get-principal
u3chv-6rta2-bf3vt-ttvj7-epxse-o6e4d-qf3ng-pjky2-zqvld-dutpz-sqe

```

```bash
$ dfx canister call ckbtc_minter get_btc_address '(record{ owner= opt principal "u3chv-6rta2-bf3vt-ttvj7-epxse-o6e4d-qf3ng-pjky2-zqvld-dutpz-sqe"; subaccount= null })'
("bcrt1qtpdealdncn2jfkh9spka3k4yvzu9fhyvwd8q8y")

```

```bash
$ docker compose exec bitcoind bitcoin-cli generatetoaddress 1 bcrt1qtpdealdncn2jfkh9spka3k4yvzu9fhyvwd8q8y

```

```bash
$ docker compose exec bitcoind bitcoin-cli -generate 101

```

```bash
$ dfx canister call ckbtc_minter update_balance '(record { owner = opt principal "u3chv-6rta2-bf3vt-ttvj7-epxse-o6e4d-qf3ng-pjky2-zqvld-dutpz-sqe"; subaccount=n
ull })'
(
  variant {
    Ok = vec {
      variant {
        Checked = record {
          height = 408 : nat32;
          value = 1_250_000_000 : nat64;
          outpoint = record {
            txid = blob "\6a\12\85\4c\8b\cc\7a\68\f3\da\61\da\a0\10\68\48\29\e7\97\71\3a\40\b0\3c\d1\75\55\59\5f\c2\69\9f";
            vout = 0 : nat32;
          };
        }
      };
    }
  },
)

```

```bash
$ dfx canister call ckbtc_ledger icrc1_total_supply
(0 : nat)

```

---

<div class="post-metadata">

**Author:** ![PaulLiu](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/paulliu/32/4701_2.png) [@PaulLiu](https://forum.dfinity.org/u/PaulLiu)\
**Post date:** [May 8, 2024, 12:06am UTC](https://forum.dfinity.org/t/failing-to-convert-btc-to-ckbtc-in-local-setup/30447/3 "2024-05-08T00:06:07Z")

</div>

The ckBTC minter dashboard can also help with debugging. It should be accessible by this URL:

`http://ml52i-qqaaa-aaaar-qaaba-cai.localhost:PORT/dashboard`

Replace `PORT` with the actual port number of your local dfx/replica.

---

<div class="post-metadata">

**Author:** ![PaulLiu](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/paulliu/32/4701_2.png) [@PaulLiu](https://forum.dfinity.org/u/PaulLiu)\
**Post date:** [May 8, 2024, 12:08am UTC](https://forum.dfinity.org/t/failing-to-convert-btc-to-ckbtc-in-local-setup/30447/4 "2024-05-08T00:08:05Z")

</div>

Also, since you are running a local bitcoin in `RegTest` mode, please make sure its block height is advanced to make progress.

---

<div class="post-metadata">

**Author:** ![icnerd](https://avatars.discourse-cdn.com/v4/letter/i/e274bd/32.png) [@icnerd](https://forum.dfinity.org/u/icnerd)\
**Post date:** [May 8, 2024, 2:44am UTC](https://forum.dfinity.org/t/failing-to-convert-btc-to-ckbtc-in-local-setup/30447/5 "2024-05-08T02:44:49Z")

</div>

I see this error in the log,

```auto
Failed to mint ckBTC for UTXO 711c2f5231cfdbc7b113f5c72f8ad34ec5eeadba40041c00ec62fb876da3ffe1:0: 
TemporarilyUnavailable("cannot mint ckbtc: IC0503: Canister mc6ru-gyaaa-aaaar-qaaaq-cai trapped explicitly: the memo field size of 41 bytes is above the allowed limit of 32 bytes (reject_code = 5)")

```

---

<div class="post-metadata">

**Author:** ![PaulLiu](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/paulliu/32/4701_2.png) [@PaulLiu](https://forum.dfinity.org/u/PaulLiu)\
**Post date:** [May 8, 2024, 6:25am UTC](https://forum.dfinity.org/t/failing-to-convert-btc-to-ckbtc-in-local-setup/30447/6 "2024-05-08T06:25:46Z")

</div>

> [@icnerd](#):
>
> `ckbtc_ledger`

You can try re-deploy ckBTC ledger with a bigger `max_memo_length`, e.g. 80 bytes.

---

<div class="post-metadata">

**Author:** ![Manu](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/manu/32/3999_2.png) [@Manu](https://forum.dfinity.org/u/Manu)\
**Post date:** [May 8, 2024, 7:09am UTC](https://forum.dfinity.org/t/failing-to-convert-btc-to-ckbtc-in-local-setup/30447/7 "2024-05-08T07:09:08Z")

</div>

Exactly, I think Paul found the problem. You can see in this proposal [Proposal: 123422 - ICP Dashboard](https://dashboard.internetcomputer.org/proposal/123422) that the ckBTC ledger was upgraded to use 80 byte memos.

---

<div class="post-metadata">

**Author:** ![icnerd](https://avatars.discourse-cdn.com/v4/letter/i/e274bd/32.png) [@icnerd](https://forum.dfinity.org/u/icnerd)\
**Post date:** [May 8, 2024, 7:27am UTC](https://forum.dfinity.org/t/failing-to-convert-btc-to-ckbtc-in-local-setup/30447/8 "2024-05-08T07:27:17Z")

</div>

thank you, it works now…

---

<div class="post-metadata">

**Author:** ![0xbarchitect](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/0xbarchitect/32/31535_2.png) [@0xbarchitect](https://forum.dfinity.org/u/0xbarchitect)\
**Post date:** [January 14, 2026, 9:34am UTC](https://forum.dfinity.org/t/failing-to-convert-btc-to-ckbtc-in-local-setup/30447/11 "2026-01-14T09:34:56Z")

</div>

Hi, I am also developing a dapp to convert BTC to ckBTC and use [deployment script](https://github.com/pramitgaha21/etcher/blob/main/deploy.sh) to setup local environment with bitcoin-core node.

I can convert BTC to ckBTC successfully, but the opposite side from ckBTC to BTC, the conversion transaction is stuck in PENDING state. The steps are as follows.  
Approve the conversion amount 1BTC to ckBTC minter canister

`dfx canister call ckbtc_ledger icrc2_approve ‘(record {fee=null; memo=null; from_subaccount=null; created_at_time=null; amount=100000000; expected_allowance=null; expires_at=null; spender=record {owner=principal “ml52i-qqaaa-aaaar-qaaba-cai”; subaccount=null}})’ (variant { Ok = 144 : nat })`

call retrieve\_btc\_with\_approval on ckBTC minter  
`dfx canister call ckbtc_minter retrieve_btc_with_approval ‘(record {from_subaccount=null; address=“n285DnFf6Nd4JKqr9KhTbQDQybhAz2tm6H”; amount=100000000})’`  
`(variant { Ok = record { block_index = 145 : nat64 } })`

waiting for hours but the transaction is not processed  
`dfx canister call ckbtc_minter retrieve_btc_status_v2 ‘(record { block_index=145 })’`  
`(variant { Pending })`

Could you please help to figure out the problem?

---

<div class="post-metadata">

**Author:** ![0xbarchitect](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/0xbarchitect/32/31535_2.png) [@0xbarchitect](https://forum.dfinity.org/u/0xbarchitect)\
**Post date:** [January 16, 2026, 3:46am UTC](https://forum.dfinity.org/t/failing-to-convert-btc-to-ckbtc-in-local-setup/30447/12 "2026-01-16T03:46:11Z")

</div>

Hi,

Anybody can help?
