Comments (18)
@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 cardano-cli transaction sign --tx-body-file {FILE} --signing-key-file payment.skey
then copying the generated hex CBOR into cardano.signTx()
? If so I'm very puzzled by the 'InvalidWitnessUTXOW' error message I get as I'm doing exactly the same.
from nami.
Reference
@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
from nami.
Reference
@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:
Emurgo/cardano-serialization-lib#303
from nami.
What function are you using the cardano-cli? The TransactionWitnessSet
is a wrapper around the actual vkey witness. I haven't tried it in the cli yet, but it's definitely correct what Nami returns you. It's based on top of the serialization-lib.
from nami.
@alessandrokonrad thanks for you reply. Using cardanoo-cli transaction assemble
I'm combining the cbor taken from TransactionWitnessSet
taken from cardano.signTx()
, adding the cbor into a file that looks like that:
{
"type": "TxWitness MaryEra",
"description": "",
"cborHex": "CBOR TAKEN FROM TransactionWitnessSet"
}
With cardanoo-cli transaction assemble
, adding other witnesses
generated by cardano cli transaction witness
.
from nami.
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
from nami.
it's possibly related to input-output-hk/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, cardano.signTx(tx, partialSign=true)
, the hex encoded cbor string I got from TransactionWitnessSet
; can I copy the cbor string into this .witness
file with the follow format?:
{
"type": "TxWitness MaryEra",
"description": "",
"cborHex": "CBOR TAKEN FROM TransactionWitnessSet"
}
Do I have to manipulate the cbor string first? Does the TransactionWitnessSet
cbor from the serialization library match the required input from cardano-cli?
And lastly using cardano-cli transaction assemble
:
cardano-cli transaction assemble
--tx-body-file tx.draft
--witness-file transaction_witness_generated_by_cli.witness
--witness-file transaction_witness_from_above_json_file.witness
--out-file tx.signed
Error I'm getting:
TextEnvelope decode error: DecoderErrorDeserialiseFailure "Shelley Witness" (DeserialiseFailure 0 "expected list len")
from nami.
@jinglescode Have you managed to assemble those two transactions in the end?
from nami.
@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?
from nami.
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.
from nami.
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.
window.cardano.signTx(cborHex, true).then((signedTx) => {
const array_to_cli = []; // to create `[0, [vkeys]]`
array_to_cli.push(0);
const decoded = cbor.decode(signedTx);
for (let i of decoded) {
array_to_cli.push(i);
}
const signed_cbor_from_nami = cbor.encode(array_to_cli).toString('hex');
});
Put signed_cbor_from_nami
into the witness file, so cardano-cli can consume:
{
"type": "TxWitness MaryEra",
"description": "",
"cborHex": "CBOR TAKEN FROM signed_cbor_from_nami"
}
And then:
Command failed: transaction sign-witness Error: buyer_witness_set_from_nami_signTx.witness: TextEnvelope decode error: DecoderErrorDeserialiseFailure "Shelley Witness" (DeserialiseFailure 0 "expected list len")
What I'm doing wrong here? Any advice will be helpful.
from nami.
@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)
from nami.
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.
With both being arrays? In alzono.cddl we have
transaction_witness_set =
{ ? 0: [* vkeywitness ]
, ? 1: [* native_script ]
, ? 2: [* bootstrap_witness ]
, ? 3: [* plutus_script ] ;New
, ? 4: [* plutus_data ] ;New
, ? 5: [* redeemer ] ;New
}
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.
from nami.
Edit:
Hey @rooooooooob, here is the CBOR from cardano.signTx(encodedTx, true)
after applying @pyropy method:
82008258209b8e0e4205180b4a2ac3511b39435e7e472c6cd817c1f05aaa7545c4b816601a584036b135996644821b84ccd31ad0b8ee07ef9b16eca8046aec96e8e756c0fcef293aeb0cd78866823239de10f98e5f9ddf223b814aaf2140183777d4fc742a3009
This works!
from nami.
@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.
from nami.
@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.
from nami.
@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
cardano-cli transaction sign --tx-body-file {FILE} --signing-key-file payment.skey
then copying the generated hex CBOR intocardano.signTx()
? If so I'm very puzzled by the 'InvalidWitnessUTXOW' error message I get as I'm doing exactly the same.
I'm gonna write a blogpost today to explain in detail what I'm doing.
from nami.
Very helpful blogpost @pyropy. I'm still getting an error though:
transaction submit error ShelleyTxValidationError ShelleyBasedEraAlonzo (ApplyTxError [UtxowFailure (PPViewHashesDontMatch (SJust (SafeHash \"e84ed35a172ed46da854a132db880a608f73e0e61d385c9475a5b14fe4b9e4a9\")) SNothing),UtxowFailure (WrappedShelleyEraFailure (MissingScriptWitnessesUTXOW (fromList [ScriptHash \"1ef6f56f2e174d5e0328f24aa30d55b81f3bf871361f9280dd4090c2\"]))),UtxowFailure (WrappedShelleyEraFailure (UtxoFailure (UtxosFailure (CollectErrors [NoRedeemer (Minting (PolicyID {policyID = ScriptHash \"1ef6f56f2e174d5e0328f24aa30d55b81f3bf871361f9280dd4090c2\"})),NoWitness (ScriptHash \"1ef6f56f2e174d5e0328f24aa30d55b81f3bf871361f9280dd4090c2\")]))))])
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?
from nami.
Related Issues (20)
- help please HOT 4
- Restoring an overwritten Brave installation and a Nami wallet plugin within that HOT 3
- Can transfer out of wallet-Transaction failed HOT 1
- Assets not showing in imported wallet HOT 1
- Couldn't access my nami wallet and now I can't recover it either HOT 9
- All tx's erroring
- Blank screen in extension HOT 8
- Nami wallet
- Help delegation transaction(delegated on yoroi then looked at nami and have a delegation transaction and my balance is lower) HOT 3
- Sending ETH away from NAMI HOT 6
- :warning: ATTENTION: DO NOT CLICK ANY LINKS IN RESPONSES
- I can
- Unable to withdraw Cardano Nami Wallet staking rewards with Trezor HOT 1
- HW wallets don't need a password HOT 1
- Blank screen in Chrome Extension HOT 2
- Token does not show HOT 3
- transfer completed not showing in nami wallet please advise?? NAMI WALLET cardano ADA HOT 1
- Funds that I transferred have disappeared.. HOT 1
- How to disconnect from dAPP using javascript? HOT 1
- Issue Regarding Ada Handles Resolving To a JPG Store Contract Address HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nami.