<p>To answer my own question, the order of my commands was wrong. The <code>--tx-in</code> for the script address needs to be just before the <code>--tx-in-script-file</code> :)</p>

CC BY-SA 4.0
2021-10-31T01:38:25.293Z
2021-10-31T01:38:25.293Z
Blake Brown
<p>I'm getting the following error when trying to consume a UTXO at a script address.</p>
<pre><code>Command failed: transaction build  Error: The following scripts have execution failures:
the script for transaction input 1 (in the order of the TxIds) failed with:
transaction input 1 (in the order of the TxIds) is not a Plutus script witnessed tx input and cannot be spent using a Plutus script witness.
</code></pre>
<p>My first tx-in is the UTXO at the script address I'd like to consume, the second tx-in is just a UTXO with lovelace that I'm attempting to use to pay the script with.</p>
<p>~ Full Details ~</p>
<h4>Transaction</h4>
<pre><code>cardano-cli transaction build \
--alonzo-era \
--mainnet \
--tx-in b4accf06d29a0d54a83e5d2b623d4cd361c6899408fd87cfa1437f42b83a8628#1 \
--tx-in d3e81062af7a78c02ae7bd3254092f83a647ee239ac65e52b13bd2cc7b9b00d4#0 \
--tx-in-script-file ../Vendere/market.plutus \
--tx-in-datum-file ../Vendere/datum-e986d38f4ead45a4f909cb51d61d8d95efc72b12d9302cdd040974d1-Hoskinsons2795.json \
--tx-in-redeemer-file ../Vendere/buy.json \
--required-signer ../Vendere/payment2.skey \
--tx-in-collateral b4accf06d29a0d54a83e5d2b623d4cd361c6899408fd87cfa1437f42b83a8628#0 \
--tx-out &quot;addr1qxynjszluq9wekl4ap0d087cchn3pun5yn34z4nyturcclrpncrywfgdf5yw89f3pwqk86k2cn8d8y8czqaeg9ctsa0sw6z6dr + 1 e986d38f4ead45a4f909cb51d61d8d95efc72b12d9302cdd040974d1.Hoskinsons2795&quot; \
--tx-out &quot;addr1q84j8yjtf6lx0f8f4pkecjzj5qu2y38f2l820nuu850qv9z6vk9t3l3dnyxdvqdtqs40hm2d2v8mzk3zqxaf73s7xkase7n4y6 + 50000000&quot; \
--change-address $(cat ../Vendere/payment.addr) \
--protocol-params-file ../Vendere/pparams.json \
--out-file ../Vendere/test-alonzo.tx
</code></pre>
<h4>Datum</h4>
<pre><code>{
  &quot;constructor&quot;: 0,
  &quot;fields&quot;: [
    {
      &quot;bytes&quot;: &quot;01eb23924b4ebe67a4e9a86d9c4852a038a244e957cea7cf9c3d1e06145a658ab8fe2d990cd601ab042afbed4d530fb15a2201ba9f461e35bb&quot;
    },
    { &quot;int&quot;: 50000000 },
    { &quot;bytes&quot;: &quot;e986d38f4ead45a4f909cb51d61d8d95efc72b12d9302cdd040974d1&quot; },
    { &quot;bytes&quot;: &quot;486f736b696e736f6e7332373935&quot; }
  ]
}
</code></pre>
<h4>Redeemer</h4>
<pre><code>{&quot;constructor&quot;:1,&quot;fields&quot;:[]}
</code></pre>
<h4>Validator</h4>
<p><a href="https://github.com/OnChainLabs/Vendere/blob/main/src/Market/Onchain.hs#L60" rel="nofollow noreferrer">https://github.com/OnChainLabs/Vendere/blob/main/src/Market/Onchain.hs#L60</a></p>

CC BY-SA 4.0
2021-10-30T18:55:12.953Z
Can you share the code that’s giving you this error?
Mitchell Turner
CC BY-SA 4.0
2021-10-30T19:44:58.710Z
@MitchellTurner Done! Should have all relevant details now
Blake Brown
<plutus>
What is a Plutus script witnessed tx input?
# What is a Plutus script witnessed tx input?

(Asked by: username_0 on 2021-10-30)

I'm getting the following error when trying to consume a UTXO at a script address.
Command failed: transaction build  Error: The following scripts have execution failures:
the script for transaction input 1 (in the order of the TxIds) failed with:
transaction input 1 (in the order of the TxIds) is not a Plutus script witnessed tx input and cannot be spent using a Plutus script witness.

My first tx-in is the UTXO at the script address I'd like to consume, the second tx-in is just a UTXO with lovelace that I'm attempting to use to pay the script with.
~ Full Details ~
Transaction
cardano-cli transaction build \
--alonzo-era \
--mainnet \
--tx-in b4accf06d29a0d54a83e5d2b623d4cd361c6899408fd87cfa1437f42b83a8628#1 \
--tx-in d3e81062af7a78c02ae7bd3254092f83a647ee239ac65e52b13bd2cc7b9b00d4#0 \
--tx-in-script-file ../Vendere/market.plutus \
--tx-in-datum-file ../Vendere/datum-e986d38f4ead45a4f909cb51d61d8d95efc72b12d9302cdd040974d1-Hoskinsons2795.json \
--tx-in-redeemer-file ../Vendere/buy.json \
--required-signer ../Vendere/payment2.skey \
--tx-in-collateral b4accf06d29a0d54a83e5d2b623d4cd361c6899408fd87cfa1437f42b83a8628#0 \
--tx-out "addr1qxynjszluq9wekl4ap0d087cchn3pun5yn34z4nyturcclrpncrywfgdf5yw89f3pwqk86k2cn8d8y8czqaeg9ctsa0sw6z6dr + 1 e986d38f4ead45a4f909cb51d61d8d95efc72b12d9302cdd040974d1.Hoskinsons2795" \
--tx-out "addr1q84j8yjtf6lx0f8f4pkecjzj5qu2y38f2l820nuu850qv9z6vk9t3l3dnyxdvqdtqs40hm2d2v8mzk3zqxaf73s7xkase7n4y6 + 50000000" \
--change-address $(cat ../Vendere/payment.addr) \
--protocol-params-file ../Vendere/pparams.json \
--out-file ../Vendere/test-alonzo.tx

Datum
{
  "constructor": 0,
  "fields": [
    {
      "bytes": "01eb23924b4ebe67a4e9a86d9c4852a038a244e957cea7cf9c3d1e06145a658ab8fe2d990cd601ab042afbed4d530fb15a2201ba9f461e35bb"
    },
    { "int": 50000000 },
    { "bytes": "e986d38f4ead45a4f909cb51d61d8d95efc72b12d9302cdd040974d1" },
    { "bytes": "486f736b696e736f6e7332373935" }
  ]
}

Redeemer
{"constructor":1,"fields":[]}

Validator
https://github.com/OnChainLabs/Vendere/blob/main/src/Market/Onchain.hs#L60

**Tags:** plutus
> **Comments:**
> **username_1**: Can you share the code that’s giving you this error?  
> **username_0**: @MitchellTurner Done! Should have all relevant details now  

---

## 1 answers

### Answer by username_0 on 2021-10-31. Score: 3

To answer my own question, the order of my commands was wrong. The `--tx-in` for the script address needs to be just before the `--tx-in-script-file` :)


---

