<p>Seeing as you've solved the mystery around the pending state transactions I will try my best to answer questions 1 and 3.</p>
<p><strong>Question 1: Inconsistent Lockup of UTXOs</strong></p>
<p>Wallets use <a href="https://cips.cardano.org/cips/cip2/" rel="nofollow noreferrer">CIP 2 - Coin Selection Algorithms for Cardano</a> to decide which UTxOs to consume.</p>
<blockquote>
<p>There are two main algorithms used by Cardano Wallet:</p>
<ul>
<li>Largest-First</li>
<li>Random-Improve</li>
</ul>
<p>In general, Cardano Wallet gives priority to the Random-Improve algorithm, as experimental evidence shows that it
performs better at minimising dust and maintaining a UTxO set with
useful outputs. (See Self Organisation in Coin Selection for more
details.)</p>
<p>However, in rare cases, the Random-Improve algorithm may fail to produce a result. In such cases, Cardano Wallet will fall back to the Largest-First algorithm.</p>
</blockquote>
<p>Looking into the <a href="https://explorer.cardano-testnet.iohkdev.io/en/address?address=addr_test1qzp4lqggu2qfr2qs5plsjh8q7l9y3afcxzwwyfv3em2aqe0k69w3xsq4ruy5tenk59cshs2m26ftpdvacmqcn7yfljps7zazwv&amp;page=3&amp;perPage=2" rel="nofollow noreferrer">transaction history here</a> I can see that the wallet had a limited set of UTxOs to work with, one output with 900 ADA, one with 90 ADA and single ADA outputs here and there. In this case it looks like the random-improve algorithm selected the 900 ADA UTxO first.</p>
<p>Given this knowledge, it does make sense to have multiple evenly distributed UTxOs available for your wallet if you need multiple concurrent transactions between blocks. Wallets like Eternl do this with their &quot;Advanced UTxO Management&quot; feature.</p>
<p><strong>Question 3: Addresses to Use if Privacy isn't needed</strong></p>
<p>Yes it doesn't matter which address you use, as the wallet will always have full control to spend UTxOs across its previously derived addresses. For example wallets like Nami always use the first derived address. It is also worthwhile mentioning that there is no privacy between transactions if all your derived addresses use the same staking key, which is the case for most wallets today. <a href="https://www.reddit.com/r/cardano/comments/ilssj3/privacy_of_spending_addresses/" rel="nofollow noreferrer">An thread from reddit</a> highlights this.</p>

CC BY-SA 4.0
2022-04-22T18:47:35.337Z
Great, thanks for the info! When my node is synced the transactions settle in ~30 sec so it won't be an issue but just for my understanding; I think I get why the cardano-wallet has the utxo distribution endpoint now. I'm currently using a high level API that simplifies transaction building but if I wanted more control I could use a lower level client and use one of the algorithms you mentioned or implement my own utxo selection method? It doesn't really matter when transactions are expected to settle in a short period but for certain smart contract durations it might end up being important.
B Rad C
CC BY-SA 4.0
2022-04-23T06:50:46.157Z
Yeah for ultimate flexibility there are already quite a few options around lower level SDKs or clients depending on the tech stack you are using. I personally find `cardano-wallet` to be a tad heavy-weight and opinionated so I use `cardano-cli` for ad-hoc transactions and [CardanoSharp](https://github.com/CardanoSharp/cardanosharp-wallet) with my C# code.
keefie
CC BY-SA 4.0
2022-04-22T11:54:45.547Z
2022-04-22T11:54:45.547Z
keefie
<p>I'm following this <a href="https://developers.cardano.org/docs/transaction-metadata/how-to-create-a-metadata-transaction-wallet" rel="nofollow noreferrer">guide on metadata</a> transactions with the cardano wallet server. My goal is to prove the existence of a given IPFS hash at a certain point in time. I don't need to send or receive ADA from anyone so as the guide mentions I'm sending 1,000,000 lovelace to myself. I have these two transactions (<a href="https://explorer.cardano-testnet.iohkdev.io/en/transaction?id=3a683fbef89c87734a54af7b87bb73bdac229a3d6c126e5a34c673c3bd89a15d" rel="nofollow noreferrer">one</a> &amp; <a href="https://explorer.cardano-testnet.iohkdev.io/en/transaction?id=505d50ed9eb2af03aed723373c707def24f6613dd7528606e56b5b39fe67981a" rel="nofollow noreferrer">two</a>) on <strong>testnet</strong> that have been in a pending state for &gt;1 hour.</p>
<p>The first transaction shows ~900 ADA coming from one of my addrs and then 1 ADA going to my address that I specified and then the remainder going to another addr in my wallet. The second transaction is similar but has 3 inputs and 2 outputs.</p>
<p>I'm trying to understand how the eUTXO model works in this situation, I understand that I'm getting all of the ADA back but while these transactions are pending I apparently can't spend anything because I tried a third transaction but it failed saying I don't the 1 ADA required. After some more research I see that I should've specified a TTL so that it doesn't take forever but I have a few questions about how I should I approach this.</p>
<ol>
<li><p>Why is the lockup inconsistent? I only need 1 ADA + fee, so why did the first transaction lock up 900 ADA and then the second locked up the remaining ~90? If it is ok with 90 is it possible to specify a smaller number?</p>
</li>
<li><p>What's with the hour long pending state? I have over 150 confirmations, is this due to congestion on testnet? Any suggestions on a TTL for this type of transaction?</p>
</li>
<li><p>The wallet provides several addresses for privacy but in this application design I don't want privacy, the intention is to make the metadata public so it really shouldn't matter what address I use as long as its consistent right? Is there a typical method for selecting an address for public transparancy or just pick the first one?</p>
</li>
</ol>
<p><strong>EDIT</strong>
Just a moment ago I realized my local node was showing it was 99.8% synced and I just sent another <a href="https://explorer.cardano-testnet.iohkdev.io/en/transaction?id=c40dbc63df9966a4704880cd0da79dfff68cc60fcce9bd04a35c81909ff7721a" rel="nofollow noreferrer">transaction</a> that updated to <em>in_ledger</em> status really quickly so I'm guessing the sync was why I was seeing the pending status for so long on my local node but I'm still interested in questions 1 &amp; 3 above.</p>

<transaction><metadata><eutxo><transaction-metadata>
Metadata transactions / eUTOX TTL / locking up ADA
# Metadata transactions / eUTOX TTL / locking up ADA

(Asked by: username_0 on 2022-04-21)

I'm following this [guide on metadata](https://developers.cardano.org/docs/transaction-metadata/how-to-create-a-metadata-transaction-wallet) transactions with the cardano wallet server. My goal is to prove the existence of a given IPFS hash at a certain point in time. I don't need to send or receive ADA from anyone so as the guide mentions I'm sending 1,000,000 lovelace to myself. I have these two transactions ([one](https://explorer.cardano-testnet.iohkdev.io/en/transaction?id=3a683fbef89c87734a54af7b87bb73bdac229a3d6c126e5a34c673c3bd89a15d) & [two](https://explorer.cardano-testnet.iohkdev.io/en/transaction?id=505d50ed9eb2af03aed723373c707def24f6613dd7528606e56b5b39fe67981a)) on **testnet** that have been in a pending state for >1 hour.

The first transaction shows ~900 ADA coming from one of my addrs and then 1 ADA going to my address that I specified and then the remainder going to another addr in my wallet. The second transaction is similar but has 3 inputs and 2 outputs.

I'm trying to understand how the eUTXO model works in this situation, I understand that I'm getting all of the ADA back but while these transactions are pending I apparently can't spend anything because I tried a third transaction but it failed saying I don't the 1 ADA required. After some more research I see that I should've specified a TTL so that it doesn't take forever but I have a few questions about how I should I approach this.

1. Why is the lockup inconsistent? I only need 1 ADA + fee, so why did the first transaction lock up 900 ADA and then the second locked up the remaining ~90? If it is ok with 90 is it possible to specify a smaller number?
2. What's with the hour long pending state? I have over 150 confirmations, is this due to congestion on testnet? Any suggestions on a TTL for this type of transaction?
3. The wallet provides several addresses for privacy but in this application design I don't want privacy, the intention is to make the metadata public so it really shouldn't matter what address I use as long as its consistent right? Is there a typical method for selecting an address for public transparancy or just pick the first one?

**EDIT**
Just a moment ago I realized my local node was showing it was 99.8% synced and I just sent another [transaction](https://explorer.cardano-testnet.iohkdev.io/en/transaction?id=c40dbc63df9966a4704880cd0da79dfff68cc60fcce9bd04a35c81909ff7721a) that updated to *in\_ledger* status really quickly so I'm guessing the sync was why I was seeing the pending status for so long on my local node but I'm still interested in questions 1 & 3 above.

**Tags:** transaction, metadata, eutxo, transaction-metadata

---

## 1 answers

### Answer by username_1 on 2022-04-22. Score: 1

Seeing as you've solved the mystery around the pending state transactions I will try my best to answer questions 1 and 3.

**Question 1: Inconsistent Lockup of UTXOs**

Wallets use [CIP 2 - Coin Selection Algorithms for Cardano](https://cips.cardano.org/cips/cip2/) to decide which UTxOs to consume.

> There are two main algorithms used by Cardano Wallet:
>
> * Largest-First
> * Random-Improve
>
> In general, Cardano Wallet gives priority to the Random-Improve algorithm, as experimental evidence shows that it
> performs better at minimising dust and maintaining a UTxO set with
> useful outputs. (See Self Organisation in Coin Selection for more
> details.)
>
> However, in rare cases, the Random-Improve algorithm may fail to produce a result. In such cases, Cardano Wallet will fall back to the Largest-First algorithm.

Looking into the [transaction history here](https://explorer.cardano-testnet.iohkdev.io/en/address?address=addr_test1qzp4lqggu2qfr2qs5plsjh8q7l9y3afcxzwwyfv3em2aqe0k69w3xsq4ruy5tenk59cshs2m26ftpdvacmqcn7yfljps7zazwv&page=3&perPage=2) I can see that the wallet had a limited set of UTxOs to work with, one output with 900 ADA, one with 90 ADA and single ADA outputs here and there. In this case it looks like the random-improve algorithm selected the 900 ADA UTxO first.

Given this knowledge, it does make sense to have multiple evenly distributed UTxOs available for your wallet if you need multiple concurrent transactions between blocks. Wallets like Eternl do this with their "Advanced UTxO Management" feature.

**Question 3: Addresses to Use if Privacy isn't needed**

Yes it doesn't matter which address you use, as the wallet will always have full control to spend UTxOs across its previously derived addresses. For example wallets like Nami always use the first derived address. It is also worthwhile mentioning that there is no privacy between transactions if all your derived addresses use the same staking key, which is the case for most wallets today. [An thread from reddit](https://www.reddit.com/r/cardano/comments/ilssj3/privacy_of_spending_addresses/) highlights this.

> **Comments:**
> **username_0**: Great, thanks for the info! When my node is synced the transactions settle in ~30 sec so it won't be an issue but just for my understanding; I think I get why the cardano-wallet has the utxo distribution endpoint now. I'm currently using a high level API that simplifies transaction building but if I wanted more control I could use a lower level client and use one of the algorithms you mentioned or implement my own utxo selection method? It doesn't really matter when transactions are expected to settle in a short period but for certain smart contract durations it might end up being important.  
> **username_1**: Yeah for ultimate flexibility there are already quite a few options around lower level SDKs or clients depending on the tech stack you are using. I personally find `cardano-wallet` to be a tad heavy-weight and opinionated so I use `cardano-cli` for ad-hoc transactions and [CardanoSharp](https://github.com/CardanoSharp/cardanosharp-wallet) with my C# code.  

---

