<p>I have a wallet with the following two UTXOs:</p>
<ol>
<li><code>a2e38168473ae7f42e86ac274733004b36a1e119b665a5dae9a799e3a6a9c47a#1</code> Contains pure ADA balance</li>
<li><code>942bd39f32524c83973fe3c6b5a9157f6fde5e9b5a30cd6cad8e92145eb2740d#1</code> Contains multiple native-assets</li>
</ol>
<p>JSON dump of my wallet UTXO: <a href="https://pastebin.com/raw/rVpy9HSk" rel="nofollow noreferrer">https://pastebin.com/raw/rVpy9HSk</a></p>
<p>I would like to send <strong>one</strong>  <code>9c2f2bd159a50fd8c8ba251c8a488c4ceef42c2cf53c3d7231589f34.57656c6c446f6e65536572696573303130</code> into a smart contract, so I have built the transaction like this:</p>
<pre><code>cardano-cli transaction build \                                                          
        --alonzo-era \
        --protocol-params-file tmp/protocol.json \
        --invalid-hereafter 99999999 \
        --out-file tmp/tx.draft \
        --change-address addr_test1qqh04eamdak8x5c5gwxyfxd4uh6cfw2ju3t2ch64an4g3sdzljz3waey7ew4ezg0uvqtrs0rpxuc25w0yptv4ke7z0sqv68nde \
        --tx-in 942bd39f32524c83973fe3c6b5a9157f6fde5e9b5a30cd6cad8e92145eb2740d#1 \
        --tx-in a2e38168473ae7f42e86ac274733004b36a1e119b665a5dae9a799e3a6a9c47a#1 \
        --tx-out=&quot;addr_test1wzlvtds2fp3c47p8ut7uumh8splsce70gnqxd8vsk9alcsc92es7p + 1758582 + 1 9c2f2bd159a50fd8c8ba251c8a488c4ceef42c2cf53c3d7231589f34.57656c6c446f6e65536572696573303130&quot; \
        --tx-out-datum-embed-file create_sale_datum.json \
        --testnet-magic 1097911063
</code></pre>
<p>As you can see, I am using using both UTXOs as input and one output (with datum) into SC address - the above results in the following error:</p>
<blockquote>
<p>Command failed: transaction build  Error: Non-Ada assets are unbalanced: 129193426 lovelace + 1000 9c2f2bd159a50fd8c8ba251c8a488c4ceef42c2cf53c3d7231589f34.436972636c65436f696e + 1 9c2f2bd159a50fd8c8ba251c8a488c4ceef42c2cf53c3d7231589f34.546573744c6f6e6744657363 + 1 9c2f2bd159a50fd8c8ba251c8a488c4ceef42c2cf53c3d7231589f34.57656c6c446f6e65536572696573303035 + 1 9c2f2bd159a50fd8c8ba251c8a488c4ceef42c2cf53c3d7231589f34.57656c6c446f6e65536572696573303036 + 1 9c2f2bd159a50fd8c8ba251c8a488c4ceef42c2cf53c3d7231589f34.57656c6c446f6e65536572696573303037 + 1 9c2f2bd159a50fd8c8ba251c8a488c4ceef42c2cf53c3d7231589f34.57656c6c446f6e65536572696573303039 + 1 9c2f2bd159a50fd8c8ba251c8a488c4ceef42c2cf53c3d7231589f34.57656c6c446f6e65536572696573303131 + 1 9c2f2bd159a50fd8c8ba251c8a488c4ceef42c2cf53c3d7231589f34.57656c6c446f6e65536572696573303132 + 1 9c2f2bd159a50fd8c8ba251c8a488c4ceef42c2cf53c3d7231589f34.57656c6c446f6e65536572696573303133 + 1 9c2f2bd159a50fd8c8ba251c8a488c4ceef42c2cf53c3d7231589f34.57656c6c446f6e65536572696573303134 + 1 9c2f2bd159a50fd8c8ba251c8a488c4ceef42c2cf53c3d7231589f34.57656c6c446f6e65536572696573303135 + 1 9c2f2bd159a50fd8c8ba251c8a488c4ceef42c2cf53c3d7231589f34.57656c6c446f6e65536572696573303136 + 1 9c2f2bd159a50fd8c8ba251c8a488c4ceef42c2cf53c3d7231589f34.57656c6c446f6e65536572696573303137 + 1 9c2f2bd159a50fd8c8ba251c8a488c4ceef42c2cf53c3d7231589f34.57656c6c446f6e65536572696573303138 + 1 9c2f2bd159a50fd8c8ba251c8a488c4ceef42c2cf53c3d7231589f34.57656c6c446f6e65536572696573303139 + 1 9c2f2bd159a50fd8c8ba251c8a488c4ceef42c2cf53c3d7231589f34.57656c6c446f6e65536572696573303230</p>
</blockquote>
<p>OS: Ubutunu
Node: 1.34.1 (Testnet)</p>
<p>Any ideas? It looks like it's failing to figure out the <code>change</code> correctly?</p>

CC BY-SA 4.0
2022-05-30T07:36:11.053Z
The `cardano-cli transaction build --help` mentions that the order of some options is crucial. In your command can you put --out-file last & --change-address after --tx-out & --testnet-magic after --alonzo-era and give it another crack. This might help --change-address
MC_Brisbane - JUST Pool
CC BY-SA 4.0
2022-05-31T19:53:01.983Z
@MC_Brisbane-JUSTPool I tried changing the order of options as suggested, still returning same error about non-ada asset unbalanced: https://pastebin.com/raw/SDc1zDtV
Latheesan
CC BY-SA 4.0
2022-05-31T21:43:57.453Z
Thanks for the update. One alternative is to try using `build-raw` instead of `build` but this would require you to calculate the fee and include it using `--fee` . It's not difficult, but is extra steps. Could be a good last resort if no one else is about to help.
MC_Brisbane - JUST Pool
CC BY-SA 4.0
2022-06-01T00:00:32.820Z
Yes I have already planned use `build-raw` and manually workout the input/output & change. I just wanted to double check I wasn't doing anything silly trying to use the `build`. It does look like the CLI doesn't seem be able to handle utxo with multiple asset well sadly.
Latheesan
CC BY-SA 4.0
2022-06-01T00:15:10.740Z
It will be interesting to see if someone has a solid answer to this using `build`.
MC_Brisbane - JUST Pool
CC BY-SA 4.0
2022-06-01T01:36:13.800Z
Quinn on my team tells me this has always been the case, maybe this is a long overdue upgrade (handle change properly) to the cardano-cli
Latheesan
CC BY-SA 4.0
2022-06-01T03:25:51.623Z
Good to know, thanks. It might be best to create an answer to your question and accept it. This will help save time for the next person looking for this info.
MC_Brisbane - JUST Pool
CC BY-SA 4.0
2024-04-01T21:07:11.253Z
@Latheesan did you discover the solution?  I am running into the same problem.
mrsargent
<cardano-cli><smart-contract><transaction>
transaction build Error: Non-Ada assets are unbalanced (sending native asset to smart contract via cardano-cli 1.34.1)
# transaction build Error: Non-Ada assets are unbalanced (sending native asset to smart contract via cardano-cli 1.34.1)

(Asked by: username_0 on 2022-05-27)

I have a wallet with the following two UTXOs:

a2e38168473ae7f42e86ac274733004b36a1e119b665a5dae9a799e3a6a9c47a#1 Contains pure ADA balance
942bd39f32524c83973fe3c6b5a9157f6fde5e9b5a30cd6cad8e92145eb2740d#1 Contains multiple native-assets

JSON dump of my wallet UTXO: https://pastebin.com/raw/rVpy9HSk
I would like to send one 9c2f2bd159a50fd8c8ba251c8a488c4ceef42c2cf53c3d7231589f34.57656c6c446f6e65536572696573303130 into a smart contract, so I have built the transaction like this:
cardano-cli transaction build \                                                          
        --alonzo-era \
        --protocol-params-file tmp/protocol.json \
        --invalid-hereafter 99999999 \
        --out-file tmp/tx.draft \
        --change-address addr_test1qqh04eamdak8x5c5gwxyfxd4uh6cfw2ju3t2ch64an4g3sdzljz3waey7ew4ezg0uvqtrs0rpxuc25w0yptv4ke7z0sqv68nde \
        --tx-in 942bd39f32524c83973fe3c6b5a9157f6fde5e9b5a30cd6cad8e92145eb2740d#1 \
        --tx-in a2e38168473ae7f42e86ac274733004b36a1e119b665a5dae9a799e3a6a9c47a#1 \
        --tx-out="addr_test1wzlvtds2fp3c47p8ut7uumh8splsce70gnqxd8vsk9alcsc92es7p + 1758582 + 1 9c2f2bd159a50fd8c8ba251c8a488c4ceef42c2cf53c3d7231589f34.57656c6c446f6e65536572696573303130" \
        --tx-out-datum-embed-file create_sale_datum.json \
        --testnet-magic 1097911063

As you can see, I am using using both UTXOs as input and one output (with datum) into SC address - the above results in the following error:

Command failed: transaction build  Error: Non-Ada assets are unbalanced: 129193426 lovelace + 1000 9c2f2bd159a50fd8c8ba251c8a488c4ceef42c2cf53c3d7231589f34.436972636c65436f696e + 1 9c2f2bd159a50fd8c8ba251c8a488c4ceef42c2cf53c3d7231589f34.546573744c6f6e6744657363 + 1 9c2f2bd159a50fd8c8ba251c8a488c4ceef42c2cf53c3d7231589f34.57656c6c446f6e65536572696573303035 + 1 9c2f2bd159a50fd8c8ba251c8a488c4ceef42c2cf53c3d7231589f34.57656c6c446f6e65536572696573303036 + 1 9c2f2bd159a50fd8c8ba251c8a488c4ceef42c2cf53c3d7231589f34.57656c6c446f6e65536572696573303037 + 1 9c2f2bd159a50fd8c8ba251c8a488c4ceef42c2cf53c3d7231589f34.57656c6c446f6e65536572696573303039 + 1 9c2f2bd159a50fd8c8ba251c8a488c4ceef42c2cf53c3d7231589f34.57656c6c446f6e65536572696573303131 + 1 9c2f2bd159a50fd8c8ba251c8a488c4ceef42c2cf53c3d7231589f34.57656c6c446f6e65536572696573303132 + 1 9c2f2bd159a50fd8c8ba251c8a488c4ceef42c2cf53c3d7231589f34.57656c6c446f6e65536572696573303133 + 1 9c2f2bd159a50fd8c8ba251c8a488c4ceef42c2cf53c3d7231589f34.57656c6c446f6e65536572696573303134 + 1 9c2f2bd159a50fd8c8ba251c8a488c4ceef42c2cf53c3d7231589f34.57656c6c446f6e65536572696573303135 + 1 9c2f2bd159a50fd8c8ba251c8a488c4ceef42c2cf53c3d7231589f34.57656c6c446f6e65536572696573303136 + 1 9c2f2bd159a50fd8c8ba251c8a488c4ceef42c2cf53c3d7231589f34.57656c6c446f6e65536572696573303137 + 1 9c2f2bd159a50fd8c8ba251c8a488c4ceef42c2cf53c3d7231589f34.57656c6c446f6e65536572696573303138 + 1 9c2f2bd159a50fd8c8ba251c8a488c4ceef42c2cf53c3d7231589f34.57656c6c446f6e65536572696573303139 + 1 9c2f2bd159a50fd8c8ba251c8a488c4ceef42c2cf53c3d7231589f34.57656c6c446f6e65536572696573303230

OS: Ubutunu
Node: 1.34.1 (Testnet)
Any ideas? It looks like it's failing to figure out the change correctly?

**Tags:** cardano-cli, smart-contract, transaction
> **Comments:**
> **username_1**: The `cardano-cli transaction build --help` mentions that the order of some options is crucial. In your command can you put --out-file last & --change-address after --tx-out & --testnet-magic after --alonzo-era and give it another crack. This might help --change-address  
> **username_0**: @MC_Brisbane-JUSTPool I tried changing the order of options as suggested, still returning same error about non-ada asset unbalanced: https://pastebin.com/raw/SDc1zDtV  
> **username_1**: Thanks for the update. One alternative is to try using `build-raw` instead of `build` but this would require you to calculate the fee and include it using `--fee` . It's not difficult, but is extra steps. Could be a good last resort if no one else is about to help.  
> **username_0**: Yes I have already planned use `build-raw` and manually workout the input/output & change. I just wanted to double check I wasn't doing anything silly trying to use the `build`. It does look like the CLI doesn't seem be able to handle utxo with multiple asset well sadly.  
> **username_1**: It will be interesting to see if someone has a solid answer to this using `build`.  
> **username_0**: Quinn on my team tells me this has always been the case, maybe this is a long overdue upgrade (handle change properly) to the cardano-cli  
> **username_1**: Good to know, thanks. It might be best to create an answer to your question and accept it. This will help save time for the next person looking for this info.  
> **username_2**: @Latheesan did you discover the solution?  I am running into the same problem.  

---

## 0 answers

