Skip to main content
23 votes
Accepted

UTXO model vs. account/balance model

The choice between the UTXO model and the balance model is primarily one between privacy incentives and apparent intuitiveness. If one follows the standard advice of not reusing addresses/outputs/...
Pieter Wuille's user avatar
23 votes
Accepted

Why is there "Change" in Bitcoins?

Bitcoin follows a Unspent Transaction Output (utxo) model. Our modern banking systems follow an account model - you're assigned a bank account number (similar to an address), and send and receive ...
Raghav Sood's user avatar
  • 17.3k
19 votes

Where is the UTXO data stored?

I assume this question is about Bitcoin Core's internal operations. This description is valid for version 0.8 and later (up to 0.14 at least). One part of the system deals with the active chain, ...
Pieter Wuille's user avatar
15 votes
Accepted

With 100% segwit transactions, what would be the max number of transaction confirmation possible on a block?

Very interesting question, let's see what the smallest transaction we can build is. For it to be minimal it has to be a single input and a single output. The non-segwit part would look something like ...
cdecker's user avatar
  • 9,563
14 votes
Accepted

Why is Bitcoin Core using LevelDB instead of Redis or SQLite?

Redis and LevelDB solve very different problems. We tried using SQLite and its performance was abysmal. Bitcoin Core needs a database to store the set of unspent transaction outputs (UTXOs). This ...
Pieter Wuille's user avatar
11 votes

Why is there "Change" in Bitcoins?

There are a lot of good answers, but I want to point out the most obvious answer. Say you have 1 bitcoin and you send 0.2 bitcoin to me and the design leaves it so that you still have 0.8 bitcoin in ...
David Schwartz's user avatar
10 votes
Accepted

How to find all UTXOs?

With vanilla Bitcoin Core, there is no efficient way to do this. I see two options: a) Slow and very inefficient RPC loop (not recommended) Get the genesis block hash (RPC getblockhash 0) Get the ...
Jonas Schnelli's user avatar
9 votes
Accepted

When does Bitcoin update the UTXO set?

This is implementation dependent, but in Bitcoin Core there is not just a single UTXO set: The UTXO set on disk in the chainstate/ directory in a database. It corresponds to the state as of the last ...
Pieter Wuille's user avatar
9 votes
Accepted

How can I cheaply consolidate P2PKH outputs?

There really is no better answer than "wait for fees to come down". That might not be the most satisfying answer, but fees were below 2 sat/vB only a month ago, and the vast majority of ...
Vojtěch Strnad's user avatar
8 votes
Accepted

How is the UTXO database initialized?

The UTXO database starts empty and then is updated while the blockchain is parsed in the manner that you described. Only, there can be more than one input and more than one output for a transaction, ...
Murch's user avatar
  • 77.8k
8 votes

What is an "unspent output"?

Bitcoin is a distributed system that enables users to receive, store, and send money. Value is transmitted by submitting a payment order to the network called a transaction. Transactions are ...
Murch's user avatar
  • 77.8k
8 votes
Accepted

Do all Tx's have UTXO?

Transactions are money orders to the Bitcoin network that reassign value from one owner to another. To that end, transactions reference pieces of Bitcoin in the inputs and reassign this value to ...
Murch's user avatar
  • 77.8k
8 votes

Do UTXO's ever get consolidated to avoid complexitity?

When you pay someone using a number of utxo's to fund your payment, the output being created is a new single utxo with the total amount of all those input (minus change and fees). Effectively, you ...
arubi's user avatar
  • 1,864
8 votes
Accepted

How is the balance of a Bitcoin address quickly calculated?

At the protocol level, Bitcoin has no concept of "balances" or "addresses", and their common interpretation isn't relevant during verification. Every transaction spends "coins&...
Pieter Wuille's user avatar
7 votes
Accepted

Will all UTXOs eventually be worth 1 Satoshi?

Can two UTXOs ever be combined into one UTXO? Yes, absolutely. Each transaction can have any number of inputs and outputs; it can certainly have fewer outputs than inputs. Here for example is a ...
Nate Eldredge's user avatar
7 votes

utxo vs account-model

The primary advantages of the UTXO model are simplicity of implementation and improved privacy. With the UTXO model, transactions just consume some UTXOs and create some UTXOs. This tight constraint ...
David Schwartz's user avatar
7 votes
Accepted

Do confidential transactions produce an UTXO

In Confidential Transactions (as used in Blockstream's Elements and Liquid), there are still identifiable UTXOs. The only change is that instead of the amount, a homomorphic commitment to the amount ...
Pieter Wuille's user avatar
7 votes

How bitcoin nodes update UTXO set when their latests blocks are replaced?

Bitcoin Core since v0.8 maintains "undo files" that contain the information necessary to undo the effect of a block on the UTXO set. In a way you can see blocks as authenticated patches to be applied ...
Pieter Wuille's user avatar
7 votes

What was the longest held UTXO ever spent?

As of June 19 2019, using the following query: bitcoin-indexer=> select reverse_bytes(output_tx.hash_id || output_tx.hash_rest), output.tx_idx, output_tx.current_height, input_tx.current_height,...
dpc.pw's user avatar
  • 311
7 votes
Accepted

Best way to find list of UTXO related to xpub

The balance checks are cut short based on a gap limit. A gap limit is usually set to 20, and is defined as a consecutive block of addresses with no transactions. Since HD wallets only give out a new ...
Raghav Sood's user avatar
  • 17.3k
7 votes

How many useable UTXOs are possible with BTC inside them?

There are currently already about 84.3M UTXOs. The consensus rules don't restrict the UTXO set size except that the UTXO set growth is delimited by the available blockspace. The smallest output type ...
Murch's user avatar
  • 77.8k
7 votes
Accepted

What was the largest UTXO ever created in bitcoin’s entire history?

No, the largest output ever created was 500,000 BTC: 29a3efd3ef04f9153d47a990bd7b048a4b2d213daaa5fb8ed670fb85f13bdbcf I used this Blockchair query to find out: https://blockchair.com/bitcoin/outputs?s=...
Vojtěch Strnad's user avatar
6 votes

Is the UTXO set computed from scratch by new full nodes?

The UTXO set cannot be validated, except by going through all blocks in history. The P2P protocol does not even have a way to stream the UTXO set from one node to another, so yes, full nodes will ...
Pieter Wuille's user avatar
6 votes

Why do some transactions have more than one input?

What might be confusing you, and which is a common misconception, is that the addresses themselves somehow "hold" the bitcoin balances, and gain and lose the coins via transactions. In fact all the ...
meshcollider's user avatar
  • 11.9k
6 votes
Accepted

Why has UTXO set stopped growing since 2017-06-03?

It's hard to know for sure what's been going on. My guess would be it's a mix of : Better coin selection algorithms used by large wallets (exchanges) Increase in fees pushed some inefficient services ...
alcio's user avatar
  • 1,274
6 votes
Accepted

a few questions about how HD wallet works

1) ...How's my total UTXO calculated?... Each node calculates it's own UTXO set, there is no single 'global UTOX set'. You may own some subset of the UTXOs, but there is no pooling. If you receive ...
chytrik's user avatar
  • 18.4k
6 votes
Accepted

What are the standard formats of transaction outputs?

AFAIK there are 5 different standard non-SegWit transaction types, and 4 SegWit ones. Non-SegWit: Pay to public key (P2PK) PUSH (1 byte) + <compressed/uncompressed_pk> (33/65 bytes) + ...
sr_gi's user avatar
  • 3,260
6 votes
Accepted

How does the wallet identify which UTXOs belong to a public address while creating a new transaction?

A Transaction output has a field for amount and a locking script but no direct field for public address for which the output is meant. This is not quite correct and seems to be the source of the ...
David A. Harding's user avatar
6 votes
Accepted

How to cheaply melt many micro UTXOs?

There's no free lunch. You can spend all the UTXOs in one transaction to spread the output bytes across many inputs, but each input still needs a certain number of bytes. To my knowledge, there isn'...
Nate Eldredge's user avatar
6 votes
Accepted

Why is there no such thing as a redirected, forged, or fake transaction?

The Bitcoin protocol follows a Unspent Transaction Output system to track the existence and state of all Bitcoin in the system. These are known as UTXOs. All transactions that transfer Bitcoin do so ...
Raghav Sood's user avatar
  • 17.3k

Only top scored, non community-wiki answers of a minimum length are eligible