Error in Deploying Your First Bitcoin Dapp

I ran it as per the Deploying Your First Bitcoin Dapp process, but I get the following error with the command

dfx deploy --network=ic basic_bitcoin --argument '(variant { Testnet })'

Deploying: basic_bitcoin
Creating canisters…
Creating canister basic_bitcoin…
basic_bitcoin canister created on network ic with canister id: canister-id-cai
Building canisters…
Error: Failed while trying to deploy canisters.
Caused by: Failed while trying to deploy canisters.
Failed to build call canisters.
Failed while trying to build all canisters.
The build step failed for canister ‘6ksjb-jiaaa-aaaal-aa73q-cai’ (basic_bitcoin) with an embedded error: Failed to build Motoko canister ‘basic_bitcoin’.: Failed to compile Motoko.: Failed to run ‘moc’.: The command
/Users/name/dfinity/examples/motoko/basic_bitcoin/src/basic_bitcoin/src/ import error [M0009], file “/Users/name/dfinity/examples/motoko/basic_bitcoin/motoko-bitcoin/src/ec/Curves/” does not exist

The folder in local(vscode):
“/Users/name/dfinity/examples/motoko/basic_bitcoin/motoko-bitcoin/” is empty.
Did I miss something?

macos: v12.5
dfx: 0.11.1-beta.2


Try running the following in the examples git repository:

git submodule update --init --recursive

This will fetch the missing dependencies. I’ll update the tutorial docs to mention that, thanks for reporting this.


thanks for letting is know @ueyamamasashi!


I’m getting another error.

In the basic_bitcoin example, despite this being enabled in dfx.json

“bitcoin”: {
“enabled”: true,
“nodes”: [

when I run dfx start --background I get

Running dfx start for version 0.12.1
Using the default definition for the 'local' shared network because /Users/user/.config/dfx/networks.json does not exist.
Dashboard: http://localhost:56516//dashboard

And then on Candid I get this error:

Call was rejected:
Request ID: 712e1282edb7c3a8731caa265a8b8bf9458618a56c89610eb64495e492ef0040
Reject code: 4
Reject text: The bitcoin API is not enabled on this subnet.

The local bitcoin network is saying

2022-12-09T18:50:17Z init message: Starting network threads…
2022-12-09T18:50:17Z net thread start
2022-12-09T18:50:17Z dnsseed thread start
2022-12-09T18:50:17Z addcon thread start
2022-12-09T18:50:17Z opencon thread start
2022-12-09T18:50:17Z 0 addresses found from DNS seeds
2022-12-09T18:50:17Z dnsseed thread exit
2022-12-09T18:50:17Z init message: Done loading
2022-12-09T18:50:17Z msghand thread start
2022-12-09T18:51:18Z Adding fixed seeds as 60 seconds have passed and addrman is empty
2022-12-09T19:22:32Z Potential stale tip detected, will try using extra outbound peer (last tip update: 1890 seconds ago)

Any idea what is causing this?

TLDR: This PR fixes it, do the same to your project.

When we moved to system-wide dfx, we decided that project-specific settings (like the "enabled": true you have in your project’s dfx.json) only work if you run a project-specific dfx start. To have a project-specific dfx start, you have to define the local network in your project’s dfx.json as well, not just the defaults.

Also, when I updated the examples for the latest version of dfx, I forgot to include the project-specific network definitions. I’m sorry for that, and I’m fixing it in this PR.