Questions tagged [coin-selection]

Algorithms, schemes, and strategies used to determine which UTXOs are used to fund transactions.

40 questions
45
votes
2 answers

What is the coin selection algorithm?

When creating a transaction in the standard client, what is the algorithm used to determine which unspent outputs will be used as inputs? Has this changed since the first version? What different algorithms are used by alternative clients? Does the…
11
votes
2 answers

What does Bitcoin Core's "Coin Control Features" do and how do I use it?

What is Bitcoin Core's "Coin Control Features"? How do I use it, and what can I do with it?
Geremia
  • 4,469
  • 4
  • 37
  • 75
9
votes
3 answers

What's the most efficient way to create a raw transaction with a specific fee rate?

There seems to be a chicken and egg problem when it comes to creating a transaction that has a specific fee rate (sat/kW). In order to set a specific fee rate, you need to know what the total weight of a transaction will be. But in order to…
9
votes
3 answers

How can I control which coins to spend in a transaction?

When creating a bitcoin transaction, you have to choose which coins to use in them. The standard client does this in a way to avoid unconfirmed inputs and minimize the number of inputs and amount of change involved. Since not all coins are created…
Thilo
  • 4,751
  • 5
  • 25
  • 37
8
votes
3 answers

Why is the witness data fee discounted by a factor of four?

I've read that it encourages users to consolidate UTXO sets. How would it be doing that?
Murch
  • 71,155
  • 33
  • 180
  • 600
8
votes
1 answer

What are the trade-offs between the different algorithms for deciding which UTXOs to spend?

When someone would like to make a transaction, their software has to choose which of their UTXOs to spend. Here are a few different ways that one might prioritize which UTXOs get spent. Oldest UTXOs first Newest UTXOs first UTXOs with the smallest…
morsecoder
  • 14,008
  • 2
  • 42
  • 92
6
votes
2 answers

Has UTXO selection methods changed since activation of Segwit?

Before Segwit, transactions were penalized higher fees for having more inputs than outputs due to the input size being larger despite those transactions actually decreasing the global UTXO set. Segwit corrects this incentive mismatch. Have wallets…
6
votes
2 answers

Which inputs will be spent?

Say someone holds 100,000 btc. Over time, this address has been spammed with dust by numerous parties. Now, the oldest funds come from the previous large transaction. If the dust is, say 0.0000101 btc, can someone send this exact amount…
5
votes
2 answers

Is there a way to determine the optimal size of a batched transaction to save on fees?

I've been looking at other questions about fees and batching, but it seems no one asked if there is some way to determine the optimal size of a transaction to save on fees (assuming all inputs are spending from segwit native UTXOs for…
Sosthène
  • 613
  • 3
  • 13
5
votes
1 answer

Are all UTXOs locked by an address spent in a transaction?

Imagine I have 2 UTXOs locked by my address, each of which allows me to spend 5 bitcoins. If I subsequently want to send just 2 bitcoins to someone else, will both UTXOs be used as inputs in the transaction, where I now receive 8 BTC change as a…
5
votes
2 answers

Send BTC with Electrum: which address is used?

I'm new to bitcoin and I've downloaded Electrum. I can see the new wallet generated a few addresses for me. If I want to receive BTC, I just need to give one of those addresses. But if I want to send BTC (using the Send tab), I don't see any field…
JDoe
  • 53
  • 1
  • 4
5
votes
1 answer

What does "Waste Metric" mean in the context of Coin Selection?

I was attending a Bitcoin Core PR review club, and in the context of the wallet behavior changes that were discussed, participants were mentioning something called "waste metric". Can someone explain what that is, what it's used for and why it was…
Murch
  • 71,155
  • 33
  • 180
  • 600
4
votes
1 answer

Is there a way to allow use of unconfirmed RBF outputs in transaction building?

Bitcoin Core seems to not consider unconfirmed outputs that are marked replaceable in input selection. Is there a way to override this protection and allow use anyway? The transaction is created using bitcoin-cli. Edit: Turns out the unconfirmed…
4
votes
2 answers

How does Bitcoin Core's Coin Selection prevent change to be a dust output?

Bitcoin Core's Coin Selection optimizes for minimal change outputs. How does Bitcoin Core prevent Change outputs of sizes below dust threshold from occurring?
Murch
  • 71,155
  • 33
  • 180
  • 600
4
votes
2 answers

Is there a way to avoid sendtoaddress from "sweeping"?

I have a wallet that has several hundred small amounts residing at multiple addresses. I noticed yesterday that, when sending a relatively small amount to a third party that the bitcoind "swept" about 47 of those small amounts together as vin…
1
2 3