<p><code>PT5</code> alone means that the validator returned <code>False</code>. You can break down your script into multiple steps of computation and add some <code>traceIfFalse</code> calls along the way to see more context why it happend to be <code>False</code> overall.</p>

CC BY-SA 4.0
2022-04-29T10:09:28.623Z
2022-04-29T10:09:28.623Z
Sebastian Nagel
<p>I am building a transaction where I use the following function to make my datum and redeemer,</p>
<pre><code>writeJSON :: PlutusTx.ToData a =&gt; FilePath -&gt; a -&gt; IO ()
writeJSON file = LBS.writeFile file . encode . scriptDataToJson ScriptDataJsonDetailedSchema . dataToScriptData . PlutusTx.toData
</code></pre>
<p>But when I build a transaction to consume an UTxO at the script address I get the following error,</p>
<pre><code>Command failed: transaction build  Error: The following scripts have execution failures:
the script for transaction input 0 (in the order of the TxIds) failed with: 
The Plutus script evaluation failed: An error has occurred:  User error:
The provided Plutus code called 'error'.
Script debugging logs: PT5
</code></pre>
<p>I am very certain that my redemeer and datum are correct. My onchain code is the following</p>
<pre><code>data MyDatum = MyDatum
    { pubKey :: Integer
    } deriving (Show, Generic, FromJSON, ToJSON, ToSchema)

data MyRedeemer = MyRedeemer
    { privKey :: Integer
    } deriving (Show, Generic, FromJSON, ToJSON, ToSchema)

data Params = Params
    { params_p :: Integer
    , params_g :: Integer
    , params_bits :: Integer
    } deriving (Generic, FromJSON, ToJSON, ToSchema)

unsafeParams :: Params
unsafeParams = Params p g 64
        where
                p = safePrime64
                g = (safePrime64 - 1) `PlutusTx.Prelude.divide` 2

PlutusTx.makeIsDataIndexed ''MyDatum [('MyDatum, 0)]
PlutusTx.makeLift ''MyDatum
PlutusTx.makeIsDataIndexed ''MyRedeemer [('MyRedeemer, 0)]
PlutusTx.makeLift ''MyRedeemer
PlutusTx.makeLift ''Params

{-# INLINABLE mkValidator #-}
mkValidator :: Params -&gt; MyDatum -&gt; MyRedeemer -&gt; ScriptContext -&gt; Bool
mkValidator (Params p g _) (MyDatum pub) (MyRedeemer priv) _ = pub == exponentiateMod g priv p
</code></pre>
<p>Where the the validator checks whether or not the redeemer is the exponent of the datum via modular exponentiation. Perhaps I incorrectly indexed my datum and redeemer with the <code>makeIsdataIndexed</code> function?</p>

CC BY-SA 4.0
2022-04-07T10:53:37.707Z
Your error means that the validator script returned an error. In the newer version of node, I think 1.33 or 1.34 you can see the exact error message which is thrown from the validator.
zarej
CC BY-SA 4.0
2022-04-07T12:19:38.367Z
I am currently running 1.33, ill update to 1.34 and see what I get there. Thanks for the tip!
Fermat
<plutus><plutus-pioneer-program><cardano-cli><transaction><plutustx>
Plutus transaction error PT5
# Plutus transaction error PT5

(Asked by: username_0 on 2022-04-06)

I am building a transaction where I use the following function to make my datum and redeemer,
writeJSON :: PlutusTx.ToData a => FilePath -> a -> IO ()
writeJSON file = LBS.writeFile file . encode . scriptDataToJson ScriptDataJsonDetailedSchema . dataToScriptData . PlutusTx.toData

But when I build a transaction to consume an UTxO at the script address I get the following error,
Command failed: transaction build  Error: The following scripts have execution failures:
the script for transaction input 0 (in the order of the TxIds) failed with: 
The Plutus script evaluation failed: An error has occurred:  User error:
The provided Plutus code called 'error'.
Script debugging logs: PT5

I am very certain that my redemeer and datum are correct. My onchain code is the following
data MyDatum = MyDatum
    { pubKey :: Integer
    } deriving (Show, Generic, FromJSON, ToJSON, ToSchema)

data MyRedeemer = MyRedeemer
    { privKey :: Integer
    } deriving (Show, Generic, FromJSON, ToJSON, ToSchema)

data Params = Params
    { params_p :: Integer
    , params_g :: Integer
    , params_bits :: Integer
    } deriving (Generic, FromJSON, ToJSON, ToSchema)

unsafeParams :: Params
unsafeParams = Params p g 64
        where
                p = safePrime64
                g = (safePrime64 - 1) `PlutusTx.Prelude.divide` 2

PlutusTx.makeIsDataIndexed ''MyDatum [('MyDatum, 0)]
PlutusTx.makeLift ''MyDatum
PlutusTx.makeIsDataIndexed ''MyRedeemer [('MyRedeemer, 0)]
PlutusTx.makeLift ''MyRedeemer
PlutusTx.makeLift ''Params

{-# INLINABLE mkValidator #-}
mkValidator :: Params -> MyDatum -> MyRedeemer -> ScriptContext -> Bool
mkValidator (Params p g _) (MyDatum pub) (MyRedeemer priv) _ = pub == exponentiateMod g priv p

Where the the validator checks whether or not the redeemer is the exponent of the datum via modular exponentiation. Perhaps I incorrectly indexed my datum and redeemer with the makeIsdataIndexed function?

**Tags:** plutus, plutus-pioneer-program, cardano-cli, transaction, plutustx
> **Comments:**
> **username_1**: Your error means that the validator script returned an error. In the newer version of node, I think 1.33 or 1.34 you can see the exact error message which is thrown from the validator.  
> **username_0**: I am currently running 1.33, ill update to 1.34 and see what I get there. Thanks for the tip!  

---

## 1 answers

### Answer by username_2 on 2022-04-29. Score: 0

`PT5` alone means that the validator returned `False`. You can break down your script into multiple steps of computation and add some `traceIfFalse` calls along the way to see more context why it happend to be `False` overall.


---

