5

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?

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

1 Answer 1

6

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.

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.