Questions tagged [coin-selection]

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

Filter by
Sorted by
Tagged with
4 votes
1 answer
135 views

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 ...
user avatar
  • 63.5k
1 vote
1 answer
81 views

Is there a concept of tolerance used in coin selection algos in Bitcoin Core?

Does any of the coin selection algorithms used in Bitcoin Core use 'tolerance' in it? Context: Tolerance here is used for the amount that can be added to fees. In case of BnB if the user does not have ...
user avatar
0 votes
0 answers
21 views

Bitcoin UTxO sppend smaller or bigger [duplicate]

I'm building bitcoin wallet and i'm not sure if it's better to spend smaller UTxO first or bigger UTxO?
user avatar
3 votes
1 answer
237 views

Why are there round numbers after the fees and no change?

I am looking into a cluster of addresses that seem to be repeatedly sending transactions with a round number output and no change. How/why is this happening? For example c809850a2d8b… and 718fd33c7307…...
user avatar
  • 48
3 votes
2 answers
72 views

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&...
user avatar
1 vote
1 answer
43 views

Testing `avoidpartialspends` option in Bitcoin Core

I have lot of UTXOs in a test wallet (Bitcoin Core v0.21.1). Sent random amounts to same address in 9 transactions. So tb1qyqd9p9d2rc5a9v6cphucn999ljfcvdhymthypy has 9 UTXOs: Saved avoidpartialspends=...
user avatar
1 vote
2 answers
205 views

How does a wallet decide which utxo to use?

I am using a cold wallet and made a few tx two days ago. However, though what I wanted to send was a very small amount of btc, the wallet made multiple utxo of huge amounts get involved and now all my ...
user avatar
  • 11
3 votes
1 answer
250 views

bitcoin-core automatic coin selection

for business reason i need to use the bitcoin-core (v0.20.1) automatic coin selection feature and few days ago i saw a transaction come out that left me puzzled, it was like that: input 0.00017[...]...
user avatar
0 votes
2 answers
61 views

Address Reuse vs. Coin Selection

I have read at length that address reuse should be avoided, for instance the bitcoin wiki describes numerous reasons here. I have also read Murch's master thesis on coin selection. These two concepts ...
user avatar
  • 320
1 vote
1 answer
96 views

why is BnB coin selection algorithm not enabled by default?

BnB is one of the best coin selection algorithms existing and its implementation is in the Bitcoin source code. But as seen from this line: https://github.com/bitcoin/bitcoin/blob/...
user avatar
  • 189
9 votes
3 answers
938 views

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 ...
user avatar
  • 689
4 votes
2 answers
71 views

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 ...
user avatar
  • 447
4 votes
1 answer
182 views

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 ...
user avatar
  • 63.5k
2 votes
1 answer
525 views

Coin selection algorithm

Playing around with Bitcoin Core Client v0.18.0, I used this command: $ bitcoin-cli sendtoaddress "mozazucvLK179u41bF5Vd2Agp4wsm7HsPo" 0.1 which created this transaction. I noticed that the ...
user avatar
1 vote
1 answer
108 views

How does a Bitcoin (Core) wallet use inputs?

When creating a new transaction, how does the Bitcoin Core wallet (or any other wallet) handle/use the outputs (UTXO's)? e.g. when 2 outputs have to be used, will Bitcoin spend the highest address (...
user avatar
  • 71
1 vote
1 answer
278 views

What's partial spending? What does avoidpartialspend do?

Group outputs by address, selecting all or none, instead of selecting on a per-output basis. Privacy is improved as an address is only used once (unless someone sends to it after spending from it), ...
user avatar
5 votes
1 answer
362 views

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 ...
user avatar
1 vote
2 answers
247 views

How would I need to change ElectrumX to use FIFO selection of UTXOs?

By default, UTXOs are picked randomly in ElectrumX. I want to change this behaviour and spend UTXOs on 'FIFO' basis. What changes do I need to make?
user avatar
3 votes
1 answer
98 views

How do Schnorr signatures impact coin selection and the utxo growth?

Will Schnorr signature incentivise different practices in coin selection? How do they impact the utxo set in the long run?
user avatar
5 votes
2 answers
532 views

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 ...
user avatar
1 vote
1 answer
518 views

How to get unspents for inputs using bitcoinjs-lib?

I would like my simple wallet app to automatically select UTXOs for inputs. I realize that I can't accomplish this with just bitcoinjs, but is there something I can add to it to keep track of unspents?...
user avatar
2 votes
2 answers
86 views

coin selection - why selecting transactions with confirmations first better

I know that selecting transactions with confirmations first are much better than spending transactions with 0 confirmations direct. But why is that?
user avatar
  • 3,569
2 votes
4 answers
3k views

Why do some transactions have more than one input?

I know a normal transaction has 1 input and 2 outputs (if there is change that is the second output). But what about this scenario? Lets say I'm withdrawing bitcoin from my gemini account and want ...
user avatar
5 votes
2 answers
6k views

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 ...
user avatar
  • 53
3 votes
1 answer
557 views

Coin selection algorithm in Python to optimally select UTXO

Does anyone know of a good coin selection algorithm in Python that's perhaps similar to the one in Bitcoin Core (currently this: github/bitcoin/src/wallet.cpp (per guidance from stackexchange/1077))? ...
user avatar
  • 231
2 votes
1 answer
244 views

How does the Coin Selection in Bitcoin Wallet for Android work?

What is the algorithm in Bitcoin Wallet for Android to select the inputs to create a new transaction?
user avatar
  • 63.5k
5 votes
3 answers
347 views

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?
user avatar
  • 63.5k
5 votes
2 answers
424 views

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....
user avatar
  • 389
4 votes
2 answers
350 views

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?
user avatar
  • 63.5k
1 vote
1 answer
583 views

Do all UTXO get moved to the newest change address?

There is one thing I do not understand about unspent outputs and change addresses. For example, let's say a person has 5BTC in a wallet, and they have 2 unspent outputs of 3BTC and 2BTC. They one ...
user avatar
2 votes
1 answer
206 views

How to spend bitcoins From Account and specify Fee

I am writing an application that uses bitcoin wallet accounts to specify what addresses belong to what user. I have been reading the documentation trying to find a way to spend Bitcoins specifying the ...
user avatar
2 votes
1 answer
116 views

What order does Bitcoin Core place the inputs it spends in?

What order does Bitcoin core place the inputs it spends in? Is it random? Is it sorted by anything? What, if anything, can you tell about the originator of a transaction by the input ordering?
user avatar
  • 28.7k
10 votes
2 answers
9k views

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?
user avatar
  • 4,307
7 votes
1 answer
2k views

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 ...
user avatar
  • 13.7k
9 votes
3 answers
663 views

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 ...
user avatar
  • 4,731
45 votes
2 answers
8k views

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 ...
user avatar