Afternoon guys,
I’m stumped. I’m trying to get the ckBTC minter working locally. I’ve got a Bitcoin node spun up, all the correct canisters installed (thanks to the OISY repo for pointers here) and I think the config correct, but something must be off and I can’t figure this out.
My test script generates a new BTC deposit address, transfers BTC, and it the transfers show up as ‘Checked’ when I call update_balance on the ckBTC minter… but nothing is being minted in the ckBTC ledger - the balance is not changing.
Am I missing something simple here? Any ideas very highly appreciated!!
Many thanks in advance!
Dave
Minter init_args
(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";
}
})
Ledger init_args
(variant {
Init = record {
token_symbol = "ckBTC";
token_name = "Chain key local Bitcoin";
minting_account = record { owner = principal "ml52i-qqaaa-aaaar-qaaba-cai" };
transfer_fee = 11_500;
metadata = vec {};
initial_balances = vec {record { record { owner = principal "3pkpi-fby6r-fbtp5-6lch6-jiszp-6ne6p-ameal-mfml2-4itpa-2h3r2-7ae"; }; 100_000_000_000; }; };
archive_options = record {
num_blocks_to_archive = 10_000;
trigger_threshold = 20_000;
controller_id = principal "3pkpi-fby6r-fbtp5-6lch6-jiszp-6ne6p-ameal-mfml2-4itpa-2h3r2-7ae";
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.json
{
"canisters": {
"icp-ledger": {
"type": "custom",
"candid": "https://raw.githubusercontent.com/dfinity/ic/aba60ffbc46acfc8990bf4d5685c1360bd7026b9/rs/ledger_suite/icp/ledger.did",
"wasm": "https://download.dfinity.systems/ic/aba60ffbc46acfc8990bf4d5685c1360bd7026b9/canisters/ledger-canister.wasm.gz",
"specified_id": "ryjl3-tyaaa-aaaaa-aaaba-cai",
"init_arg_file": "ic/icp-ledger-init-args.did"
},
"icp-index": {
"type": "custom",
"candid": "ic/icp-index.did",
"wasm": "ic/icp-index.wasm.gz",
"specified_id": "qhbym-qaaaa-aaaaa-aaafq-cai",
"init_arg_file": "ic/icp-index-init-args.did"
},
"ckbtc-minter": {
"type": "custom",
"candid": "ic/ckbtc-minter.did",
"wasm": "ic/ckbtc-minter.wasm.gz",
"specified_id": "ml52i-qqaaa-aaaar-qaaba-cai",
"init_arg_file": "ic/ckbtc-minter-init-args.did"
},
"ckbtc-ledger": {
"type": "custom",
"candid": "ic/ckbtc-ledger.did",
"wasm": "ic/ckbtc-ledger.wasm.gz",
"specified_id": "mc6ru-gyaaa-aaaar-qaaaq-cai",
"init_arg_file": "ic/ckbtc-ledger-init-args.did"
},
"ckbtc-index": {
"type": "custom",
"candid": "ic/ckbtc-index.did",
"wasm": "ic/ckbtc-index.wasm.gz",
"specified_id": "mm444-5iaaa-aaaar-qaabq-cai",
"init_arg_file": "ic/ckbtc-index-init-args.did"
},
"ckbtc-kyt": {
"type": "custom",
"candid": "ic/ckbtc-kyt.did",
"wasm": "ic/ckbtc-kyt.wasm.gz",
"specified_id": "pvm5g-xaaaa-aaaar-qaaia-cai",
"init_arg_file": "ic/ckbtc-kyt-init-args.did"
},
"cketh-minter": {
"type": "custom",
"candid": "ic/cketh-minter.did",
"wasm": "ic/cketh-minter.wasm.gz",
"specified_id": "jzenf-aiaaa-aaaar-qaa7q-cai",
"init_arg_file": "ic/cketh-minter-init-args.did"
},
"cketh-ledger": {
"type": "custom",
"candid": "ic/cketh-ledger.did",
"wasm": "ic/cketh-ledger.wasm.gz",
"specified_id": "apia6-jaaaa-aaaar-qabma-cai",
"init_arg_file": "ic/cketh-ledger-init-args.did"
},
"cketh-index": {
"type": "custom",
"candid": "ic/cketh-index.did",
"wasm": "ic/cketh-index.wasm.gz",
"specified_id": "sh5u2-cqaaa-aaaar-qacna-cai",
"init_arg_file": "ic/cketh-index-init-args.did"
}
}
}
Test script
#!/bin/bash
dfx deploy
dfx canister call ckbtc-kyt set_api_key '(record { api_key = "" })'
BTC_CONF=$(pwd)/bitcoin-core/bitcoin.conf
WALLET="daemoney"
PRINCIPAL="3pkpi-fby6r-fbtp5-6lch6-jiszp-6ne6p-ameal-mfml2-4itpa-2h3r2-7ae"
TRANSFER_AMOUNT=7
BTC_MINING_ADDRESS=$(bitcoin-cli -conf=$BTC_CONF -rpcwallet="$WALLET" getnewaddress)
echo "BTC mining address: $BTC_MINING_ADDRESS"
BTC_DEPOSIT_ADDRESS=$(dfx canister call ckbtc-minter get_btc_address "(record { owner = opt principal \"${PRINCIPAL}\"; subaccount=null })"| sed -E 's/^\("([^"]+)"\)$/\1/')
echo "BTC deposit address: $BTC_DEPOSIT_ADDRESS"
echo "Sending $AMOUNT BTC TO $BTC_DEPOSIT_ADDRESS"
bitcoin-cli -conf=$BTC_CONF -rpcwallet="$WALLET" sendtoaddress "${BTC_DEPOSIT_ADDRESS}" "${TRANSFER_AMOUNT}"
echo "Mining 20 blocks"
bitcoin-cli -conf=$BTC_CONF generatetoaddress 20 ${BTC_MINING_ADDRESS}
echo "Waiting for canister sync"
sleep 10
echo "This should be minting $TRANSFER_AMOUNT ckBTC..."
dfx canister call ckbtc-minter update_balance "(record { owner = opt principal \"${PRINCIPAL}\"; subaccount=null})"
echo "...but the balance does not change"
dfx canister call ckbtc-ledger icrc1_balance_of "(record { owner = principal \"${PRINCIPAL}\"; subaccount=null})"