<p>Because this is a utxo system all utxo's must be consumed and the outputs must balance. In the above case, if I understand your code correctly, the redeemer is the unit <code>()</code> which always passes. As such, any input/output consuming the contract would be accepted. You could send 1 ada to someone and send the rest back to the contract's script address (with fees subtracted) to do what you want.</p>

CC BY-SA 4.0
2022-01-26T01:41:38.887Z
2022-01-26T01:41:38.887Z
Samuel Leathers
<p>Here is my code currently it ends up sending all of the value on the script to the caller but I only want it to send 1 ADA. How do I fix this? Is there anyway to create a smaller output to send</p>
<pre><code>purchase :: AsContractError e =&gt; MintParams -&gt; Contract w s e ()
purchase mp =  do
    utxos &lt;- fundsAtAddressGeq valAddress (Ada.lovelaceValueOf 1)

    let redeemer = ()
        pkh = ownPubKey
        tx       = collectFromScript utxos redeemer

    void (submitTxConstraintsSpending lootBox utxos tx)
</code></pre>

<plutus><plutus-pioneer-program>
Im trying to split up a utxo in a Script into a value of 1 ada what do I do
# Im trying to split up a utxo in a Script into a value of 1 ada what do I do

(Asked by: username_0 on 2022-01-26)

Here is my code currently it ends up sending all of the value on the script to the caller but I only want it to send 1 ADA. How do I fix this? Is there anyway to create a smaller output to send
purchase :: AsContractError e => MintParams -> Contract w s e ()
purchase mp =  do
    utxos <- fundsAtAddressGeq valAddress (Ada.lovelaceValueOf 1)

    let redeemer = ()
        pkh = ownPubKey
        tx       = collectFromScript utxos redeemer

    void (submitTxConstraintsSpending lootBox utxos tx)

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

---

## 1 answers

### Answer by username_1 on 2022-01-26. Score: 0 | Accepted answer

Because this is a utxo system all utxo's must be consumed and the outputs must balance. In the above case, if I understand your code correctly, the redeemer is the unit `()` which always passes. As such, any input/output consuming the contract would be accepted. You could send 1 ada to someone and send the rest back to the contract's script address (with fees subtracted) to do what you want.


---

