4

In Week 6 of PP Lars finds an oracle input with the following code:

oracleInput :: TxOut
    oracleInput =
      let
        ins = [ o
              | i <- txInfoInputs info
              , let o = txInInfoResolved i
              -- addr = oracle's address
              , txOutAddress o == addr
              ]
      in
        case ins of
            [o] -> o
            _   -> traceError "expected exactly one oracle input"

Does it imply that if a script creates a transaction then transaction outputs will reference the script address through txOutAddress field?

Thank you :)

1
1

I am not sure I understand the question...

First of all, scripts do not "generate transactions", but validate transactions. Transactions are generated by wallets (and off-chain wallet code).

Now, what is the output of a transaction? In the EUTxO-model, it is given by three "things":

  • an address
  • a *value' and
  • a datum.

The txOutAddress function simply extracts the first component of this triple.

So in my example, I am looking for inputs who try to unlock outputs that "sit" at the oracle address. Since the oracle address is a script address, the corresponding oracle validator script will be executed to determine whether the transaction I am looking at is allowed to consume this input.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.