I am working on an app, I am using Nami wallet and cardano-serialization-lib.

When I query UTxO and decode it using cardano-serialization-lib, I get an object with only attribute is something called "ptr", ptr is a number I was expecting an actual UTxO... I want to know how can I get the UTXO because I want it for using it inside a policy script.


Extended explanation: I run the following comands in my browser:


I get this :

Promise {<pending>}[[Prototype]]: Promise[[PromiseState]]: "fulfilled"[[PromiseResult]]: Array(1)0: "82825820eef507b798abbb8a1360efbd113f51eda22e2fbaae3cc32c78724c8644c164a40082583900756e62ff9667b187209b6fe1b577061491cf6f93a81e1f91741e2e3accb864ae67087f69bbd9ab74f71781d13ae40aab86e1de30ca7e21171a1dcd6500"length: 1[[Prototype]]: Array(0)

when i decode it using the library in NodeJS with the following script:

const S = require("./node_modules/@emurgo/cardano-serialization-lib-nodejs/cardano_serialization_lib.js");
const _Buffer = require("buffer/").Buffer;
const rawUtxo =

const utxos = S.TransactionUnspentOutput.from_bytes(
  _Buffer.from(rawUtxo, "hex")


I get this:

TransactionUnspentOutput { ptr: 1179656 },

  • 1
    It looks like you are looking at a pointer address. But you really need to expand your question as it is not clear. Oct 22, 2021 at 8:31
  • Yes as far as i underestand ptr is some kind of pointer, I edited explaing more details as you suggested. Thank you! Oct 22, 2021 at 14:19
  • I'm use cardano-serialization-lib. How to get key hash ? Thank.
    – qi.chalerm
    Dec 11, 2021 at 11:35

1 Answer 1


The serialization lib is written in Rust and compiled to web assembly. Rust manually manages its memory, and I'm assuming that you need to do the same here. If you look at the typescript types you can see that every object has a free() method.

The ptr is a pointer to memory. If you need to access information of the UTXO you need to use the provided functions. So for example, this will construct the TransactionOutput from the CBOR hex string

const fromHexString = hexString =>
  new Uint8Array(hexString.match(/.{1,2}/g).map(byte => parseInt(byte, 16)));

const utxos = await cardano
        .then(cborUTXOS => 
                cborUTXOS.map(cborUTXO => 

And you can see how many lovelaces an output has like this:

  • As far as i underestand you are telling me to do the same i did using a map function and a hex decoder explicit ... in fact i got the same ptr than before. Nov 6, 2021 at 3:22
  • when i do .coin() i get coin is not a function... where can i read about ehis objets? .output() for example? Nov 6, 2021 at 13:50
  • 2
    The cardano serialization lib exposes some typescript definitions, so you can see what methods are available for each object. If you install the library with npm you can see the .d.ts type definition in node_modules Nov 10, 2021 at 2:27
  • @AliciaBasilio hello were you able to find an easy way to look at the content inside these pointer objects? I noticed not all types have these methods to look at
    – B Snow
    Mar 31, 2022 at 20:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.