<p>The family of <code>submitTx</code> functions all create transactions from the constraints submitted in the arguments. The most general implementation of the function is</p>
<pre><code>submitTxConstraintsWith 
  :: ScriptLookups a 
  -&gt; TxConstraints (RedeemerType a) (DatumType a) 
  -&gt; Contract w s e Tx
</code></pre>
<p>Here <code>ScriptLookups a</code> takes a lookup of the (Plutus compiled) scripts that are required by the transaction for on-chain execution.</p>
<p><a href="https://alpha.marlowe.iohkdev.io/doc/haddock/plutus-contract/html/Plutus-Contract-Effects-WriteTx.html" rel="nofollow noreferrer">This link</a> gives an overview of the functions that are implemented. I added it as illustration as I don't know what Plutus commit it belongs to.</p>

CC BY-SA 4.0
2021-08-03T18:28:57.333Z
So, the transaction that ends up being submitted to the network will have as output/UTXO the script, right? instead of say a public key hash for example. ? @vcwebco
Attilah
CC BY-SA 4.0
2021-08-03T20:29:06.617Z
Not as output, but as constraint. In the case of a script the constraint is a validator that upon execution must return true for the transaction to succeed. The spending transactions that consume UTXOs from the smart contract need to supply validator script hash and (compiled) code. The producing transactions only need to supply the validator hash. It is explained  in the Plutus Pioneer Program - Iteration #2 - Lecture #2 video at minute 37.
vcwebco
CC BY-SA 4.0
2021-08-03T18:01:12.030Z
2021-11-20T18:07:19.127Z
2021-11-20T18:07:19.127Z
vcwebco
<p><code>submitTxConstraintsWith :: ScriptLookups a -&gt; TxConstraints (RedeemerType a) (DatumType a) -&gt; Contract w s e Tx</code></p>
<p>How does <code>submitTxConstraintsWith</code> make usage of the ScriptLookups?</p>
<p>I always see it used like this: <code>ledgerTx &lt;- submitTxConstraints (swapInst oracle) tx</code></p>
<p>I am wondering why the <code>ScriptLookups</code>?</p>

<plutus><plutus-pioneer-program><plutustx>
How does `submitTxConstraintsWith` make usage of the ScriptLookups?
# How does `submitTxConstraintsWith` make usage of the ScriptLookups?

(Asked by: username_0 on 2021-08-03)

`submitTxConstraintsWith :: ScriptLookups a -> TxConstraints (RedeemerType a) (DatumType a) -> Contract w s e Tx`

How does `submitTxConstraintsWith` make usage of the ScriptLookups?

I always see it used like this: `ledgerTx <- submitTxConstraints (swapInst oracle) tx`

I am wondering why the `ScriptLookups`?

**Tags:** plutus, plutus-pioneer-program, plutustx

---

## 1 answers

### Answer by username_1 on 2021-08-03. Score: 2 | Accepted answer

The family of submitTx functions all create transactions from the constraints submitted in the arguments. The most general implementation of the function is
submitTxConstraintsWith 
  :: ScriptLookups a 
  -> TxConstraints (RedeemerType a) (DatumType a) 
  -> Contract w s e Tx

Here ScriptLookups a takes a lookup of the (Plutus compiled) scripts that are required by the transaction for on-chain execution.
This link gives an overview of the functions that are implemented. I added it as illustration as I don't know what Plutus commit it belongs to.

> **Comments:**
> **username_0**: So, the transaction that ends up being submitted to the network will have as output/UTXO the script, right? instead of say a public key hash for example. ? @vcwebco  
> **username_1**: Not as output, but as constraint. In the case of a script the constraint is a validator that upon execution must return true for the transaction to succeed. The spending transactions that consume UTXOs from the smart contract need to supply validator script hash and (compiled) code. The producing transactions only need to supply the validator hash. It is explained  in the Plutus Pioneer Program - Iteration #2 - Lecture #2 video at minute 37.  

---

