Scrape up ada from different UTXOs is there any automatic way to build --tx-in's?

Hi, I’m trying to think about some edge cases when building transaction with cardano-cli.
Is it a posible situation when I have UTXOs list like that in my wallet?

<TxHash1>   |   #0   |   1,000,000 lovelaces
<TxHash2>   |   #1   |   2,000,000 lovelaces
<TxHash3>   |   #2   |   1,000,000 lovelaces

And know what if I want to send 3.5ADA to Bob.

Will I have to build a transaction that look like this? (is it a correct transaction?)


--tx-in <TxHash1> #0 \
--tx-in <TxHash2> #1 \
--tx-in <TxHash3> #2 \
--tx-out <myaddress>+500,000
--tx-out <bobsAddress>+3,500,000

Is there any built-in way in cardano-cli to scrape up lovelaces from different UTXOs based on wallet address? Or do I have to implement it myself in whatever language I use?

The coincashew tutorial has a nice bash script that reads all the utxos. See here:

1 Like

Thanks! Looks good

I have a set of bash scripts I use for exactly this, the build script was a bit buggy recently and I’ve not had time to double check it, so maybe test it out first, but I went ahead and uploaded to my git: GitHub - artistulla/cardano-cli-token-transactions

(there’s a buildTX for sending a defined amount and a sweepTX for sending all UTxO’s from a wallet…emptying it)

1 Like

Thank you for sharing!

1 Like