What is UTXO?
A UTXO is the transaction output created by the network to provide a non-exact change in each business deal. The part of the cryptocurrency not spent in each transaction provides a basis for accounting measures. Just like in double-entry accounting, crypto transactions have inputs and outputs. Importantly, analyzing how the blockchain works provides a good foundation for understanding the UTXO model. Crypto beginners’ corner:
How to Invest in Crypto? Complete Beginner’s Guide Best Cryptocurrency Exchanges – Top 7 Picks 15 Best Crypto Books for Beginners Must-read Crypto Wallets Guide for Beginners How to Mint & Sell NFTs? Beginner’s Guide How to Stake Cryptocurrency? Step-by-Step 11 Crypto Slang Terms Explained Best Crypto Trading Bots – Top 3 Picks What is DeFi? Liquidity Mining Explained
How the blockchain works
Bitcoin (BTC) and other cryptocurrencies are generated out of complex mathematical structures, which have different meanings based on the semantics surrounding them. A structure can have raw data or other smaller structures within itself, of which, depending on the definitions of those structures, the data within them are interpreted by the protocol. Each transaction in a blockchain is timestamped and captured in datasets known as blocks. It’s then sequentially added to the chain, with each block header bearing the hash of the previous block header to form the ledger. This is what makes it technically impossible to tamper with a transaction in a blockchain because it would require huge amounts of computing power to attempt to disrupt the cryptographic hash of previous blocks on the chain. Therefore, a blockchain consists of a chain of blocks that forms an immutable public digital ledger. It works like a virtual book that contains all the transactions conducted by a blockchain’s exchange parties, mainly individuals and businesses. Each block bears a Header and a Transaction List. The header holds all metadata about a particular block, including the previous block hash that points to an earlier block, also known as the parent block. In this fashion, each block points to its parent block, and the chain can be traced down to the first block, also known as the genesis block. This linking and pointing back into the past leads to a chain-like structure of blocks, termed a blockchain. Understanding the basic idea of blocks can help shed more light on how transactions work in a blockchain, and this can help you understand the UTXO concept better.
The technical UTXO model
Analyzing a single transaction in a blockchain reveals several different structures with different semantic meanings. It starts with the Transaction Version, which is a number denoting the type of a particular transaction to the network. When a blockchain node reads the version number, it can determine the set of rules that can be used to verify that particular transaction. The last structure in a transaction is Lock Time, which marks whether a transaction can be added to a blockchain immediately or after some time. Between these two structures is a list of Inputs and Outputs, which are the most important components of the UTXO model. A transaction output includes what blockchain experts call a cryptographic lock and a value, where an output is thought of as locked while an input provides the key to unlock it. The value refers to the amount of a given cryptocurrency that is locked inside an output. It’s worth noting that each transaction input contains a pointer and an unlocking key. As its name suggests, the pointer points back to a previous transaction output while the key unlocks the corresponding transaction output. Each time an output is successfully unlocked by input, the blockchain marks it as “spent” and in the real world, the transaction is termed as “completed.” A new “unspent” output is created every time this action happens. An Unspent Transaction Output refers to all the outputs, which are not yet unlocked by an input. After an output is unlocked or a transaction is completed, it’s removed from the circulating supply, and a new output takes its place. Consequently, the sum of the value of the unlocked outputs or completed transactions will always be equal to the sum of the value of newly created outputs. This activity is what keeps the total circulating supply of Bitcoin and other cryptocurrencies constant. A UTXO, therefore, implies a cryptocurrency value that is locked up in a blockchain, and each transaction can be traced down to the first instant it was created.
Why UTXO is important in Bitcoin and other cryptocurrencies
In cryptocurrencies that use the UTXO model, including Bitcoin, Bitcoin Cash (BCH), or Litecoin (LTC), all transactions bear the structure of inputs and outputs. For example, each Bitcoin transaction has an “Entries” section where you can see the origins of the balance you’re managing with your wallet. On the other hand, there is the “Departures” section where you can see where you send your funds. Additionally, it’s possible to see the remaining funds returned, and each transaction is visible and traceable by anyone. Upon a closer look, the UTXO model allows users to have complete control over how their funds can be used and under what conditions they can use them. It also makes Bitcoin and other cryptocurrencies that use it more auditable, transparent, and efficient than traditional financial systems. To initiate a transaction in Bitcoin or other cryptocurrencies, you must have an available balance, and that balance must be registered as a UTXO within your wallet. It means some payment must be made through an “exit or UTXO” to you so that it becomes your “entry” to give you an available balance to spend. UTXOs are, therefore, an important component of transactions because, without them, transactions would be impossible.
Bitcoin UTXO set explained
A compilation of all the UTXOs at any given time is known as the UTXO set, which is constantly maintained by each Bitcoin node. Bitcoin uses the UTXO set to monitor output transactions that have not been spent, which can be used as inputs to new transactions. Bitcoin full nodes will keep a copy of the UTXO set to help them validate transactions without having to check the entire blockchain. Technically, the sets are referred to as the chainstate and stored in the chainstate data directory of each node. Each time a new block is added to the blockchain, the chainstate updates the list of the latest transactions and defines which of the previous UTXOs are spent and which new UTXOs are generated. Essentially, each Bitcoin node in the network will always have the exact same copy of the UTXO set in their local database. UTXOs are simply cryptocurrencies and different digital wallets present them in different ways for user information. For instance, if you ask a wallet for your Bitcoin balance, the wallet in the back end will collect all the UTXOs that you own and show you the sum of the value of those UTXOs. The provided figure is your final wallet balance. These calculations happen in the background away from the users.
Real-world UTXO model
In a real-world application, UTXOs operate in a similar way to physical cash or coins. A UTXO is a transaction output that can equally serve as an input in a new transaction. Essentially, a UTXO defines where each blockchain transaction starts and ends. This model is a fundamental component of Bitcoin and several other cryptocurrencies.
UTXO model example
For instance, when you buy anything at a store using cash, you pay the cashier the whole amount, you pay the cashier the whole amount, take the products, and receive the change. You don’t split a ten-dollar bill to purchase five-dollar things. Instead, you give up a ten-dollar note and obtain the new five dollars as a change plus the products. The same concept applies to UTXOs. In each crypto transaction, UTXOs are consumed whole, even if the required payment is a fraction of the original UTXO. Using the illustration above, if you want to pay for some product or service worth 6 BTC, but you only have a UTXO of 10 BTC: You will create a transaction that consumes up the entire UTXO of 10 BTC and create two other new UTXOs: one for paying with 6 BTC and another one for yourself with 4 BTC value. The UTXO you pay to yourself is referred to as the change UTXO, and your wallet will automatically track it to give you the final balance of 4 BTC. Each time you make a payment for a smaller value than the available value of UTXOs, your wallet automatically creates the change UTXO for your balance.
UTXO and account-balance models compared
Most blockchains, such as Bitcoin, Litecoin, Bitcoin Cash, and Bitcoin SV, apply the UTXO model for accounting purposes. However, there are a few exceptions, such as Ethereum, which uses an account-balance model, and Cardano, which uses both the UTXO and accounting-based models. The account model works similarly to traditional bank accounts, where a user can have one or multiple accounts with any amount of funds and no concept of change back. Credit is simply added to the balance while debit is subtracted. A UTXO model works better for scalability, privacy, and efficiency. UTXO transactions are simplified because each UTXO can only be consumed once and as a whole. Based on the simplicity, transaction verifications can work better, and various schemes of privacy-enhancing techniques can be created using the UTXO model. Even so, the UTXO model has some challenges with usability. For example, the model is less intuitive, which is why most wallets would go for normal accounts with intuitive user interfaces. Besides, UTXO accounts are limited in terms of smart contracts, and they don’t embrace private key and contract code control. For these reasons, Ethereum preferred the account-balance model to the UTXO model.
UTXOs and fiat currency—are they the same?
One major concern in discussions about the UTXO model is whether it’s the same as or different from fiat currency bills. Most practical examples used to highlight the fundamental working of UTXOs often present analogies between them and fiat money. However, these presentations may contain certain glitches, which can be used to shed more light on the UTXO model. To begin with, most don’t consider the transaction fees involved. For each blockchain transaction, a user must pay the fees to initiate a network trade. Therefore, when you send cryptocurrency to a different address, you will get the new UTXO of the same value as the original minus the amount sent, together with the transaction fees. The transaction fees can vary from one blockchain to another. Another notable glitch often overlooked in UTXO model explanations is the fixed value of fiat bills. Fiat money is limited in supply, which depends on the government’s decision to print the money. It’s for this reason that fiat currency bills have pre-determined values. This is not the same for UTXOs because they can come in any amount. Consequently, the UTXO model could also bring some benefits over fiat currency bills. For example, UTXOs are more flexible than fiat money. It’s possible to have even 1,000 Bitcoins in a single UTXO instead of dealing with several thousands of fiat currency in cash. Overall, UTXOs present more flexibility compared to fiat currency while at the same time playing a crucial role in blockchain functionality. However, UTXOs equally have their limitations when compared to fiat currency. For example, the amount of UTXOs in each individual’s digital wallet has to be documented. This implies that you can only assemble or disassemble UTXO coins when you participate in a public blockchain transaction. Without sending or receiving any crypto funds, you cannot alter the number and amount of UTXOs in your digital wallet.
The upsides of the UTXO model
Most discussions on the UTXO model would highlight the value it offers. The following are some of the advantages of the UTXO model:
Language-free smart contracts. The UTXO-based smart contracts are independent of language, which is a major breakthrough in the blockchain sphere. This allows all UTXOs to create unique consensus mechanisms. UTXO model supports decentralized exchange and atomic swap. The UTXO model supports decentralized exchanges alongside atomic swaps which enables peer-to-peer crypto trading without the intervention of any intermediary. Users don’t have to worry about any escrow services, centralized accounts, or proxy tokens with the atomic swap feature. This creates a better facility for direct crypto trading between user wallets. Improved scalability. UTXO coins offer better scalability since users have the option to process multiple UTXOs at once, which allows for facility or parallel transaction processing. Consequently, users can clearly note how the model can minimize the computation load on the blockchain network. Privacy and security. The UTXO model offers privacy and security because new addresses are generated for each UTXO transaction, making it practically impossible to track the transactions. Besides, the link between inputs and outputs in each UTXO transaction can enable easier authentication of all transaction sequences to address the concerns of double-spending.
Final thoughts
The UTXO model works as a blockchain mechanism for keeping track of where the coins are at any time. Essentially, UTXOs offer significant accounting capabilities, which make them a fundamental aspect of a blockchain system. They work as bookkeeping mechanisms for blockchains and are essential to all types of transactions, including crypto trades.