user6113: As far as I understand the function Constraints.mustPayToTheScript :: forall i o. ToData o => o -> Value -> TxConstraints i o  is used to command: Hey, pay some money, Value, to the script and record o as Datum in the chain.
How could I pay to a script recording the Datum hash?

user6113: I asked my question in Q&A session 2 (3 cohort) to Lars.
His response was that currently is not possible to do it (store only the UTXO's DatumHash (not Datum) in the chain) using PAB. However it is possible using with Cardano Cli.

user2537: Let's say you have a Datum like this one:
let d = MyDatum
          { someField = 1
          , someOtherField = 2
          }

And a script:
let lookups = typedValidatorLookups myScriptInstance
              <> otherScript myScriptValidator

Then you can call the function as follows:
let tx = mustPayToTheScript d $ Ada.lovelaceValueOf 1_000_000

And then submit the transaction if you want:
ledgerTx <- mkTxConstraints @MyValidatorTypes lookups tx >>= submitUnbalancedTx . adjustUnbalancedTx
awaitTxConfirmed $ getCardanoTxId ledgerTx


6113: <p>As far as I understand the function <code>Constraints.mustPayToTheScript :: forall i o. ToData o =&gt; o -&gt; Value -&gt; TxConstraints i o </code> is used to command: Hey, pay some money, <strong>Value</strong>, to the script and record <strong>o</strong> as Datum in the chain.</p>
<p>How could I pay to a script recording the Datum hash?</p>
 6113: <p>I asked my question in Q&amp;A session 2 (3 cohort) to Lars.</p>
<p>His response was that currently is not possible to do it (store only the UTXO's DatumHash (not Datum) in the chain) using PAB. However it is possible using with Cardano Cli.</p>
 2537: <p>Let's say you have a <code>Datum</code> like this one:</p>
<pre><code>let d = MyDatum
          { someField = 1
          , someOtherField = 2
          }
</code></pre>
<p>And a script:</p>
<pre><code>let lookups = typedValidatorLookups myScriptInstance
              &lt;&gt; otherScript myScriptValidator
</code></pre>
<p>Then you can call the function as follows:</p>
<pre><code>let tx = mustPayToTheScript d $ Ada.lovelaceValueOf 1_000_000
</code></pre>
<p>And then submit the transaction if you want:</p>
<pre><code>ledgerTx &lt;- mkTxConstraints @MyValidatorTypes lookups tx &gt;&gt;= submitUnbalancedTx . adjustUnbalancedTx
awaitTxConfirmed $ getCardanoTxId ledgerTx
</code></pre>
