# Bitcoin canister failing

**URL:** <https://forum.dfinity.org/t/bitcoin-canister-failing/36169>\
**Category:** Developers\
**Created:** [October 14, 2024, 4:22pm UTC](https://forum.dfinity.org/t/bitcoin-canister-failing/36169 "2024-10-14T16:22:22Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![xalkan](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/xalkan/32/16076_2.png) [@xalkan](https://forum.dfinity.org/u/xalkan)\
**Post date:** [October 14, 2024, 4:22pm UTC](https://forum.dfinity.org/t/bitcoin-canister-failing/36169/1 "2024-10-14T16:22:22Z")

</div>

Is anyone else experiencing these errors from the Bitcoin mainnet canister?

`ghsi2-tqaaa-aaaan-aaaca-cai: Canister called ic0.trap with message: Panicked at 'Canister state is not fully synced.'`

`ghsi2-tqaaa-aaaan-aaaca-cai: Canister called ic0.trap with message: Panicked at 'Bitcoin API is disabled.'`

---

<div class="post-metadata">

**Author:** ![jennifertran](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jennifertran/32/11558_2.png) [@jennifertran](https://forum.dfinity.org/u/jennifertran)\
**Post date:** [October 14, 2024, 9:27pm UTC](https://forum.dfinity.org/t/bitcoin-canister-failing/36169/2 "2024-10-14T21:27:46Z")

</div>

Bitcoin testnet is still disabled.

Please see the full issue here and the process required to get Bitcoin testnet available again: [https://dashboard.internetcomputer.org/proposal/133308](https://dashboard.internetcomputer.org/proposal/133308)

The two required proposals have been passed and executed and the Bitcoin canister is continuing to sync. We hope that it will fully sync soon and will update everyone looking to use it as soon as possible.

---

<div class="post-metadata">

**Author:** ![dsarlis](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/dsarlis/32/689_2.png) [@dsarlis](https://forum.dfinity.org/u/dsarlis)\
**Post date:** [October 15, 2024, 7:28am UTC](https://forum.dfinity.org/t/bitcoin-canister-failing/36169/3 "2024-10-15T07:28:40Z")

</div>

Jennifer is right that we were having some issues with Bitcoin testnet and it was still syncing until late last night. It should be fully caught up now.

However, I think the request here was about Bitcoin mainnet. Due to Bitcoin testnet syncing (and because the two canisters are on the same subnet), the process can affect mainnet too. I believe @xalkan hit a brief time window where Bitcoin mainnet was indeed disabled briefly but it quickly recovered.

Things should be working fine now with Bitcoin mainnet and testnet. Let us know if any problems persist.

---

<div class="post-metadata">

**Author:** ![xalkan](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/xalkan/32/16076_2.png) [@xalkan](https://forum.dfinity.org/u/xalkan)\
**Post date:** [October 15, 2024, 2:30pm UTC](https://forum.dfinity.org/t/bitcoin-canister-failing/36169/4 "2024-10-15T14:30:02Z")

</div>

Still getting this error: ‘Canister state is not fully synced.’

Do you have more info on why the testnet canister being on the same subnet causes this issue for the mainnet canister?

---

<div class="post-metadata">

**Author:** ![dsarlis](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/dsarlis/32/689_2.png) [@dsarlis](https://forum.dfinity.org/u/dsarlis)\
**Post date:** [October 15, 2024, 3:02pm UTC](https://forum.dfinity.org/t/bitcoin-canister-failing/36169/5 "2024-10-15T15:02:25Z")

</div>

The Bitcoin testnet is behaving in really unexpected ways (this is on the Bitcoin side, has nothing to do with the IC). There are frequent difficulty resets and block surges which make it much more challenging to stay in sync with the tip of the chain and we also see some of the explorers that we are following to check whether we are in sync to struggle. This extra load is adding contention on the subnet which makes execution rounds slower and everything working at a slower pace. So we end up with mainnet being affected.

We’re working on disabling syncing testnet to fix the immediate problem with mainnet becoming available on and off (which is the case for the last few hours) and then we’ll look into a more long term solution to have testnet be available again.

---

<div class="post-metadata">

**Author:** ![xalkan](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/xalkan/32/16076_2.png) [@xalkan](https://forum.dfinity.org/u/xalkan)\
**Post date:** [October 15, 2024, 3:09pm UTC](https://forum.dfinity.org/t/bitcoin-canister-failing/36169/6 "2024-10-15T15:09:25Z")

</div>

Testnet being a huge inconvenience is nothing new ([Bitcoin Signet support](https://forum.dfinity.org/t/bitcoin-signet-support/29845)), but now that it also affects the mainnet canister, it’s taking the Bitcoin integration’s UX and DX to a new level of unreliability.

---

<div class="post-metadata">

**Author:** ![dsarlis](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/dsarlis/32/689_2.png) [@dsarlis](https://forum.dfinity.org/u/dsarlis)\
**Post date:** [October 15, 2024, 3:23pm UTC](https://forum.dfinity.org/t/bitcoin-canister-failing/36169/7 "2024-10-15T15:23:55Z")

</div>

Agreed. We were already exploring alternatives but hoped that things would still work out – signet is one, testnet4 would be another one (it’s supposed to fix the crazy difficulty resets). But we should also separate mainnet from testnet to two different subnets to avoid similar issues in the future.

We will work something out and post an update about the plans on the forum. Stay tuned.

---

<div class="post-metadata">

**Author:** ![xalkan](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/xalkan/32/16076_2.png) [@xalkan](https://forum.dfinity.org/u/xalkan)\
**Post date:** [October 30, 2024, 5:35am UTC](https://forum.dfinity.org/t/bitcoin-canister-failing/36169/8 "2024-10-30T05:35:47Z")

</div>

Hi there, any update?

Some transactions are not showing up in the mempool, even though there’s no error returned from:

```auto
let res: Result<(), _> = call_with_payment(
    Principal::management_canister(),
    "bitcoin_send_transaction",
    (SendTransactionRequest {
        network: network.into(),
        transaction,
    },),
    transaction_fee,
)
.await;

```

---

<div class="post-metadata">

**Author:** ![dsarlis](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/dsarlis/32/689_2.png) [@dsarlis](https://forum.dfinity.org/u/dsarlis)\
**Post date:** [October 30, 2024, 12:38pm UTC](https://forum.dfinity.org/t/bitcoin-canister-failing/36169/9 "2024-10-30T12:38:21Z")

</div>

Is this for mainnet or testnet?

---

<div class="post-metadata">

**Author:** ![xalkan](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/xalkan/32/16076_2.png) [@xalkan](https://forum.dfinity.org/u/xalkan)\
**Post date:** [October 30, 2024, 2:07pm UTC](https://forum.dfinity.org/t/bitcoin-canister-failing/36169/10 "2024-10-30T14:07:39Z")

</div>

Mainnet (Testnet is not available either).

---

<div class="post-metadata">

**Author:** ![dsarlis](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/dsarlis/32/689_2.png) [@dsarlis](https://forum.dfinity.org/u/dsarlis)\
**Post date:** [October 30, 2024, 2:47pm UTC](https://forum.dfinity.org/t/bitcoin-canister-failing/36169/11 "2024-10-30T14:47:35Z")

</div>

Yeah, testnet is still suffering from being on and off when things get a bit weird on the network’s side.

Mainnet is working fine from our side. It is possible that your transaction didn’t go through because of insufficient fees or so. This is something that we don’t control, right, it’s on the bitcoin network itself. So, we might submit the transaction fine but it might not be accepted in the mempool. I would try again with maybe a bit higher fees added.

---

<div class="post-metadata">

**Author:** ![xalkan](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/xalkan/32/16076_2.png) [@xalkan](https://forum.dfinity.org/u/xalkan)\
**Post date:** [October 30, 2024, 3:30pm UTC](https://forum.dfinity.org/t/bitcoin-canister-failing/36169/12 "2024-10-30T15:30:04Z")

</div>

I’m using the 20th fee percentile, but I just realized that this call is failing:

 ![image](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/3X/0/5/05bffb11164c92130bc61c89735584e59457113e.png)

Shouldn’t the canister return an error when the mempool rejects the transaction? Currently, the flow on our side continues as successful, and ledgers get updated when they shouldn’t.

---

<div class="post-metadata">

**Author:** ![THLO](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/thlo/32/2349_2.png) [@THLO](https://forum.dfinity.org/u/THLO)\
**Post date:** [October 30, 2024, 4:25pm UTC](https://forum.dfinity.org/t/bitcoin-canister-failing/36169/13 "2024-10-30T16:25:55Z")

</div>

> [@xalkan](#):
>
> Shouldn’t the canister return an error when the mempool rejects the transaction?

The Bitcoin canister doesn’t have access to _any_ transactions with zero confirmations. Even if it did, if the transmitted transaction is valid, it is not possible to determine if and how many nodes in the Bitcoin P2P network (still) keep the transaction in their local mempool.

Quite generally, there is no guarantee that a transaction will be accepted. I would recommend waiting for at least one confirmation. Once the transaction is included in a block, you can get this information from the Bitcoin canister.

---

<div class="post-metadata">

**Author:** ![xalkan](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/xalkan/32/16076_2.png) [@xalkan](https://forum.dfinity.org/u/xalkan)\
**Post date:** [October 30, 2024, 7:33pm UTC](https://forum.dfinity.org/t/bitcoin-canister-failing/36169/15 "2024-10-30T19:33:36Z")

</div>

Would you recommend using `bitcoin_get_utxos_query` instead of `bitcoin_get_utxos`?

It’d be great to add a canister call that takes a transaction ID as input to check if it is confirmed, such as [https://mempool.space/docs/api/rest#get-transaction-status](https://mempool.space/docs/api/rest#get-transaction-status)

---

<div class="post-metadata">

**Author:** ![THLO](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/thlo/32/2349_2.png) [@THLO](https://forum.dfinity.org/u/THLO)\
**Post date:** [October 31, 2024, 2:03pm UTC](https://forum.dfinity.org/t/bitcoin-canister-failing/36169/16 "2024-10-31T14:03:11Z")

</div>

> [@xalkan](#):
>
> Would you recommend using `bitcoin_get_utxos_query` instead of `bitcoin_get_utxos`?

Monitoring the changes to the UTXO set is an effective way to learn about the confirmation of transactions.  
However, `bitcoin_get_utxos_query` is a query endpoint. Since requests are answered by a single replica, the response is not trustworthy. You can use it to check if there is any change and then follow up with a call to `bitcoin_get_utxos` to get a trustworthy response.

An alternative way to check the status of a transaction in a canister is to make an HTTPS outcall, for example to the endpoint that you provided.
