Problem with BTC interaction (example/basic-bitcoin)

Hi!

I’m a newcomer to ICP development, so I’m trying now to run an example with basic-bitcoin. The main issue is that, as I understand from the picture, the canister’s interface is incorrect. I’ve also tried to decompose this error, but it doesn’t help.

Here is a screenshot of the terminal windows and what is going on here:

Here is a screenshot of the web page and interface that I try to invoke:

get_p2pkh_address: () → (text)
Call failed:
Canister: bkyz2-fmaaa-aaaaa-qaaaq-cai
Method: get_p2pkh_address (update)
"Request ID": "5d28581ae5b0b5254c6a970eb6d8958a9219105d475e586a6e3345da73e2f3a1"
"Error code": "IC0503"
"Reject code": "5"
"Reject message": "Error from Canister bkyz2-fmaaa-aaaaa-qaaaq-cai: Canister called `ic0.trap` with message: Panicked at 'called `Result::unwrap()` on an `Err` value: (DestinationInvalid, \"Unable to route management canister request ecdsa_public_key: IDkgKeyError(\\\"Requested unknown threshold key: ecdsa:Secp256k1:insecure_test_key_1, existing keys: [ecdsa:Secp256k1:dfx_test_key, schnorr:Bip340Secp256k1:dfx_test_key, schnorr:Ed25519:dfx_test_key]\\\")\")', src/basic_bitcoin/src/ecdsa_api.rs:44:26.\nConsider gracefully handling failures from this canister or altering the canister to handle exceptions. See documentation: http://internetcomputer.org/docs/current/references/execution-errors#trapped-explicitly"

bitcoin.conf file internals:

deamon=1

# Bind to given address and always listen on it. (default: 0.0.0.0). Use [host]:port notation for IPv6. Append =onion to tag any incoming connections to that address and port as incoming Tor connections
# bind=127.0.0.1
# # Listen for incoming connections on non-default port.
port=18444

# Enable regtest mode. This is required to setup a private bitcoin network.
# chain=regtest
regtest=1

# Dummy credentials that are required by `bitcoin-cli`.
rpcuser=ic-btc-integration
rpcpassword=QPQiNaph19FqUsCrBRN0FII7lyM26B51fAMeBQzCb-E=
rpcauth=ic-btc-integration:cdf2741387f3a12438f69092f0fdad8e$62081498c98bee09a0dce2b30671123fa561932992ce377585e8e08bb0c11dfa

I have already tried all the pieces of advice in manuals, but nothing helps. Give description of them.

  • internetcomputer /docs/current/references/samples/rust/basic_bitcoin/

  • internetcomputer /docs/current/developer-docs/multi-chain/bitcoin/using-btc/local-development

  • internetcomputer /docs/current/references/bitcoin-how-it-works

The main questions are the following:

  • how actually ICP programs have to be debugged (I know how to do that in regular programs) especially in ICP. Maybe there are special resources where we can get detailed info?
  • Is it worth running example/basic-bitcoin or there is any other more relevant example?
  • How to run own local (for testing) and Bitcoin canister and interact with it? (Maybe more correctly - local BTC node or BTC canister in testnet/mainnet)

P.S.
The main goal is to learn how to send transactions/interact with BTC on ICP.

Thanks in advance!
I’m grateful for your answers!

Did you try ChatGPT?

  • Your canister is trying to request an ECDSA key with the name ecdsa:Secp256k1:insecure_test_key_1.
  • However, this key does not exist in your ICP local setup.
  • The available keys are:
  • ecdsa:Secp256k1:dfx_test_key
  • schnorr:Bip340Secp256k1:dfx_test_key
  • schnorr:Ed25519:dfx_test_key
  • Your canister needs to request dfx_test_key instead of insecure_test_key_1.
    Not sure if it helps.

Yep, that helped me. Thanks!
I’ve also seen that message from Copilot, but I didn’t believe into it. I thought that examples are correct anyway.

I have another question, do you know some resources to launch our own BTC canister onto the ICP or it is more common to use already deployed one into the ICP?