examples
examples copied to clipboard
[Bug] basic_bitcoin example didn't work on dfx 0.17.0-0.18.0
Overview
When building and deploying the basic_bitcoin
canister to local bitcoin regtest
node, calls to the get_balance
and get_utxos
functions return 0 in all cases, but bitcoin-cli
returns correct values.
UPD. How to fix
Issue fixed with dfx argument --enable-bitcoin
instead of --bitcoin-node
, full command dfx start --clean --enable-bitcoin
. Also required version is 0.17.0.
System
dfx: 0.17.0
os: Apple M1 Pro, Sonoma 14.4
rust(with basic_bitcoin
toolchain override): rustc 1.68.0 (2c8cc3432 2023-03-06)
rust: rustc 1.76.0 (07dca489a 2024-02-04)
Steps to reproduce
- Build with
build.sh
inbasic_bitcoin
src root. - Start dfx node with bitcoin support:
dfx start --clean --bitcoin-node 127.0.0.1:18443
(optionally change ip:port to your bitcoin node) - Deploy binary via Makefile(in
basic_bitcoin
root -dfx deploy basic_bitcoin --argument '(variant { regtest })'
) - Fund some address with bitcoins(
generatetoaddress RPC
), then calldfx canister call basic_bitcoin get_utxos '("BITCOIN_ADDRESS")'
to get utxos. In my case it returns 0, but actuallybitcoin-cli
returns correct values.