Bitcoin Forum
April 01, 2026, 10:05:31 PM *
News: Latest Bitcoin Core release: 30.2 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How does Bitcoin Core select UTXOs during transactions?  (Read 203 times)
Diteeru (OP)
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
March 13, 2025, 09:23:31 PM
 #1

I've been researching about Bitcoin's UTXO (Unspent Transaction Output) selection process and optimization, and I need some enlightenments on the subject matter.

For instance, in Bitcoin Core, what algorithm does a wallet use in selecting which UTXOs to prioritise during a transaction to lower fees and avoid dust output?

Also, are there ways I could influence the UTXO selection process manually?
nc50lc
Legendary
*
Offline Offline

Activity: 3094
Merit: 8539


Self-proclaimed Genius


View Profile
March 14, 2025, 03:37:19 AM
Merited by vapourminer (4), LoyceV (4), ABCbits (2)
 #2

These should help with your research, the actual algorithm Bitcoin Core use (links are for v29.x branch):

Read the conveniently placed comments in the lines of codes and those should already answer most of your questions.
Plus a bonus if you can read the code.

███████████████████████████
███████▄████████████▄██████
████████▄████████▄████████
███▀█████▀▄███▄▀█████▀███
█████▀█▀▄██▀▀▀██▄▀█▀█████
███████▄███████████▄███████
███████████████████████████
███████▀███████████▀███████
████▄██▄▀██▄▄▄██▀▄██▄████
████▄████▄▀███▀▄████▄████
██▄███▀▀█▀██████▀█▀███▄███
██▀█▀████████████████▀█▀███
███████████████████████████
.
.Duelbits PREDICT..
█████████████████████████
█████████████████████████
███████████▀▀░░░░▀▀██████
██████████░░▄████▄░░████
█████████░░████████░░████
█████████░░████████░░████
█████████▄▀██████▀▄████
████████▀▀░░░▀▀▀▀░░▄█████
██████▀░░░░██▄▄▄▄████████
████▀░░░░▄███████████████
█████▄▄█████████████████
█████████████████████████
█████████████████████████
.
.WHERE EVERYTHING IS A MARKET..
█████
██
██







██
██
██████
Will Bitcoin hit $200,000
before January 1st 2027?

    No @1.15         Yes @6.00    
█████
██
██







██
██
██████

  CHECK MORE > 
LoyceV
Legendary
*
Offline Offline

Activity: 4004
Merit: 21515


Thick-Skinned Gang Leader and Golden Feather 2021


View Profile WWW
March 14, 2025, 08:33:02 AM
 #3

Also, are there ways I could influence the UTXO selection process manually?
Enable coin control (under Options) to manually select Inputs when Sending a transaction.

I can't tell you how Bitcoin Core selects inputs, but I prefer to do it manually anyway. You may want to read my topic on consolidating small inputs. Doing this when fees are low can save a lot later on.

¡uʍop ǝpᴉsdn pɐǝɥ ɹnoʎ ɥʇᴉʍ ʎuunɟ ʞool no⅄
takuma sato
Hero Member
*****
Offline Offline

Activity: 825
Merit: 735


View Profile
March 15, 2025, 04:57:17 AM
Merited by Forsyth Jones (1)
 #4

I like Bitcoin Core above all other wallet software because of the Coin Control among other things. Click there:



And then simply click the coins you want to move:



This way you will have full control. I don't understand how people send transactions without doing this. You don't have privacy unless you control what utxos you are using to send. If you don't then the program should automatically send whatever utxos lead to the less tx size by selecting amounts that are closer to the amount you are sending.
Bitcoin Smith
Hero Member
*****
Offline Offline

Activity: 1596
Merit: 656


Zap Zap


View Profile WWW
March 15, 2025, 05:59:51 PM
 #5

I like Bitcoin Core above all other wallet software because of the Coin Control among other things. Click there:


This way you will have full control. I don't understand how people send transactions without doing this. You don't have privacy unless you control what utxos you are using to send. If you don't then the program should automatically send whatever utxos lead to the less tx size by selecting amounts that are closer to the amount you are sending.

We don't really need Bitcoin core just to have the coin control feature, it is even available in.SPV wallets like Electrum desktop. And the default utxos selection doesn't always be the cheaper TX fees that's why we can send a TX with lowest possible size while using coin control.

When we seek privacy than having a node is mandatory, we don't have to rely on third-party nodes to validate our transactions.

Forsyth Jones
Legendary
*
Offline Offline

Activity: 1848
Merit: 2022


I love Bitcoin!


View Profile WWW
March 15, 2025, 11:05:29 PM
Merited by Pmalek (2)
 #6

One thing I think is really cool about Bitcoin Core is that it's the only wallet that handles the change address based on the address script type: legacy, nested-segwit, bech32, etc. If your transaction has remaining bitcoins to be sent to your change address, the change address chosen will be the same address script type as the recipient's address.

e.g if you sent funds to a legacy address, your change address (if any) will also be a legacy address. This helps a lot with privacy and all of this is done by default, you can change it according to what you think is best.

███████████████████████████
███████▄████████████▄██████
████████▄████████▄████████
███▀█████▀▄███▄▀█████▀███
█████▀█▀▄██▀▀▀██▄▀█▀█████
███████▄███████████▄███████
███████████████████████████
███████▀███████████▀███████
████▄██▄▀██▄▄▄██▀▄██▄████
████▄████▄▀███▀▄████▄████
██▄███▀▀█▀██████▀█▀███▄███
██▀█▀████████████████▀█▀███
███████████████████████████
.
.Duelbits PREDICT..
█████████████████████████
█████████████████████████
███████████▀▀░░░░▀▀██████
██████████░░▄████▄░░████
█████████░░████████░░████
█████████░░████████░░████
█████████▄▀██████▀▄████
████████▀▀░░░▀▀▀▀░░▄█████
██████▀░░░░██▄▄▄▄████████
████▀░░░░▄███████████████
█████▄▄█████████████████
█████████████████████████
█████████████████████████
.
.WHERE EVERYTHING IS A MARKET..
█████
██
██







██
██
██████
Will Bitcoin hit $200,000
before January 1st 2027?

    No @1.15         Yes @6.00    
█████
██
██







██
██
██████

  CHECK MORE > 
nc50lc
Legendary
*
Offline Offline

Activity: 3094
Merit: 8539


Self-proclaimed Genius


View Profile
March 16, 2025, 07:02:27 AM
Merited by Pmalek (2)
 #7

One thing I think is really cool about Bitcoin Core is that it's the only wallet that handles the change address based on the address script type: legacy, nested-segwit, bech32, etc. If your transaction has remaining bitcoins to be sent to your change address, the change address chosen will be the same address script type as the recipient's address.
It's not the only one, I can name two:

First is Mycelium with its default "Privacy Guard" change handling option, that will do that except of course if the output is Taproot which it can't generate.

Second is Armory which will try to match the output's script type if set to "Auto-change" (not set by default),
Although its "P2SH" is "P2SH-P2PK" which is not commonly used by other clients, the output will look the same as any P2SH outputs.

███████████████████████████
███████▄████████████▄██████
████████▄████████▄████████
███▀█████▀▄███▄▀█████▀███
█████▀█▀▄██▀▀▀██▄▀█▀█████
███████▄███████████▄███████
███████████████████████████
███████▀███████████▀███████
████▄██▄▀██▄▄▄██▀▄██▄████
████▄████▄▀███▀▄████▄████
██▄███▀▀█▀██████▀█▀███▄███
██▀█▀████████████████▀█▀███
███████████████████████████
.
.Duelbits PREDICT..
█████████████████████████
█████████████████████████
███████████▀▀░░░░▀▀██████
██████████░░▄████▄░░████
█████████░░████████░░████
█████████░░████████░░████
█████████▄▀██████▀▄████
████████▀▀░░░▀▀▀▀░░▄█████
██████▀░░░░██▄▄▄▄████████
████▀░░░░▄███████████████
█████▄▄█████████████████
█████████████████████████
█████████████████████████
.
.WHERE EVERYTHING IS A MARKET..
█████
██
██







██
██
██████
Will Bitcoin hit $200,000
before January 1st 2027?

    No @1.15         Yes @6.00    
█████
██
██







██
██
██████

  CHECK MORE > 
Pmalek
Legendary
*
Offline Offline

Activity: 3444
Merit: 9104



View Profile
March 16, 2025, 09:21:37 AM
 #8

I like Bitcoin Core above all other wallet software because of the Coin Control among other things.
Coin control has become a standard nowadays. It's like saying, I like car X because it has air conditioning. If your chosen wallet software doesn't have coin control in 2025, you should abandon it and select one that does. Bitcoin Core doesn't do anything special in this case. In fact, it's different from other wallets in that you can't backup your seed phrase, making it a bit more challenging to make back-ups. Its biggest feature is the (full) node capability and being the one that validates and verifies everything personally instead of relying on others to do it.

Forsyth Jones
Legendary
*
Offline Offline

Activity: 1848
Merit: 2022


I love Bitcoin!


View Profile WWW
March 17, 2025, 09:02:05 PM
 #9

It's not the only one, I can name two:

First is Mycelium with its default "Privacy Guard" change handling option, that will do that except of course if the output is Taproot which it can't generate.

Second is Armory which will try to match the output's script type if set to "Auto-change" (not set by default),
Although its "P2SH" is "P2SH-P2PK" which is not commonly used by other clients, the output will look the same as any P2SH outputs.

Thanks, I just remembered Mycelium, it's the wallet I liked to use the most on Android, that is, I haven't used it for years. But I know it offers 3 types of address scripts, that’s what I’d like to see in other wallets.

Another wallet that supports three types of receiving address scripts is Coinomi (it hasn't bech32m addresses), but I’m not sure if it handles change addresses using the same script type as the output reserved for the sender. Although Coinomi is closed source.

I’ve never used Armory, but I know it’s an excellent advanced wallet, but there are rumors on the forum that the devs would resume its development.

███████████████████████████
███████▄████████████▄██████
████████▄████████▄████████
███▀█████▀▄███▄▀█████▀███
█████▀█▀▄██▀▀▀██▄▀█▀█████
███████▄███████████▄███████
███████████████████████████
███████▀███████████▀███████
████▄██▄▀██▄▄▄██▀▄██▄████
████▄████▄▀███▀▄████▄████
██▄███▀▀█▀██████▀█▀███▄███
██▀█▀████████████████▀█▀███
███████████████████████████
.
.Duelbits PREDICT..
█████████████████████████
█████████████████████████
███████████▀▀░░░░▀▀██████
██████████░░▄████▄░░████
█████████░░████████░░████
█████████░░████████░░████
█████████▄▀██████▀▄████
████████▀▀░░░▀▀▀▀░░▄█████
██████▀░░░░██▄▄▄▄████████
████▀░░░░▄███████████████
█████▄▄█████████████████
█████████████████████████
█████████████████████████
.
.WHERE EVERYTHING IS A MARKET..
█████
██
██







██
██
██████
Will Bitcoin hit $200,000
before January 1st 2027?

    No @1.15         Yes @6.00    
█████
██
██







██
██
██████

  CHECK MORE > 
nc50lc
Legendary
*
Offline Offline

Activity: 3094
Merit: 8539


Self-proclaimed Genius


View Profile
March 18, 2025, 04:47:27 AM
 #10

I’ve never used Armory, but I know it’s an excellent advanced wallet, but there are rumors on the forum that the devs would resume its development.
I'll get off topic but: It's been in constant development since the last release.
It's just going very slowly because there's little to no support from other developers, it's mostly being maintained by a one-man team.

Dev branch: github.com/goatpig/BitcoinArmory/tree/dev
Master branch: github.com/goatpig/BitcoinArmory/tree/master (there are recent commits and PRs from lu-p-us)

███████████████████████████
███████▄████████████▄██████
████████▄████████▄████████
███▀█████▀▄███▄▀█████▀███
█████▀█▀▄██▀▀▀██▄▀█▀█████
███████▄███████████▄███████
███████████████████████████
███████▀███████████▀███████
████▄██▄▀██▄▄▄██▀▄██▄████
████▄████▄▀███▀▄████▄████
██▄███▀▀█▀██████▀█▀███▄███
██▀█▀████████████████▀█▀███
███████████████████████████
.
.Duelbits PREDICT..
█████████████████████████
█████████████████████████
███████████▀▀░░░░▀▀██████
██████████░░▄████▄░░████
█████████░░████████░░████
█████████░░████████░░████
█████████▄▀██████▀▄████
████████▀▀░░░▀▀▀▀░░▄█████
██████▀░░░░██▄▄▄▄████████
████▀░░░░▄███████████████
█████▄▄█████████████████
█████████████████████████
█████████████████████████
.
.WHERE EVERYTHING IS A MARKET..
█████
██
██







██
██
██████
Will Bitcoin hit $200,000
before January 1st 2027?

    No @1.15         Yes @6.00    
█████
██
██







██
██
██████

  CHECK MORE > 
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!