Questions tagged [coin-selection]

Deals with topics of algorithms and schemes to pick which UTXO to fund a transaction with.

Filter by
Sorted by
Tagged with
1
vote
1answer
468 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?...
4
votes
1answer
220 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…...
3
votes
2answers
48 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&...
1
vote
1answer
33 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=...
0
votes
0answers
25 views

Coin selection algorithm using Python and Bitcoin Core JSON-RPC

I am looking for the easiest way to implement this using Python: Save all the amount of UTXOs in an array(not sure if tuple or list or set or dictionary) User wants to send 0.1 BTC, won't pay more ...
5
votes
1answer
1k 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 ...
1
vote
2answers
84 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 ...
3
votes
1answer
158 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[...]...
0
votes
2answers
43 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 ...
1
vote
1answer
85 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/...
3
votes
1answer
93 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?
10
votes
2answers
8k 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?
9
votes
3answers
899 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 ...
4
votes
2answers
61 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 ...
4
votes
1answer
159 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 ...
43
votes
2answers
7k 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 ...
2
votes
1answer
440 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 ...
1
vote
1answer
90 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 (...
5
votes
2answers
495 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 ...
1
vote
1answer
241 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), ...
4
votes
1answer
286 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 ...
1
vote
2answers
236 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?
2
votes
4answers
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 ...
2
votes
2answers
81 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?
5
votes
2answers
408 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....
4
votes
2answers
343 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?
5
votes
2answers
5k 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 ...
9
votes
3answers
648 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 ...
2
votes
1answer
238 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?
3
votes
1answer
527 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))? ...
5
votes
3answers
317 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?
1
vote
1answer
478 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 ...
2
votes
1answer
197 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 ...
2
votes
1answer
112 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?