4

Hello I am tryng to sign a Tx using Nami Wallet, but i have not been able to do it.

I did a Tx using cardano-cli , and i've got a JSON file I take the cBORHex:"86a70081825820eef507b798abbb8a1360efbd..."

but when i try to sign the tx in the Nami Wallet:

window.cardano.signTx("86a70081825820...")

i get: {code: -1, info: 'Inputs do not conform to this spec or are otherwise invalid.'}

My question is: is something wrong in the way i am thinking or implementing cardano-cli with Nami? Am I using correctly the Nami endpoint?

3 Answers 3

4

If you want to load transaction to cardano-serialization-lib generated by cardano-cli you'd first have to sign it with some "dummy" signature keys and then take cbor produced by the cardano-cli and load it:

const txCli = wasm.Transaction.from_bytes(Buffer.from(cliTx, "hex"))

You can then take tx body from transaction that you've loaded, create new transaction with new witness-set and auxilary data.

EDIT:

I wrote a full blog post on how to sign cardano-cli tx using nami wallet. Hope this helps 🎉

1
  • This definitely helps, thanks for sharing it pyropy.
    – Latheesan
    May 29, 2022 at 17:03
5

the problem is that a raw transaction from the cardano-cli does actually not conform with the specs. Nami uses the serialization-lib in the back and this one can't recognize the cbor from the cli.

A little transformation is needed here. I assume your transaction has an emtpy witness set, which is represented in the cli cbor as empty array ([]). Changing that one to an empty map ({}) shoud resolve the issue.

Any cbor decoding/encoding tool can help here.

2
  • Thank you so much for your answer Alessandro, but i dont fully underestand I traduced it in a cbor decong and i fount this [{0: [[h'EE5966D3759E82463278640E58C3812A15ECA2AAF8DC1AC3063B5BAA43E41BE3', 0]], 13: [], 1: [[h'00756E62FF9667B187209B6FE1B577061491CF6F93A81E1F91741E2E3ACCB864AE67087F69BBD9AB74F71781D13AE40AAB86E1DE30CA7E2117', 974831815], [h'000E352F0CE47FFD66821DA9F002999E05F26534DA85CAE89559078F77561870240E88583B00FBC330B4DCD54E8DA71E5ED5E8729F01E79AFD', 25000000]], 2: 168185, 14: []}, [], [], [], true, null] there appear a lot of "[]" ? where can i read about Nami specs? Nov 6, 2021 at 0:32
  • Where can i read about Nami Specs? if cardano-cli is not suitable for making Tx compatible with Nami wallet, what tool should i use? Nov 6, 2021 at 1:30
1

FYI, I've raised an bug fix request with IOHK over this, as we've encountered the same problem whilst integrating our smart validators, at Artifct.app.

If you're encountering this problem too, it wouldn't hurt to add your name to the ticket: https://github.com/input-output-hk/cardano-node/issues/3370

1
  • Thank you so much, but i am not sure it should be called a Bug since Cardano Serialization Lib Says in its documentation something about it. But it would be nice that all our tools would use the same specs. Nov 17, 2021 at 2:40

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.