36

The wiki is correct, it is a technicality. Bitcoin "balances" are actually just unspent transaction outputs (UTXOs, from previous transactions) which you have the ability to spend. In most cases, that means knowing the private key corresponding to an address which the transaction was sent to. But the address itself doesn't have a balance, it just "locks up" ...


16

Bitcoin addresses do not actually exist on the Bitcoin network. They are an abstraction for humans to be able to easily send money to each other. What Bitcoin actually uses are transaction outputs. A transaction creates outputs which consist of the value and the output script. When you send money to someone, you are spending from an Unspent Transaction ...


7

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 are consolidating utxo's as inputs to fund your payment. UTXO consolidation and breakage happens all the time by normal payments and doesn't usually require ...


6

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 to the UTXO set; they list new outputs to be added, and which inputs to be spent. In order to support rolling back the UTXO set, undo blocks are created as a ...


5

You are right, and it seems this answer is outdated. The concept of a UTXO set is more recent than Bitcoin itself. The original software kept a database with information on every transaction output ever created, including whether it was already spent. In that setting, the UTXO set was only defined implicitly by the spentness information in that database. ...


5

Yes, they do. You're right, generally, the size of UTXO Set has been growing over the years. E.g. in May 2014 it was 11 million, in May 2015 it was 19 million, May 2016 it was 38 million, in May 2017 it was 51 million. Now, there are actually fewer than 50 million UTXO. How did that happen? As you noticed, spending a lot of UTXO in a single transaction is ...


4

The transaction ID and output index of the second 1 BTC that was sent to A's address will be different from the first 1 BTC that was sent there. Since transactions refer to inputs by their txid and output index, the signature used in the first transaction will not be valid for another tx trying to spend the second deposit. Additionally, depending on the ...


4

Bitcoin Core's client has recently applied changes to their coin selection algorithms based on Murch's Master's thesis.


4

When exactly an entry is added to the set of unspent transactions outputs? When exactly an entry is removed from the set of unspent transactions outputs? The answer to these questions is that there is no singular set of unspent transaction outputs. There are multiple versions that are maintained and/or implied for different purposes. 1) There is the ...


4

Once spent, the wallet removes the UTXO from its cache of unspent transactions. The transaction is not removed from the general database (the blockchain or block index). Full nodes running with txindex=1 keep every transaction forever. Some wallets though optimize the database to recover disk space - but this is a wallet-specific optimization and not part of ...


4

A transaction is confirmed when it is included in a block, so you will need to watch for a message that alerts your node (or whatever software you are using to watch the P2P gossip traffic) to a new block, that includes the transaction in question. It doesn't matter if a node run by a miner relays your transaction to other nodes on the network, it only ...


3

Yes, Bitcoin Core does do some compression of standard output scripts in order to store the minimal amount of data needed. Anyway, would I be correct in assuming that you could only get an address from script types 0 and 1 (by base58 encoding the script data)? Yes In other words, the chainstate leveldb does not include any witness data to allow you ...


3

When you say "transactions", I assume you mean "transaction output". It is literally not possible to have a transaction output that is larger than the transaction size limit. Otherwise the transaction containing that output would not be in the blockchain. Rather I think what you are looking for is that the output script is larger than the ...


3

The sizes you give don't match the paper. I can't even find mention of the sizes you give in the paper itself. Those sizes are incredibly wrong and way too large. They seem to be for input sizes, not output sizes. Input sizes are irrelevant to the UTXO set. P2PKH are 21 bytes, P2SH are 21 bytes, P2PK are 33 bytes, everything else is their actual script size....


3

Does it check every block in between where the UTXO first appeared and the current time to make sure it didn't get spent then? Yes, but this check is not done for each UTXO individually as transactions come in, it is an ongoing process that specifies the current state of the network. A bitcoin node will independently work through the entire transaction ...


3

If we take a step back and think about it, what are we more interested in? The compiled history of all payments, or the current state of the network's balances? Obviously, the latter is more useful for anyone that wants to transact on the network. The UTXO set allows to check whether someone is able to pay, and upon update whether we were paid. The ...


3

Segwit corrects this incentive mismatch. Segwit only improves the ratio, but outputs are still cheaper than inputs even with segwit. As sr-gi mentioned in his answer, the Branch and Bound algorithm was recently merged to the Bitcoin Core master branch. The Branch and Bound algorithm searches the complete combination space of a wallet's UTXO pool to find ...


3

Every full node keeps track of all unspent transaction outputs (UTXO). UTXO are identified via their outpoint txid:vout, where txid is the transaction identifier of the transaction that created it, and vout is the output position within this transaction. Transaction ids are generally unique, and thus each outpoint can only occur once as well.¹ To spend any ...


3

It appears to largely be just a belt-and-suspenders check. As you say, it is unnecessary to do this check. However it doesn't hurt to have this check in there. At worst, it just adds a few nanoseconds to verification time. At best, it will catch some serious bugs. Given that this is consensus related, it does not hurt to have extra checks that are ...


3

You're right, your wallet is only holding your private keys and tracking the unspent transaction outputs that you're able to sign for. The UTXOs are also tracked by every full node on the network, which have digested the complete transactional history of the network to learn exactly which pieces of the currency are currently available for spending. As long ...


3

UTXO stands for Unspent Transaction Outputs. Thus, a node only keeps track of transaction outputs that are unspent. As soon as a transaction (even an unconfirmed one) consumes a UTXO, it is removed from the UTXO db (if the tx is dropped, it is added back). What I think is ,they should be removed from the memory pool. The mempool is a list of unconfirmed ...


2

First of, each node on the network maintains an UTXO-set. Not only miners. to 1. The UTXO-set is created by applying all transactions in each block in the chain from the beginning. All transactions that remain unspent when reaching the chain tip are in the UTXO-set. The older a block, the higher the probability that the whole network has a equal block. ...


2

Most of the full nodes are operating on normal CPUs which is now basically ineffective for mining. The mining process is handled by specific mining pools. So for full nodes that basically sees the same blockchain (there might be inconsistencies at the tip if two blocks are mined at the same time), they have the same UTXO set. This is because the UTXO set is ...


2

There is no way to enable faster querying for arbitrary addresses than scantxoutset in bitcoind. Explorers provide this functionality by maintaining a separate database of all addresses and transactions which is optimized for that kind of query. Bitcoin Core, on the other hand, is optimized for consensus related queries, which are largely a hashset lookup ...


2

It is impossible to answer this accurately without knowing details such as the hardware the miner is using, their utxo storage method, and their validation process. However, in general, the utxo set can be stored as a list keyed by the utxo identifier (txid:vout). This provides O(1), or constant, look up complexity for a single utxo. However, the utxo set ...


2

In Bitcoin, it was originally an assumption that miners producing blocks would use a unique address per transaction, making sure that the coinbase of each block had a unique TXID. As this was not enforced, users accidentally made duplicate transactions by setting the same destination address for multiple solved blocks. BIP34 simply adds a new field to be ...


1

I want add a clarification inside your good post by Jose Fonseca, the UTXO is a TransactionOutput, this structure has only 2 value, the amount and the scriptPubKey. The link to the previous transaction is inside the TransactionInput so, the TransactionInput and the transaction output is contained inside the Raw transaction. So inside the cache is present ...


1

Most services run their own services which track the UTXOs that they need. They use Bitcoin Core as an edge node which forwards all of the valid blocks and transactions to their internal software that adds them all to a database. This could be a software based on insight or Abe or something homegrown. In this way, they don't need to implement consensus and ...


1

Most services operating large scale wallets only use Bitcoin Core for networking information, and maintain a separate utxo set for wallet purposes. There are many existing options to build a full utxo set that can be queried for arbitrary addresses, such as the insight project. Moreover, recent versions of Bitcoin Core come with the scantxoutset RPC call, ...


1

Does that mean that if mempool contains a transaction saying "A" gave "B" 0.1 BTC then miner is supposed to actually make sure that "A" has that much unspent BTC before he can select that transaction into a block to be mined? This is a misunderstanding of how bitcoin transactions work, which assumes that coins are "spent from a wallet," which is not the ...


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