-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
signTx's TransactionWitnessSet produce TextEnvelope decode error in cardano-cli #85
Comments
What function are you using the cardano-cli? The |
@alessandrokonrad thanks for you reply. Using
With |
it's possibly related to IntersectMBO/cardano-node#3370 but I haven't looked into it so it might be unrelated since that issue was from cardano-cli -> cardano-serialization-lib not the other way around |
Hi @rooooooooob, any workaround on this? I'm implementing partial signing as described here. After executing,
Do I have to manipulate the cbor string first? Does the And lastly using
Error I'm getting:
|
@jinglescode Have you managed to assemble those two transactions in the end? |
@jinglescode can you please post the output (hex string for cbor or whatever format it's in) from the CLI that you're trying to parse? |
I've managed to assemble witness returned from nami and tx built from cli. What you need to do is to take vkeys and wrap them in array like so [0, [vkeys]] and then encode it to cbor once again. |
I tried that, and this is how it looks like.
Put
And then:
What I'm doing wrong here? Any advice will be helpful. |
@jinglescode You actually get keywitness-set returned when signing transaction that holds vkeys, which are needed to assemble witness object. Here's an example: const encodedTxVkeyWitnesses = await wallet.signTx(encodedTx, true);
const txVkeyWitnesses = wasm.TransactionWitnessSet.from_bytes(
Buffer.from(encodedTxVkeyWitnesses, "hex")
);
// extract vkeys from witness set as bytes
const vkeysBytes = Buffer.from(
txVkeyWitnesses.vkeys()?.get(0).to_bytes() as Uint8Array
).toString('hex');
const vkeysDecoded = cbor.decode(vkeysBytes)
const witness = [0, vkeysDecoded]
const witnessCbor = cbor.encode(witness) |
With both being arrays? In alzono.cddl we have
which should be a map not an array. In the cardano-serialization-lib we implemented off the binary spec which implements it as a map not an array. Can someone please post CBOR (can be hex string or whatever format you can post here) of what is working and what isn't working so I can look into it? It seems to me like it's just map vs array but I would like to examine the CBOR see if that's the only difference. Thanks. |
Edit: Hey @rooooooooob, here is the CBOR from This works! |
@jinglescode @pyropy Hi, how exactly are you guys signing the transactions in the CLI before signing it with Nami? I am attempting a similar method in #147 but the CLI still rejects my transaction. |
I have pair of some random keys that I use to sign the tx, then load signed tx to nami via cardano-serialization-lib. |
Thanks for the quick reply! So you're just doing |
I'm gonna write a blogpost today to explain in detail what I'm doing. |
@ZDust172 Here's my blogpost on how to load signed tx https://srdjanstankovic.com/2021/12/24/how-to-sign-and-submit-cardano-cli-transaction-using-nami-wallet.html |
Thanks! This should be a really helpful resource for others. I eventually opted to doing it a different way avoiding the cli altogether using the method here: |
Very helpful blogpost @pyropy. I'm still getting an error though:
I think it has to do with the fact that my transaction requires a redeemer and a datum, but shouldn't those elements be included in the tx body it self? Or do I need to somehow add it to the witness using the serialization lib? |
@alessandrokonrad . For
cardano.signTx()
, the outputTransactionWitnessSet
, does not tally the input required in cardano-cli, producing this error:Seems like, the cborHex Nami produced after
signTx()
has extra 2 characters.The text was updated successfully, but these errors were encountered: