BTC-integration canister endpoints not returning expected results

Hi @kobby5angels .

I can confirm that dfx v0.18.0 will produce the error of IC0501: Canister g4xu7-jiaaa-aaaan-aaaaq-cai is out of cycles.

But dfx v0.17.0 worked for me.

Prepare Bitcoin Regtest network

$ bitcoind -regtest -daemonwait
$ bitcoin-cli -regtest createwallet "test"
$ ADDRESS="$(bitcoin-cli -regtest getnewaddress)"
$ echo $ADDRESS
bcrt1qwtcc7xmt9gx99pu0q5976uzdnufccawwc4rfxj
$ bitcoin-cli -regtest generatetoaddress 1 "$ADDRESS"
[
  "3526ba1ec3960eebf0249720f87b11b6e9c2cb1b9856a692764b43183f7efb02"
]

Start local replica

$ dfx start --clean --background --enable-bitcoin
# Many logs ...

Deploy canister and make a call

$ make
$ dfx canister call basic_bitcoin get_utxos '("bcrt1qwtcc7xmt9gx99pu0q5976uzdnufccawwc4rfxj")'
(
  record {
    next_page = null;
    tip_height = 1 : nat32;
    tip_block_hash = blob "\02\fb\7e\3f\18\43\4b\76\92\a6\56\98\1b\cb\c2\e9\b6\11\7b\f8\20\97\24\f0\eb\0e\96\c3\1e\ba\26\35";
    utxos = vec {};
  },
)

The result of generatetoaddress and the tip_block_hash field are the same (in reverse order).

to retrieve UTXOs. In my case, it returns 0; however, the bitcoin-cli returns correct values.

Could you elaborate a bit what did you mean by “returns 0”? And what bitcoin-cli command did you execute to get correct value?

1 Like