<p>The validator can ensure that a datum or multiple datums are included in the output.</p>
<p>Take the <a href="https://github.com/input-output-hk/plutus/blob/cfaa1438d2b391e8294fc3b8317b3768e78aa711/plutus-use-cases/src/Plutus/Contracts/Uniswap/OnChain.hs" rel="nofollow noreferrer">Uniswap clone</a> in the plutus-use-cases for example:</p>
<p>The <code>validateCreate</code> method ensures that an updated <code>Factory</code> datum</p>
<pre><code>Constraints.checkOwnOutputConstraint ctx (OutputConstraint (Factory $ lp : lps) $ unitValue usCoin)
</code></pre>
<p>and a new <code>Pool</code> datum</p>
<pre><code>Constraints.checkOwnOutputConstraint ctx (OutputConstraint (Pool lp liquidity) $ valueOf lpCoinA outA &lt;&gt; valueOf lpCoinB outB &lt;&gt; unitValue c)
</code></pre>
<p>are included in the outputs.</p>
<p>Both of these are attached to some <code>Value</code>.</p>

CC BY-SA 4.0
2021-07-22T06:07:59.917Z
Oh gosh I didn't know there was a whole library on On-Chain Constraints. Thank you!

As for the term Redeemer, I believe the language used has been not-strict enough. So to my understanding, the person initiating the transaction is called the Redeemer, and he/she will supply a RedeemerType to the Validator to spend the underlying eUTXO.

Link to the On-Chain constraints library: [https://github.com/input-output-hk/plutus/blob/160d158c2679a72adfc8edf7a1c43a4b59189d99/plutus-ledger/src/Ledger/Constraints/OnChain.hs]
Shannon Goh
CC BY-SA 4.0
2021-07-22T06:40:51.267Z
Yeah. The on-chain constraints are great and they compliment the off-chain constraints well. The more declarative the better :)
Mitchell Turner
CC BY-SA 4.0
2021-07-22T05:48:57.700Z
2021-07-22T05:48:57.700Z
Mitchell Turner
<p>is it possible for a Validator to ensure that the redeemer pays some Value along with a certain Datum attached to it? Looking at the possible transaction methods on the ScriptContext, checks are only done on the Value and not the Datum. I see the DatumHash types but am not sure what it is used for.<a href="https://i.sstatic.net/pLnX6.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/pLnX6.png" alt="enter image description here" /></a></p>

CC BY-SA 4.0
2021-07-22T05:52:27.067Z
Hope my answer was helpful. I'm not sure if you're overloading the term "Redeemer" (the redeemer data type vs the sender of that tx). I think I got what you were going for though. LMK if I can clarify.
Mitchell Turner
<plutus>
Can the Validator ensure a certain Datum is sent by the Redeemer?
# Can the Validator ensure a certain Datum is sent by the Redeemer?

(Asked by: username_0 on 2021-07-22)

is it possible for a Validator to ensure that the redeemer pays some Value along with a certain Datum attached to it? Looking at the possible transaction methods on the ScriptContext, checks are only done on the Value and not the Datum. I see the DatumHash types but am not sure what it is used for.[![enter image description here](https://i.sstatic.net/pLnX6.png)](https://i.sstatic.net/pLnX6.png)

**Tags:** plutus
> **Comments:**
> **username_1**: Hope my answer was helpful. I'm not sure if you're overloading the term "Redeemer" (the redeemer data type vs the sender of that tx). I think I got what you were going for though. LMK if I can clarify.  

---

## 1 answers

### Answer by username_1 on 2021-07-22. Score: 2 | Accepted answer

The validator can ensure that a datum or multiple datums are included in the output.
Take the Uniswap clone in the plutus-use-cases for example:
The validateCreate method ensures that an updated Factory datum
Constraints.checkOwnOutputConstraint ctx (OutputConstraint (Factory $ lp : lps) $ unitValue usCoin)

and a new Pool datum
Constraints.checkOwnOutputConstraint ctx (OutputConstraint (Pool lp liquidity) $ valueOf lpCoinA outA <> valueOf lpCoinB outB <> unitValue c)

are included in the outputs.
Both of these are attached to some Value.

> **Comments:**
> **username_0**: Oh gosh I didn't know there was a whole library on On-Chain Constraints. Thank you!  As for the term Redeemer, I believe the language used has been not-strict enough. So to my understanding, the person initiating the transaction is called the Redeemer, and he/she will supply a RedeemerType to the Validator to spend the underlying eUTXO.  Link to the On-Chain constraints library: [https://github.com/input-output-hk/plutus/blob/160d158c2679a72adfc8edf7a1c43a4b59189d99/plutus-ledger/src/Ledger/Constraints/OnChain.hs]  
> **username_1**: Yeah. The on-chain constraints are great and they compliment the off-chain constraints well. The more declarative the better :)  

---

