When building and deploying the basic_bitcoin example canister to local bitcoin regtest node, calls to the get_balance and get_utxos functions return 0 in all cases, even though similar calls using the bitcoin-cli return correct values.
System
dfx version: 0.17.0
OS: Apple M1 Pro, Sonoma 14.4
Steps to reproduce
Kindly clone the basic_bitcoin canister in the example repo.
Run dfx start --background to start the local replica.
Run make, which will execute the Makefile at the root of the basic_bitcoin example. This file contains basic deployment flow in regtest mode.
Fund some address with bitcoins(generatetoaddress RPC), then call dfx canister call basic_bitcoin get_utxos '("BITCOIN_ADDRESS")' to retrieve UTXOs. In my case, it returns 0; however, the bitcoin-cli returns correct values.
NOTE: With dfx version 0.18.0, executing any of the endpoints produces:
variant {
Err = record {
variant { SysTransient };
"IC0501: Canister g4xu7-jiaaa-aaaan-aaaaq-cai is out of cycles";
}
},
)
You’re absolutely right! This was mainly a setup issue, and not a bug in the BTC-integration canister. In particular, the local IC replica I started with dfx start --clean --background wasn’t communicating with the BTC-integration canister properly. I don’t know how crucial the --enable-bitcoin argument is, but it somehow did the trick for me.
Many thanks for your thorough response. I’m marking this as the solution.
I tried adding cycles just to see if it would work: dfx ledger fabricate-cycles --canister g4xu7-jiaaa-aaaan-aaaaq-cai --cycles 1000000000000000 but it did not work
The dfx v0.18.0 bundled bitcoin integration canister doesn’t work in local replica with an application subnet. You have to configure the local replica to run a system subnet.
The temporary fix which downgrade the bundled bitcoin canister was merged last week. It will be available in the upcoming dfx release next week.
You can also use dfx 0.17.0 for now. Building the dfx from sdk repo master branch will also work.