I am having trouble with the mustPayToTheScript function - I am getting this error

Contract instance stopped with error: "WalletError (InsufficientFunds \"Total: Value (Map [(,Map [(\\\"\\\",93999990)]),(3664623962343633373461373738623265326432313432636132356263336266636434323136646334326562636566636335346565346433,Map [(\\\"ElysiumTitan1\\\",1)])]) 
expected: Value (Map [(3664623962343633373461373738623265326432313432636132356263336266636434323136646334326562636566636335346565346433,Map [(\\\"ElysiumTitan\\NUL\\NUL\\SOH\\\",1)])])\")" ]

However, the value on the first line is what I'd would like to expect "ElysiumTitan1" - the expected value is strange and undesirable "ElysiumTitan\\NUL\\NUL\\SOH\\\".

From a google it looks like there's a character escape happening or something. Does anyone know why this is happening and how to prevent it?

Here is the line of code where i assume its happening: https://github.com/naeri-kailash/elysium-plutus/blob/master/src/Cardano/PlutusExample/Trade.hs#L524

screenshot of inputs

If I just put 1 I get this error:

Contract instance stopped with error: "OtherError \"Error in $.id: invalid bytestring size\"" ]

enter image description here

1 Answer 1


I am a bit confused about this part:

"ElysiumTitan" <> id

In normal Haskell id is the identity function, but I could not see how that would type check if it was. However, in this case it seems to by the id field of the TradeParams struct (which is also of type BuiltInByteString). I can't seem to find where that value is constructed, but somewhere or other, the id field of the TradeParams struct is initialized to "\NUL\\NUL\\SOH\\\.

Also, just as an aside. I highly recommend against using the RecordWildCards language pragma as it makes code more difficult to read, especially for someone not the author.

  • Thanks, I've removed the recordwildcards pragma although it still compiles the same and doesnt seem to require code changes for that. Im wondering why the id field is being initialised to "\NUL\\NUL\\SOH\\\" as this is preventing me from passing that condition... I didn't write most of this contract I've just been adapting it to my needs but it is proving very challenging. I haven't seen any other example contracts where there's bidding integrated though, do you know of any? Commented Sep 30, 2022 at 5:28
  • Do you have a link to your new version of the code? Commented Sep 30, 2022 at 9:10
  • 1
    Hey Erik sorry for late response, I've given up on the plutus-playground and am using the cli instead as it has been too much of a struggle. Thanks so much, I appreciate your input Commented Oct 6, 2022 at 3:56

Your Answer

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

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