UTXO Model

victor@57blocks.com

What is UTXO?

An Unspent Transaction Output (UTXO) is the technical term for the amount of digital currency that remains after a cryptocurrency transaction. They are recorded in the UTXO database and used in later transactions. You can think of it as the change you receive after buying an item, but it is not a lower denomination of the currency—it is a transaction output in the database generated by the network to allow for non-exact change transactions.

UTXOs use public key cryptography to identify and transfer ownership between holders of public/private key pairs. UTXOs are formatted with the recipient's public key, thus restricting the ability to spend that UTXO to the account that can prove ownership of the associated private key.

How an UTXO transaction works?

When you initiate a transaction through your wallet, UTXOs with your information are located, unlocked, and the new owner's information is associated with the UTXO you transferred to them. They are locked once again, and that user can use them in transactions via the same process.

To better understand how an UTXO transaction been constructed, imagine Bob wants to pay 3.7 BTC to Alice:

  1. Getting the right inputs, Bob's Wallet find inputs that can pay the amount she wants to send to Alice, and get a UTXO with 3 BTC and a UTXO with 0.8 BTC.

  2. Using private signature to Unlock those UTXOs to spend.

  3. Creating the Outputs, lock the payment UTXO (3.7 BTC) with Alice'address, and create a change UTXO (0.1 BTC) to Bob.

  4. Send out the tranction

Transaction Fees

Note that in a real utxo tranction, the sum of outputs doesn’t equal the entirety of the consumed input. The difference between outputs and inputs is defined as the transaction fee on the protocol level.

The transaction fee’s size is estimated by the wallet based on the amount of data recorded on-chain.

Miners can only place a limited amount of data within a block, and by using the metric ‘money per amount of data,’ miners can determine which transactions to include in the block. They will typically pick the transactions with the highest fees per byte.

How to check balance

The UTXO model does not create an “account” for you to maintain a balance. There is no final balance stored on the ledgerbut only individual transactions. So the “burden” of maintaining a user’s balance is shifted to the client-side: wallets.

Wallets maintain a record of all addresses controlled by a user and monitor the blockchain for all associated transactions. To check your balance, wallet scans the ledger for all transactions associated to your address(es) and the sum of all unspent transaction outputs determines the current balance.

References

bitcoinbook/bitcoinbook - Transactions

Comparing the UTXO and Account Model

Bitcoin's UTXO Model

UTXO Model: Definition, How It Works, and Goals

Last updated