# Error Bitcoin API on Local

**URL:** <https://forum.dfinity.org/t/error-bitcoin-api-on-local/18592>\
**Category:** Developers\
**Created:** [February 20, 2023, 9:01am UTC](https://forum.dfinity.org/t/error-bitcoin-api-on-local/18592 "2023-02-20T09:01:25Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mavis](https://avatars.discourse-cdn.com/v4/letter/m/f475e1/32.png) [@Mavis](https://forum.dfinity.org/u/Mavis)\
**Post date:** [February 20, 2023, 9:01am UTC](https://forum.dfinity.org/t/error-bitcoin-api-on-local/18592/1 "2023-02-20T09:01:25Z")

</div>

Why does it return the error “the bitcoin API is not enabled on this subnet” on Local dev?  
I ran “dfx start --enable-bitcoin --background” and start server “Bitcoin Core”  
This is the dfx.json config canister with candid and wasm file built from [examples/motoko/basic\_bitcoin at master · dfinity/examples · GitHub](https://github.com/dfinity/examples/tree/master/motoko/basic_bitcoin)  
In that example, it returns successes. But I want to apply to my project.  
Thanks, you.

 ![image](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/2X/8/8a2ec31b0c863a25f5509d6651d4be12468fa140.png)  
 ![image](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/2X/e/ea28dae6d3f53d278f03e19ffe700d587eac53b8.png)  
 ![image](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/2X/b/bff58f5bff003bd52b809acd94ea9941313bba0d.png)

---

<div class="post-metadata">

**Author:** ![ielashi](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/ielashi/32/15704_2.png) [@ielashi](https://forum.dfinity.org/u/ielashi)\
**Post date:** [February 20, 2023, 12:56pm UTC](https://forum.dfinity.org/t/error-bitcoin-api-on-local/18592/2 "2023-02-20T12:56:43Z")

</div>

Hey @Mavis , does it work if you try `dfx start --clean --enable-bitcoin --background`? The additional `--clean` deletes whatever local state you have for dfx.

---

<div class="post-metadata">

**Author:** ![Mavis](https://avatars.discourse-cdn.com/v4/letter/m/f475e1/32.png) [@Mavis](https://forum.dfinity.org/u/Mavis)\
**Post date:** [February 20, 2023, 1:40pm UTC](https://forum.dfinity.org/t/error-bitcoin-api-on-local/18592/4 "2023-02-20T13:40:14Z")

</div>

It is not working  
If I run in example “basic\_bitcoin”, it will work. But I want to apply to my project

---

<div class="post-metadata">

**Author:** ![ielashi](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/ielashi/32/15704_2.png) [@ielashi](https://forum.dfinity.org/u/ielashi)\
**Post date:** [February 20, 2023, 2:55pm UTC](https://forum.dfinity.org/t/error-bitcoin-api-on-local/18592/5 "2023-02-20T14:55:20Z")

</div>

Please share your full `dfx.json` as well as the output of the command `dfx start --clean --enable-bitcoin`. If your project is available publicly somewhere I can also take a look there if you point me to it.

---

<div class="post-metadata">

**Author:** ![Mavis](https://avatars.discourse-cdn.com/v4/letter/m/f475e1/32.png) [@Mavis](https://forum.dfinity.org/u/Mavis)\
**Post date:** [February 21, 2023, 10:37am UTC](https://forum.dfinity.org/t/error-bitcoin-api-on-local/18592/6 "2023-02-21T10:37:08Z")

</div>

I tried upgrade dfx of my project and this is working 😊. But I have an question, I deployed example “basic\_bitcoin” outside my project on Mainnet with same Controller canister. So, Can I call canister “basic\_bitcoin” Mainnet from my project on Production? It still work?  
Because I tried call on Local and it return error “not route” when i call from my project 🤔

---

<div class="post-metadata">

**Author:** ![ielashi](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/ielashi/32/15704_2.png) [@ielashi](https://forum.dfinity.org/u/ielashi)\
**Post date:** [February 21, 2023, 3:41pm UTC](https://forum.dfinity.org/t/error-bitcoin-api-on-local/18592/7 "2023-02-21T15:41:09Z")

</div>

If I understand you correctly, you deployed the Bitcoin example on mainnet somewhere, and you also deployed your project, and you’re trying to call the Bitcoin example canister in your project, is that right? That should work, yes, both in production and locally. Can you share the error that you get and how you’re calling the canister?

---

<div class="post-metadata">

**Author:** ![Mavis](https://avatars.discourse-cdn.com/v4/letter/m/f475e1/32.png) [@Mavis](https://forum.dfinity.org/u/Mavis)\
**Post date:** [February 22, 2023, 11:45am UTC](https://forum.dfinity.org/t/error-bitcoin-api-on-local/18592/8 "2023-02-22T11:45:54Z")

</div>

This is my code.  
Env.BTC\_ID is canister id  
 ![image](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/2X/3/350dd65588b5ede6939da4db2ddc282c65e8c2fb.png)

 ![image](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/2X/a/ae0909352afd617ba616408c03d0039f79a2d672.png)

---

<div class="post-metadata">

**Author:** ![ielashi](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/ielashi/32/15704_2.png) [@ielashi](https://forum.dfinity.org/u/ielashi)\
**Post date:** [February 23, 2023, 8:34am UTC](https://forum.dfinity.org/t/error-bitcoin-api-on-local/18592/9 "2023-02-23T08:34:47Z")

</div>

Are you trying to call a canister in production from your own local setup? If yes, that is not possible. A canister on mainnet can only be called by another canister on mainnet. And, similarly, local canisters can only be called by canisters installed locally.

Maybe if you share the full error message I can have more insight into what you’re experiencing.
