# Trouble Decoding Block 80543 in ckBTC: Seeking Resolution

**URL:** <https://forum.dfinity.org/t/trouble-decoding-block-80543-in-ckbtc-seeking-resolution/23715>\
**Category:** Developers\
**Tags:** candid, nns, sns\
**Created:** [October 12, 2023, 4:04pm UTC](https://forum.dfinity.org/t/trouble-decoding-block-80543-in-ckbtc-seeking-resolution/23715 "2023-10-12T16:04:13Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![jaesharma](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jaesharma/32/7297_2.png) [@jaesharma](https://forum.dfinity.org/u/jaesharma)\
**Post date:** [October 12, 2023, 4:04pm UTC](https://forum.dfinity.org/t/trouble-decoding-block-80543-in-ckbtc-seeking-resolution/23715/1 "2023-10-12T16:04:13Z")

</div>

I’ve encountered an issue with a specific block, number 80543, within the ckBTC canister (nbsys-saaaa-aaaar-qaaga-cai). This block does not seem to align with the current IDL definition of icrc1. I’ve attached a screenshot from the DFINITY dashboard displaying the error message:

```auto
Canister nbsys-saaaa-aaaar-qaaga-cai trapped explicitly: failed to decode block 161086: failed to decode a block: Semantic(None, "invalid type: integer `1696594164110199924`, expected struct TimeStamp")

```

this issue is unique to block 80543; other blocks from ckBTC can be fetched without any problems.

Also, this issue is occurring when using the DFINITY agent library in JavaScript.

I’m looking for insights on the root cause of this error and suggestions on how to resolve it. Has anyone encountered a similar problem or can provide guidance on addressing this issue?

 ![Screenshot 2023-10-12 at 9.33.51 PM](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/2X/8/837c675eeab3b63e907ad00c2f23f9cab8b465d4.png)

---

<div class="post-metadata">

**Author:** ![peterparker](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@peterparker](https://forum.dfinity.org/u/peterparker)\
**Post date:** [October 12, 2023, 4:14pm UTC](https://forum.dfinity.org/t/trouble-decoding-block-80543-in-ckbtc-seeking-resolution/23715/2 "2023-10-12T16:14:37Z")

</div>

> [@jaesharma](#):
>
> Also, this issue is occurring when using the DFINITY agent library in JavaScript.

Hi, regarding the start of your message, I think one of my colleague will be more useful than me but, I’m curious about the JS part. Can you tell me which library exactly and version?

---

<div class="post-metadata">

**Author:** ![mariop](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/mariop/32/5114_2.png) [@mariop](https://forum.dfinity.org/u/mariop)\
**Post date:** [October 12, 2023, 4:18pm UTC](https://forum.dfinity.org/t/trouble-decoding-block-80543-in-ckbtc-seeking-resolution/23715/3 "2023-10-12T16:18:55Z")

</div>

Hi @jaesharma ,

We had to change the IDL definition of Approve blocks because it wasn’t matching the incoming ICRC-3 spec. The `expires_at` field written by the ckBTC Ledger was a struct instead of what it should be, that is a number. We still need to upgrade the libraries to follow the new schema.

---

<div class="post-metadata">

**Author:** ![jaesharma](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jaesharma/32/7297_2.png) [@jaesharma](https://forum.dfinity.org/u/jaesharma)\
**Post date:** [October 12, 2023, 4:22pm UTC](https://forum.dfinity.org/t/trouble-decoding-block-80543-in-ckbtc-seeking-resolution/23715/4 "2023-10-12T16:22:38Z")

</div>

@mariop  
can you point me where i will find updated IDL file? I can use @dfinity/agent library with updated IDL to query this block then.

---

<div class="post-metadata">

**Author:** ![jaesharma](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jaesharma/32/7297_2.png) [@jaesharma](https://forum.dfinity.org/u/jaesharma)\
**Post date:** [October 12, 2023, 4:23pm UTC](https://forum.dfinity.org/t/trouble-decoding-block-80543-in-ckbtc-seeking-resolution/23715/5 "2023-10-12T16:23:50Z")

</div>

sure, @peterparker i’m using “@dfinity/agent”: “0.11.2”,

---

<div class="post-metadata">

**Author:** ![peterparker](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@peterparker](https://forum.dfinity.org/u/peterparker)\
**Post date:** [October 12, 2023, 4:28pm UTC](https://forum.dfinity.org/t/trouble-decoding-block-80543-in-ckbtc-seeking-resolution/23715/6 "2023-10-12T16:28:01Z")

</div>

Ahhhhh thanks for the answer. Any particular reason why you do not use [@dfinity/ledger-icrc](https://github.com/dfinity/ic-js/tree/main/packages/ledger-icrc)?  
It contains an up-to-date did files regarding that matters.

---

<div class="post-metadata">

**Author:** ![jaesharma](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jaesharma/32/7297_2.png) [@jaesharma](https://forum.dfinity.org/u/jaesharma)\
**Post date:** [October 12, 2023, 4:31pm UTC](https://forum.dfinity.org/t/trouble-decoding-block-80543-in-ckbtc-seeking-resolution/23715/7 "2023-10-12T16:31:24Z")

</div>

was not familiar with this library. i’ll check. thanks.

---

<div class="post-metadata">

**Author:** ![peterparker](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@peterparker](https://forum.dfinity.org/u/peterparker)\
**Post date:** [October 12, 2023, 4:38pm UTC](https://forum.dfinity.org/t/trouble-decoding-block-80543-in-ckbtc-seeking-resolution/23715/8 "2023-10-12T16:38:26Z")

</div>

Great. In the same repo there is also in a `@dfinity/ckbtc` library. All these libs are used notably in NNS dapp. We keep those up-to-date. Let me know if you have any questions.

---

<div class="post-metadata">

**Author:** ![jaesharma](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jaesharma/32/7297_2.png) [@jaesharma](https://forum.dfinity.org/u/jaesharma)\
**Post date:** [October 16, 2023, 2:50pm UTC](https://forum.dfinity.org/t/trouble-decoding-block-80543-in-ckbtc-seeking-resolution/23715/9 "2023-10-16T14:50:42Z")

</div>

Hello @peterparker ,  
I’m experiencing difficulties in retrieving blocks using the “@dfinity/ledger-icrc” library. Here’s the code I’m attempting to run:

```js

import { IcrcIndexCanister } from "@dfinity/ledger-icrc";

const agent = await createAgent({
  identity: id,
  host: "https://ic0.app",
});

const { getTransactions } = IcrcIndexCanister.create({
  agent,
  canisterId: "mxzaz-hqaaa-aaaar-qaada-cai",
});

const tx = await getTransactions({
  start: 0,
  length: 20,
});

```

Unfortunately, I’m encountering this error:

```auto
TypeError: Cannot destructure property 'owner' of 'undefined' as it is undefined.

```

I’ve also explored the “@dfinity/ckbtc” library, but I wasn’t able to find any solutions that would allow me to retrieve a specific block from Ckbtc. Can you provide any guidance or assistance on this matter? Thank you.

---

<div class="post-metadata">

**Author:** ![peterparker](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@peterparker](https://forum.dfinity.org/u/peterparker)\
**Post date:** [October 16, 2023, 3:52pm UTC](https://forum.dfinity.org/t/trouble-decoding-block-80543-in-ckbtc-seeking-resolution/23715/10 "2023-10-16T15:52:34Z")

</div>

> [@jaesharma](#):
>
> `TypeError: Cannot destructure property 'owner' of 'undefined' as it is undefined.`

You do not use TypeScript I guess?

I think it’s because you don’t supply the account.

```auto
const tx = await getTransactions({
  start: 0,
  length: 20,
  account: {owner: etc...} // <---- This is missing
});

```

Params: [https://github.com/dfinity/ic-js/blob/main/packages/ledger-icrc/src/types/index.params.ts#L4](https://github.com/dfinity/ic-js/blob/main/packages/ledger-icrc/src/types/index.params.ts#L4)

---

<div class="post-metadata">

**Author:** ![jaesharma](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jaesharma/32/7297_2.png) [@jaesharma](https://forum.dfinity.org/u/jaesharma)\
**Post date:** [October 16, 2023, 3:54pm UTC](https://forum.dfinity.org/t/trouble-decoding-block-80543-in-ckbtc-seeking-resolution/23715/11 "2023-10-16T15:54:29Z")

</div>

@peterparker  
if i supply account id then get another error.  
this is updated code i’m trying to execute:

```js
const tx = await getTransactions({
  max_results: 20,
  account: {
    owner: id,
  },
});

```

in this case i get this error:

```auto
                      ^

Error: Invalid record {max_results:nat; start:opt nat; account:record {owner:principal; subaccount:opt vec nat8}} argument: 

field account -> Invalid record {owner:principal; subaccount:opt vec nat8} argument: 

```

looking for answers of these questions:

1. why we need to supply owner here?
2. cause of this error? in javascript how to change nat8 or nat64 in nat type.

---

<div class="post-metadata">

**Author:** ![peterparker](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@peterparker](https://forum.dfinity.org/u/peterparker)\
**Post date:** [October 16, 2023, 4:10pm UTC](https://forum.dfinity.org/t/trouble-decoding-block-80543-in-ckbtc-seeking-resolution/23715/12 "2023-10-16T16:10:22Z")

</div>

> [@jaesharma](#):
>
> `field account -> Invalid record {owner:principal; subaccount:opt vec nat8} argument: `

Type definition of the parameter:

```auto
export interface IcrcAccount {
  owner: Principal;
  subaccount?: Subaccount;
}

```

Are you sude your `id` is a `Principal` and not a string or something else?

> [@jaesharma](#):
>
> why we need to supply owner here?

You are looking to query the transactions. Those transactions are attached to an account. An account can be a user, a canister, or else. Anything or anyone that hold transactions through an account.

---

<div class="post-metadata">

**Author:** ![jaesharma](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jaesharma/32/7297_2.png) [@jaesharma](https://forum.dfinity.org/u/jaesharma)\
**Post date:** [October 16, 2023, 4:22pm UTC](https://forum.dfinity.org/t/trouble-decoding-block-80543-in-ckbtc-seeking-resolution/23715/13 "2023-10-16T16:22:24Z")

</div>

So this method will return transactions of that specific account only?

---

<div class="post-metadata">

**Author:** ![peterparker](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@peterparker](https://forum.dfinity.org/u/peterparker)\
**Post date:** [October 16, 2023, 4:26pm UTC](https://forum.dfinity.org/t/trouble-decoding-block-80543-in-ckbtc-seeking-resolution/23715/14 "2023-10-16T16:26:34Z")

</div>

Yes, that’s correct.

---

<div class="post-metadata">

**Author:** ![jaesharma](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jaesharma/32/7297_2.png) [@jaesharma](https://forum.dfinity.org/u/jaesharma)\
**Post date:** [October 23, 2023, 2:25pm UTC](https://forum.dfinity.org/t/trouble-decoding-block-80543-in-ckbtc-seeking-resolution/23715/15 "2023-10-23T14:25:21Z")

</div>

Hello @peterparker ,  
I’m continuing my efforts to find a solution for this issue, but I’m still unable to resolve it. I’ve also double-checked on the DFINITY dashboard, and the error there remains the same.

Could you please provide an update on the current status of this issue? Additionally, it would be greatly appreciated if you could direct me to the most recent version of the IDL for the ledger canister, which I can use to access transaction **80543** of the ckbtc token.

---

<div class="post-metadata">

**Author:** ![peterparker](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@peterparker](https://forum.dfinity.org/u/peterparker)\
**Post date:** [October 23, 2023, 3:19pm UTC](https://forum.dfinity.org/t/trouble-decoding-block-80543-in-ckbtc-seeking-resolution/23715/16 "2023-10-23T15:19:29Z")

</div>

> [@jaesharma](#):
>
> Could you please provide an update on the current status of this issue?

Which issue, the `expires_at` field? Don’t know much about this, @mariop knows best.  
Or are you speaking about another issue?

> [@jaesharma](#):
>
> Additionally, it would be greatly appreciated if you could direct me to the most recent version of the IDL for the ledger canister, which I can use to access transaction **80543** of the ckbtc token.

I updated `@dfinity/ledger-icrc` last [week](https://github.com/dfinity/ic-js/commits/main/packages/ledger-icrc). You can find the related did files in the [repo](https://github.com/dfinity/ic-js/tree/main/packages/ledger-icrc) or use the `next` version of the library (`npm i @dfinity/ledger-icrc@next`). Is this what you are looking for?

---

<div class="post-metadata">

**Author:** ![jaesharma](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jaesharma/32/7297_2.png) [@jaesharma](https://forum.dfinity.org/u/jaesharma)\
**Post date:** [October 23, 2023, 3:39pm UTC](https://forum.dfinity.org/t/trouble-decoding-block-80543-in-ckbtc-seeking-resolution/23715/17 "2023-10-23T15:39:28Z")

</div>

I’m currently working on resolving this problem:

 ![Screenshot 2023-10-23 at 9.06.17 PM](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/2X/c/c629c9b278d0725a1358dc9c3fd5a4ac2a9f59a0.png)

My goal is to obtain transaction details using the ‘@dfinity/agent’ library. I’m avoiding the use of the ‘@dfinity/icrc-ledger’ library because it requires supplying an account owner, which doesn’t align with my current requirements. I attempted to utilize the ledger canister IDL from the ‘ledger-icrc’ repository, but I’m still encountering the same error when dealing with this specific transaction.

---

<div class="post-metadata">

**Author:** ![peterparker](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@peterparker](https://forum.dfinity.org/u/peterparker)\
**Post date:** [October 23, 2023, 4:09pm UTC](https://forum.dfinity.org/t/trouble-decoding-block-80543-in-ckbtc-seeking-resolution/23715/18 "2023-10-23T16:09:55Z")

</div>

I don’t think it’s different but, you can try your luck with the did files from the IC main repo: [https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1/ledger/ledger.did](https://github.com/dfinity/ic/tree/master/rs/rosetta-api/icrc1/ledger/ledger.did)

---

<div class="post-metadata">

**Author:** ![jaesharma](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jaesharma/32/7297_2.png) [@jaesharma](https://forum.dfinity.org/u/jaesharma)\
**Post date:** [October 23, 2023, 4:27pm UTC](https://forum.dfinity.org/t/trouble-decoding-block-80543-in-ckbtc-seeking-resolution/23715/19 "2023-10-23T16:27:32Z")

</div>

I’ve given it a shot, but I’m still encountering same error. I’m finding it a bit challenging to grasp why this particular block is proving difficult to decode. If there have been any changes to the block or transaction definitions, I’m curious why this information (IDL or the part which got change for that specific transaction) hasn’t been made public yet. Additionally, it seems that the dashboard hasn’t been updated with the latest IDL, if there’s been any update at all.

Please keep me posted in this thread if you come across any updates or solutions.

---

<div class="post-metadata">

**Author:** ![peterparker](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@peterparker](https://forum.dfinity.org/u/peterparker)\
**Post date:** [October 23, 2023, 5:36pm UTC](https://forum.dfinity.org/t/trouble-decoding-block-80543-in-ckbtc-seeking-resolution/23715/20 "2023-10-23T17:36:27Z")

</div>

Thanks for the trying and for the feedback! I’m also a consumer of the ledger rather than an actor so, I forwarded your question to the team. They’ll comeback with updates.

[Next page](https://forum.dfinity.org/t/trouble-decoding-block-80543-in-ckbtc-seeking-resolution/23715.md?page=2)
