Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Impara Unspent Transaction Output | Section
Blockchain Fundamentals: Core Concepts - 1773671293941

bookUnspent Transaction Output

Scorri per mostrare il menu

UTXO and Balance

The unspent transaction output (UTXO) model is a fundamental concept in the way Bitcoin and several other cryptocurrencies track ownership of digital currency representing the amount of digital currency someone has available to spend.

Note
Study More

A UTXO is essentially a piece of digital currency that has been received in a Bitcoin wallet but not yet spent.

Each UTXO represents a portion of Bitcoin that can be used as an input in a new transaction. The Bitcoin network tracks all UTXOs across the blockchain, and the complete collection of them is known as the UTXO set. This set is used to calculate a wallet's balance and to validate new transactions.

The following example illustrates how this works:

As shown here, Bob has 4 UTXOs, and together they make up his wallet's balance. Adding their values results in a total balance of 4 BTC.

Spending UTXOs

Consider the following example to illustrate how UTXOs are spent. Bob wants to send 1.9 BTC to his friend Alice, with a transaction fee of 0.01 BTC. Here is Alice's wallet before the transaction:

At this point, Alice has 3 UTXOs with a total balance of 8.45 BTC.

Before moving on to the transaction, one important detail must be kept in mind.

Note
Note

A single UTXO cannot be split into smaller chunks, so the whole UTXO must be used as an input in a new transaction. However, a transaction can use any combination of UTXOs (not necessarily an entire set). The combination to use, though is determined by your wallet and cannot be controlled.

Since Bob does not have a single UTXO or a combination of UTXOs that totals exactly 1.91 BTC (1.9 BTC for Alice + 0.01 BTC as the transaction fee), a UTXO or a set of UTXOs with a greater total amount must be used. Assume the wallet selects a single UTXO worth 2 BTC (although using the 1.5 BTC, 0.3 BTC, and 0.2 BTC UTXOs together would also be possible).

Note
Study More

To spend his 2 BTC UTXO, Bob's wallet creates an unlocking script, also known as the scriptSig (script signature). This script typically contains a digital signature produced by Bob's private key and, depending on the type of locking script used to lock the UTXO, may also contain the public key. The digital signature proves that Bob is the owner of the funds and has the right to spend the UTXO.

The transaction now looks as follows:

After the transaction is confirmed, Alice's wallet balance increases by 1.9 BTC. Bob's wallet balance now consists of the UTXOs he did not spend (1.5 BTC, 0.3 BTC, and 0.2 BTC) along with the new change UTXO of 0.09 BTC (after subtracting the 0.01 BTC fee). Bob's updated total balance is the sum of these UTXOs, which equals 2.09 BTC.

When Bob's wallet creates the transaction, it also generates locking scripts for the outputs. The output sending 1.9 BTC to Alice contains a locking script that defines the conditions under which those funds can be spent in the future. This script is called the scriptPubKey (script public key).

Note
Study More

The scriptPubKey will typically contain a cryptographic hash of Alice's public key or Bitcoin address, setting a condition that only someone with the corresponding private key (Alice) can unlock and spend these funds.

Finally, when Bob broadcasts the transaction to the network, miners validate it by checking that the unlocking script (scriptSig) for each input satisfies the locking script (scriptPubKey) from the output where the UTXOs were originally sent to Bob. If the scripts are valid and the transaction is confirmed, it becomes part of a block in the blockchain.

question mark

When creating a Bitcoin transaction, what must occur for the transaction to be considered valid regarding UTXOs?

Select the correct answer

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 1. Capitolo 11

Chieda ad AI

expand

Chieda ad AI

ChatGPT

Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione

Sezione 1. Capitolo 11
some-alt