-
Notifications
You must be signed in to change notification settings - Fork 720
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
[BUG] - Cardano-cli creates transactions with witness-set as an array, not a map - this is invalid. #3370
Comments
Also had this issue where we are trying to construct a tx with Plutus script in the cli and get it signed by nami wallet / Cardano-Serialization-Lib but it's just not compatible hopefully this gets resolved |
Same here, I had to perform several hacks and magic tricks (thanks to the serialization lib dev guidance) to make it work. I believe this is really important, the discrepancies between the CLI and the emurgo serialization lib are hindering and slowing down a lot of dApps. Would be awesome to hear from the dev team if they are working on this or at least aware of it :). |
@kieransimkin can you provide the steps to reproduce this? This is what I see:
So I don't know what you mean by using the cli to create a transaction with no witness set. and similarly for |
Producing any transaction via cardano-cli using something like this: Serialization-lib fails to parse the cbor generated from this,. |
Thank you @kieransimkin , now I understand. The Note that you don't need to sign the transaction body, you need to sign the transaction ID, which is the hash of the body. You can get this from the cli with:
Here's a bit more context, which you may or may not be interested in. I believe (but don't know for sure, I've not done any work myself on the cli) that the cli uses a different format for serializing the transaction body than is specified in the ledger, in order to better match how it constructs transactions. The I'm sorry this has caused so much confusion. I will make the relevant folks at IOHK aware of it. |
Thanks - this is new information to me, and very helpful, thank you. I think it would be useful to the community if someone who knows what they're doing put up some kind of guide on how to get transactions generated by cardano-cli to be correctly parsed by Serialization-lib/Nami - whether that be Emurgo, IOHK, or Nami developers - someone please help us out! |
Hi, I've posted solution to your issue over at cardano-serialization lib. In order to load transaction generated by |
@JaredCorduan It looks like this difference applies going back into the CLI too when it comes to witnesses. See input-output-hk/nami#85 - people are reporting that the witness format the CLI takes is different from the binary spec as well. Using @pyropy 's workaround @jinglescode posted some CBOR ( |
Thanks for reporting this issue! I also saw this problem when trying to decode an unsigned transaction generated from cardano-cli. It seems like the bug is gone after the transaction is signed by cardano-cli. I pasted more evidence below. Hope it helps! Unsigned transactionCreate an unsigned transaction
Decode cbor hex
Signed transactionProblem is gone after I sign the transaction. Sign the transaction created above
Decode cbor hex
|
@cffls notice that |
There seems to be a lot of confusion around this - I wonder if anyone could actually post a guide - I think we're all fundamentally trying to do the same thing - make transactions that we're producing server-side somehow work with serialization-lib in the browser. Seems there are several different hurdles people are stumbling on here and a guide would really be appreciated, still not quite at the level where I understand it well enough to write that guide myself yet I'm afraid. |
Thanks Jared for the response. I don't think The confusion probably comes from the some developers' assumption that @kieransimkin A workaround solution for the use case you described (creating unsigned transactions from server and have user's wallet to sign it using the signTx API from wallet connector) is to deserialize the cbor output from Nevertheless, imho, the long-term solution is for IOG to fix the behavior of [1] Transaction definition: https://github.com/input-output-hk/cardano-ledger/blob/master/eras/alonzo/test-suite/cddl-files/alonzo.cddl#L13-L18 |
Just as a general tip to IOHK and IOG in general - We need documentation for this stuff! How am I supposed to know that cardano-cli generates some kind of half-baked transaction? It doesn't say that anywhere, or at least not in any of the documentation that I scoured looking for answers on this. We've now solved this problem at our end, but it's frustrating for me to see other people suffering the same problem, and nothing done about it. IOHK/IOG/Emurgo (whichever part of this multiheaded beast wants to take responsibility for this mess) needs to write some docs, and fix cardano-cli - because right now you're creating a lot of very frustrated programmers out there - programmers who will quite happily drop Cardano and go to a chain that actually bothers to write documentation and fix hurdles that are tripping up 90% of the developers trying to integrate them. I would really like to see something from IOG/IOHK/Emurgo in the way of documentation - why is the Cardano documentation so bad? Every programmer I work with says it - I understand Cardano is a work-in-progress, but so are most software projects, and most have better documentation. If a problem is tripping up most of the people who are integrating with your system, fix it and document it! |
Thanks for all the information @cffls - hopefully this will save someone else a lot of time when they're solving this problem. I would really like to see something official in the way of a fix for this - to be honest because my confidence in Cardano has gone from very high to almost zero, thanks to the issues we've had with this, and the lack of communication and general uselessness of the people who have created this mess in the first place. I can tell you there are a lot of programmers in the community right now who really need to have their faith restored in Cardano, because it's taken quite a battering over the last few months - with the announcement of smart contracts before PAB was ready (PR disaster for Cardano), the nightmares we've had with integrations, and the general uselessness of IOHK, IOG and Emurgo. And to top it all off, turns out Emurgo have been quietly setting up in competition with us! Not good - makes me want to chuck out our Cardano integration, even though it's now working, and replace it with a Solana integration (and that's saying something!) I'm really hoping we see something of substance out of Cardano soon rather than just continued hot air from Charles. I apologise if my messages come across as irritated - I don't mean any negativity towards any particular person - it's IOHK/IOG/Emurgo all together here that I'm annoyed with. I'm just hoping one of them might listen to the community for once rather than hiding in ivory towers. |
you are correct @cffls , I am very sorry that you are frustrated @kieransimkin , all I can say is that the cardano node team is doing our best. We have written a ton of documentation, but there is still much more to write. And indeed there are still rough edges around the Alonzo release. |
Thanks @JaredCorduan - I appreciate you're doing your best and am very thankful that you've recognised the problem and are now going to take steps to rectify it. I feel like I should point out - this seems to be a common theme in Cardano - not foreseeing things which, to anyone with a body of real-world development experience would see these things a mile off. I am guessing this is due to Cardano's academic background? Academics simply don't have real world development experience. I'm not sure whether there is an internal tension between the experienced real world developers and the academics, but I can only assume there are either no programmers with any depth of real world experience within IOHK, or those programmers exist but their voice isn't heard over the louder voices of academic purity. I'm not sure if this is a correct assessment of the situation or not, but it is my guess. This is very concerning to me, as I have bet the entire future of my company on Cardano - I am relying on people at IOHK to take a pragmatic approach and have a bit of real-world foresight - to not be making really stupid mistakes like this. And I'm sorry but that's what this is - to a developer highly experienced in API integrations - it's almost unfathomable that these kinds of mistakes would happen. Similarly - announcing SCs without any of the infrastructure around it to make them work - utter stupidity. Whoever is making these decisions needs to be fired. |
For what it is worth, I am proud of the engineers at IO, it's a harmonious blend of academics and real world developers (and many academics turned engineers with much experience). The intermediate serialized data produced by |
@JaredCorduan Thank you for confirming the issue! Looking forwards to a fix in the upcoming releases. @kieransimkin I really appreciate that you found this issue, which saved me a good amount of time. Your frustration is totally understandable. However, I have to say that IOG definitely has many great engineers who are building high quality softwares. For example, the stableness of cardano-node (which can run weeks without any interruption) has impressed me a lot. The wallet web bridge (CIP-0030) was proposed long after the existence of |
I agree that what has been built so far in Cardano is something to be proud of, but I really think you need to take your heads out of the sand. There are serious problems with the decision-making and management structure in IOHK and Emurgo. It's clear for everyone to see, and pretending like everything is fine will do nobody any good. There is a reason Cardano is falling down the league tables, even though progress seems to be quite good. Acting like nobody could ever have foreseen that people would use cardano-cli and serialization-lib together just doesn't wash with me - they are the two major ways of generating and parsing transactions on Cardano - what made you think people wouldn't want to use them together? I imagine this disconnect has something to do with Serialization-lib being maintained by Emurgo, and Cardano-cli being maintained by IOHK. It's a mess. Rather than patting each other on the back and pretending like everything is fine, I want people at IOHK to start asking questions - "how could we have missed this?" You released smart contracts before they were ready - knowing everyone was going to want to start using them - it would not have taken much foresight at all to think through the main process people are going to be integrating. The main way people were generating transactions is with cardano-cli in the way I've specified - there's a reason this is the main way people were creating transactions - it was pretty much the only way way detailed in any of the documentation. Did nobody at IOHK really think this through? This is why I keep making the comment about ivory towers - it feels like nobody at IOHK or Emurgo has actually placed themselves in the shoes of a person who might be using their software. Or indeed sought and responded to feedback from those people. Cardano is not fine - it's bleeding heavily - stop pretending like everything is okay! |
@kieransimkin Ok, calm down. My reading of this is that you didn't sign the transaction, and so it didn't work. A simple mistake, hardly a devastating indictment of an entire blockchain ecosystem - but recognize that developing for any new platform has its frustrations. |
Downplaying problems and sweeping them under the carpet again. Okay. |
The plan is to make all relevant outputs from |
3505: Output as ledger compliant CDDL flag r=Jimbo4350 a=Jimbo4350 We implement an alternative `cardano-ledger` CDDL compliant serialization for the cli. The plan is to eventually deprecate the cli's intermediate format and to fully embrace the ledger's CDDL spec. There is now an optional `--cddl-format` flag in the `build` and `build-raw` commands that serialize the txbody as a **key** unwitnessed transaction. Any script witnesses specified at this stage are included in the witness set. Resolves #3370 Co-authored-by: Jordan Millar <jordan.millar@iohk.io>
Hello, I am building a tx body using cardano-cli build-raw. When I send the cbor of the tx body to cardano-serialization lib to buiild a TrasnactionBody from TransactionBody.from_byte(Buffer.from(cborHex,'hex')) I get the error that cbor is array but expected input is map. Can someone please assist on this issue? |
@Fourzin which version of |
Hi @Jimbo4350, I am using 1.35.3 version. After reading several conversations, I used the --cddl-format tag that output a tx compatible with cardano-sirialization lib (not tx body but rather tx, which is fine). I am now able to reconstruct the transaction on the web browser side. My current issue is that after successfully signing and adding the wallet as witness I get an error while submitting the tx with the error "MissingScriptWitnessesUTXOW". I already signed the transaction with policy.skey in the cli side before sending the partially signed tx to web-browser. |
@Fourzin please open a new issue and also include the commands you used to construct the tx |
Ok I will |
For any weary traveler that stumbles upon this thread and wants to try sign cardano-cli transactions with a CIP-30 wallet the following worked for me. I used transaction build raw to make a simple transaction sending a utxo back to the wallet with a set fee of 200000 lovelaces in the cli and then copied the CBOR Hex part of the outfile. This requires a CIP-30 wallet connector and pycardano Procedure: take cbor from cardano cli remove first byte and last 2 bytes
|
@while0x1 There is now the option |
Summary
Cardano-cli generates transactions which do not meet the ledger specification. Furthermore, if you're trying to sign these transactions in a browser wallet such as Nami - it will not parse them, because serialization-lib (correctly) detects the transactions produced by Cardano-cli as invalid. This is a major stumbling block for dApps looking to integrate a Cardano-node backend with any browser wallet which uses serialization-lib - as things stand, that's just not possible - due to such a simple error:
In the case of an empty witness set, the field should be an empty map {}, not an empty array [].
Steps to reproduce
Generate a transaction with Cardano-cli and observe the witness-set field - in the case of an empty witness set, you will find that it is an empty array, when the ledger spec indicated that it should be a map.
Expected behavior
Witness set field should be an empty map: {}
System info (please complete the following information):
Latest everything
Screenshots and attachments
Example cbor:
86a600828258207a9ae75e073a713791cc3045c2c2f62b925c4d33ae670da445ec80f20c459d7f0082582093ce7d39fc764e8ec9026a50f1f41f0d18649e18378718e91c45060fead0c703010d80018382583900af035fb9a547276bbb86a1936882524463eccb82465fcdf44489013713a39f099c533eb97b848aea0ae05850b4b40ec1ec05541a3f84c9b11a0483d91a83581d70eb18d99e0c392b18a436d595b5223e8fff559c4643118c1d403dfaab821a001e8480a1581c79e78a324e27842aa2ccaa21a710198b1db2c2a835b70d663b68a9dca1534d79546573746e6574547231303030303237310158201db43f14402b617c93f860381ec852799320d35c1be86386dffa53d792d846d582583900af035fb9a547276bbb86a1936882524463eccb82465fcdf44489013713a39f099c533eb97b848aea0ae05850b4b40ec1ec05541a3f84c9b1821a01312d00a2581c6b8d07d69639e9413dd637a1a815a7323c69c86abbafb66dbfdb1aa7a14002581c79e78a324e27842aa2ccaa21a710198b1db2c2a835b70d663b68a9dca2534d79546573746e65745472313030303032363701534d79546573746e65745472313030303032363801021a0002d8a50e8007582053d1932595c943555dd467aa2d3a36efdc865caf35ad77c04c270edcfd2dc39c9fff8080f5d90103a100a119013863626172
Additional context
We're trying to complete our smart validator integration at Artifct.app - our architecture involved having cardano-cli generate transactions which were then sent to Nami wallet for signing in the browser. Nami uses serialization-lib to parse the transactions, but it fails on every transaction we generate from Cardano-cli due to this invalid witness set field. I have discussed this with an Emurgo developer on their issues tracker:
Emurgo/cardano-serialization-lib#259
The text was updated successfully, but these errors were encountered: