user801: 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 :)

user186: 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.

801: <p>In Week 6 of PP Lars finds an oracle input with the following code:</p>
<pre><code>oracleInput :: TxOut
    oracleInput =
      let
        ins = [ o
              | i &lt;- txInfoInputs info
              , let o = txInInfoResolved i
              -- addr = oracle's address
              , txOutAddress o == addr
              ]
      in
        case ins of
            [o] -&gt; o
            _   -&gt; traceError &quot;expected exactly one oracle input&quot;
</code></pre>
<p>Does it imply that if a script creates a transaction then transaction outputs will reference the script address through <code>txOutAddress</code> field?</p>
<p>Thank you :)</p>
 186: <p>I am not sure I understand the question...</p>
<p>First of all, scripts do not &quot;generate transactions&quot;, but <em>validate</em> transactions. Transactions are <em>generated</em> by wallets (and off-chain wallet code).</p>
<p>Now, what <em>is</em> the output of a transaction? In the EUTxO-model, it is given by three &quot;things&quot;:</p>
<ul>
<li>an <em>address</em></li>
<li>a *value' and</li>
<li>a <em>datum</em>.</li>
</ul>
<p>The <code>txOutAddress</code> function simply extracts the first component of this triple.</p>
<p>So in my example, I am looking for inputs who try to unlock outputs that &quot;sit&quot; 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.</p>
