Author

Topic: What order should I follow when creating a transaction (Read 174 times)

sr. member
Activity: 1498
Merit: 271
DGbet.fun - Crypto Sportsbook
Well the  normal approach for this matter is to use the smallest possible no. of utxos that add up the amount you want
to send, in order to minimize the fee of transaction. Or in the other thing is to use a coin selection algorithm that tries
to optimize to other factors like decentralization or privacy.

In some other ways, you use calculation fee, creation output, selection input, signing and broadcast.
legendary
Activity: 2730
Merit: 7065
There are several things you need to consider. Always remember that Bitcoin uses a public ledger, and transaction data is available for the general public to look at.
The "age" of the transactions doesn't matter as long as they are confirmed or will soon be confirmed.

Let's say you have several different UTXOs.
- 3 BTC
- 1 BTC
- And a few small ones like 0.01 BTC, 0.005 BTC, etc.

If you are paying for something that costs 0.02 BTC, you can do as pooya87 said and spend 2x 0.01 UTXOs (actually a little bit more because you need to pay mining fees as well). Or you can spend the 1 or 3 BTC coin and pay with that.

Now consider the following points and decide what is more important for you:
- The more UTXOs you spend, the larger the transaction. That means more sats spent on transaction fees.
- If you spend a 3 BTC UTXO when paying for a low-cost item/service, do you really want the other party to be able to check that you have 3 BTC (at least) in your possession?
legendary
Activity: 3290
Merit: 16489
Thick-Skinned Gang Leader and Golden Feather 2021
Allow me to recommend my topic on how to Consolidate your small inputs. It explains how to save money on fees.
Depending on my needs at the moment, I either consolidate transactions before I need to make a transaction, or I select the inputs that best match the amount I need to pay. Years ago, using old coins got you a zero-fee transaction ("destroy coin days"), but that doesn't matter anymore. Now it's a balance between privacy and reducing fees.
legendary
Activity: 3472
Merit: 10611
Apart from fees and privacy concerns if you are doing manual coin control you should try not to break down your outputs into too many small ones and focus on decreasing the number of "coins" you have instead.
For example if you want to pay 0.1BTC it is best to use two 0.05BTC inputs instead of using a 0.2BTC input and breaking it down into two new outputs.

You should also pay some attention to how much change you are being left with and avoid too small change.
For example if you want to make a 0.1BTC payment avoid using an input that is 0.10001000BTC and would leave you with 0.00001000BTC change.
newbie
Activity: 17
Merit: 4
Thanks
All of it make sense  Wink
copper member
Activity: 2856
Merit: 3071
https://bit.ly/387FXHi lightning theory
If you can't get a 1 sat/byte fee to confirm or you care about privacy constantly then I'd prioritise spending the highest input just above how much you need to spend.

If you can get a low fee to confirm and you don't send too many transactions then the best practice is to consolidate them.
legendary
Activity: 2380
Merit: 5213
If you want to pay lower transaction fee, consider consolidating your UTXOs when transactions can be made with the fee rate of only 1 sat/vbyte.
If you haven't consolidate your UTXOs before and now you want to make a transaction, select your UTXOs so that the number of inputs is as small as possible. The more inputs you add to your transaction, the more fee you have to pay.
It doesn't really matter which UTXO has been received earlier and which one has been received later.

Note that in the case you care about your privacy, it may be bad if you use multiple UTXOs in a single transaction.
legendary
Activity: 2170
Merit: 1789
Most of the time people will recommend you consolidate your input so you can make your transaction cheaper. If privacy is your concern then you can learn and use coinjoin or a mixer (not a random mixer since they can just scam you). In my case, I always consolidate my inputs and then let Electrum decide how to split it when I make a TX.
newbie
Activity: 17
Merit: 4
What order should I follow when creating a transaction

Is there any standard or recommendation on how to join coins in order to send a particular amount?
Do you add base on oldest to newest? (or viceversa)
Do you add them based on amount, meaning lowest to highest (or viceversa)?
Do you randomly pick until you add-up enough for the total to send?

Thanks
angelo
Jump to: