0

I started creating this python library with most of the Plutus types represented as classes. I get their values by calling the json method, which returns the JSON equivalent of this type so it can be passed to cardano-cli, like the following:

class PubKeyHash(object):
    ...
    def json(self):
        return json.dumps({
            "bytes": self.__pkh
        })

This worked well while I was writing these values to files and passing the files path to cardano-cli, but since I'm using ssh to connect to the node and writing files all the time is not very performant, I think it would be great to, instead, pass the JSON values directly.

When I try to do this using the --mint-redeemer-value argument, though, it returns me a weird error Exception: option --mint-redeemer-value: Failed reading: not a valid json value, which makes me assume my JSON is not formatted correctly.

This is the command I'm running:

...
--mint-redeemer-value {"constructor":0,"fields":[{"constructor":0,"fields":[{"bytes":"
02fbd1c6934d888ec6575de3ec2f87dd75aec2891f20e0dc38fa7440e47a3803"}]},{"int":0}]} \
...

If it is the case that my JSON is formatted incorrectly, how should I format it? If it is not, can anyone bring me some light on why I'm running into this error?

1 Answer 1

1

Checking the man page for cardano-cli transaction build, I see:

  --mint-redeemer-value JSON VALUE
                           The JSON value for the script data. Supported JSON
                           data types: string, number, object & array.

This is expecting a basic JSON value (no schema).

Since you are providing JSON that follows the schema for script data, you will need to write your JSON to a file and use --mint-redeemer-file instead:


cardano-cli transaction build \
--mint-redeemer-file my-file.json 
...

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.