Hot answers tagged

27 votes
Accepted

How big is the UTXO database?

Bitcoin Core provides the gettxoutsetinfo RPC that has exactly the information you want. Note, it takes that call up to a minute or two to run (and maybe longer as the UTXO set keeps growing). Here'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 ...
user avatar
  • 16.5k
22 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/...
user avatar
17 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, ...
user avatar
17 votes
Accepted

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

Goals of Coin Selection The challenge for picking a Coin Selection algorithm is that there are multiple goals to optimize for: Privacy A wallet's default behavior should be reasonable conducive to the ...
user avatar
  • 64.5k
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 ...
user avatar
  • 8,804
14 votes
Accepted

Why does Bitcoin store all transaction inputs and outputs, instead of just an "account/balance" ledger?

In order to be sure that an address balance is correct, you need to check that all the transactions on that address are valid. So in order to generate a list of addresses and balances that you trust, ...
user avatar
14 votes
Accepted

How is a Transaction Output Marked as Spent?

Every full Bitcoin node maintains a database of which unspent outputs are left. When verifying a transaction, all its inputs are fetched from the database. If one is missing, validation fails. Among ...
user avatar
12 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 ...
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 ...
user avatar
9 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 ...
user avatar
8 votes
Accepted

Why is it not possible to replay transactions?

Transaction inputs use Unspent Transaction Outputs (UTXO). UTXO are created by transactions. They are uniquely identified by the transaction id and the output position in the transaction that created ...
user avatar
  • 64.5k
8 votes

How to check if an output has been spent?

If gettxout returns something, the output is unspent. If it returns nothing, the output either never existed or is spent. You do not need -txindex for this.
user avatar
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 ...
user avatar
  • 64.5k
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 ...
user avatar
  • 1,814
7 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 ...
user avatar
  • 64.5k
7 votes
Accepted

Why does bitcoind use a fork of LevelDB for key-value storage?

The fork serves two purposes: Local modifications that are hard to bring upstream: Windows support (which is partially based on the existing Windows port, but needed changes for building in MinGW) ...
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 ...
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 ...
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 ...
user avatar
7 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 ...
user avatar
6 votes
Accepted

Why must UTXO be completely consumed?

I've looked into this before, and I've never been able to find an explicit rationale from Satoshi, but there are a couple of possible reasons. For: Simplifies SPV verification Imagine that rather than ...
user avatar
  • 28.7k
6 votes
Accepted

How is it possible to say that a bitcoin was fully spent?

An output ("coin") is by definition either fully unspent or completely spent. There is nothing in between. A transaction has one or more inputs (which refer to the unspent outputs of earlier ...
user avatar
  • 6,208
6 votes
Accepted

How long is a Bitcoin?

A bitcoin is not a piece of data, and therefore does not have a length. A bitcoin, the unit of currency, is just like any other unit of measurement. It wouldn't make sense to ask "how much data is a ...
user avatar
  • 8,734
6 votes

Transaction with Multiple Inputs having Same Address

Inputs do not refer to addresses, but rather unspent transaction outputs (UTXOs). If there are multiple UTXOs payable to the same address, then a transaction spending those UTXOs will have to list ...
user avatar
  • 8,734
6 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, ...
user avatar
  • 64.5k
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 ...
user avatar
  • 11.4k
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 ...
user avatar
  • 1,264
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 ...
user avatar
  • 17.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) + ...
user avatar
  • 2,712

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