1

I'm wondering how to log/print/trace any message during the execution of a contract when submitted to the blockchain via cardano-cli. So basically I hoped this very simple test script would show me something:

mkValidator :: ContractInfo -> () -> () -> ScriptContext -> Bool
mkValidator _ _ _ _ = (traceIfFalse "Test" False) || True

However, when submitting a transaction with this script to cardano-cli, it gets executed without printing anything.

1 Answer 1

1

Your validator is basically False || True, which will always return True. The value from traceIfFalse is only passed to the user if the final result of the validator is False.

So if you are using the most recent version of cardano-cli the error should appear once you try to build a transaction removing the || True part. If you want, however, to log an error even when the validation succeeds, this is impossible with Plutus, at least on-chain.

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.