user56: I'm re-watching the Plutus Pioneer Program and in the video #2 I don't exactly get it here: https://youtu.be/E5KRk5y9KjQ?t=1782
There's the same contract code used by Wallet1 and Wallet2. Each of them submits a transaction calling give() and both of them land in the same block. Both script hashes are identical, well, because the validators are so. (And I understand that script hash is actually a hash of the deployed validator).
How is/are the validator deployed to the blockchain in that scenario?

Does each of the wallets deploy their own copy?
If so, wouldn't the hash clash become a problem?
If both deploy a copy, when Wallet3 refers to the same contract, by calling grab(), which of the validators is being run? Both?


user609: The validator script sits inside the EUTxO. Its job is to permit or deny the consumption of the EUTxO.
So, in the example from the lecture, when wallet1 gives, it actually produces an EUTxO that has our validator script inside it. When wallet2 gives, it produces another EUTxO which has the same validator script inside it.
When wallet3 wants to grab, it finds those two EUTxOs and wants to consume them. When wallet3 wants to consume the first EUTxO, the validator inside
that EUTxO runs and permits its consumption. When wallet3 wants to consume the second EUTxO, the validator inside that EUTxO runs and permits its consumption. Now that wallet3 is allowed to consume those two EUTxOs, it consumes them and produces its own output.

56: <p>I'm re-watching the Plutus Pioneer Program and in the video #2 I don't exactly get it here: <a href="https://youtu.be/E5KRk5y9KjQ?t=1782" rel="noreferrer">https://youtu.be/E5KRk5y9KjQ?t=1782</a></p>
<p>There's the same contract code used by <em>Wallet1</em> and <em>Wallet2</em>. Each of them submits a transaction calling <code>give()</code> and both of them land in the same block. Both script hashes are identical, well, because the validators are so. (And I understand that <em>script hash</em> is actually a hash of the deployed validator).</p>
<p>How is/are the validator deployed to the blockchain in that scenario?</p>
<ol>
<li>Does each of the wallets deploy their own copy?</li>
<li>If so, wouldn't the hash clash become a problem?</li>
<li>If both deploy a copy, when <em>Wallet3</em> refers to the same contract, by calling <code>grab()</code>, which of the validators is being run? Both?</li>
</ol>
 609: <p>The validator script sits inside the EUTxO. Its job is to permit or deny the consumption of the EUTxO.</p>
<p>So, in the example from the lecture, when wallet1 gives, it actually produces an EUTxO that has our validator script inside it. When wallet2 gives, it produces another EUTxO which has the same validator script inside it.</p>
<p>When wallet3 wants to grab, it finds those two EUTxOs and wants to consume them. When wallet3 wants to consume the first EUTxO, the validator inside
that EUTxO runs and permits its consumption. When wallet3 wants to consume the second EUTxO, the validator inside that EUTxO runs and permits its consumption. Now that wallet3 is allowed to consume those two EUTxOs, it consumes them and produces its own output.</p>
