UTXO Model VS Account-Based Model. Which Blockchain System Looks The Best?
Most cryptocurrencies work on the UTXO technology that operates on the principle of individual and absolute validity for each transaction, much like physical cash. As implemented in Ethereum, the Account-Based Model tracks user balances through a separate accounting system. This article delves into the fundamental workings of both networks, highlights their key differences, and provides a concise overview of each.
Introduction for Novices
New to Bitcoin? Besides understanding what kind of asset it is, you also need to know BTC’s blockchain technology. Any digital must have transferability. The transfer of funds via blockchain is initiated by the owner, thus forming a transaction that notifies the network of the amount being exchanged and the identity of the new owner.
The prevalent models in blockchain technology are the UTXO (Unspent Transaction Output) system and the Account system. Bitcoin operates on the unspent outputs, while Ethereum uses the Account system.
Blockchain: A Dynamic State System
Firstly, it’s important to understand blockchain broadly as a state system. A system is considered a state if it is programmed to remember user interactions and past events. The stored information qualifies as the system’s state, and blockchain is defined as a stateful system. The system undergoes a state transition when a new block appears according to its Protocol.
Regardless of whether the blockchain employs the account or UTXO network, the basic mechanism remains the same: user transactions (TXs) are broadcast over the network, and with each new block added, some of them are recorded permanently. The balances of the participating parties are updated during the transition to the new state.
The Account-Based Model
The account model refers to the bank system where your address has a certain balance or a numerical representation of the value stored in the account. Any balance movement is just a mathematical operation on the bank server.
Let’s now delve into the accounting network in the blockchain. This system (used in Ethereum), similar to a bank account, represents assets as balances in accounts.
Each Ethereum wallet has a balance, storage, and the ability to access other accounts or addresses. When the first sum is received on the wallet, a private-key controlled account is added to the global state and stored on all nodes on the network. Deploying a smart contract creates a code-controlled account that can store funds and redistribute them based on terms defined in the contract logic.
Executing TXs reduces the sender’s account balance and increases the receiver’s balance. To protect against replay attacks, each Ether transaction has a nonce attached to it, a total number that ensures that the transaction cannot be executed more than once.
Fees in Ether are calculated based on computational resources consumed rather than memory space occupied. That aligns with Ethereum’s vision of becoming a world computer.
UTXO Model. Why Is This System Innovative?
Utxos explained
Bitcoin works as a public ledger. It contains records of every single transaction completed on the network called UTXO. But what is UTXO?
UTXO meaning can be defined as a blockchain that doesn’t have wallets at the protocol layer. Instead, they store coins as a list of unspent transaction outputs (UTXOs), meaning each output represents a user’s balance of coins (e.g., BTC) controlled by a specific address.
The term “unspent transaction output” comes from the fact that the system is an output of a transaction received by a user, which they can spend in the future since it’s still “unspent.” TXs are generated by consuming existing outputs and creating new ones in their place.
The principle of information transmission
Bitcoin, being a UTXO crypto, is an innovative anonymous method of exchange. A BTC transfer is not A+B=C; it is a more cumbersome structure with inputs and outputs.
- Input is funds that someone once sent to us.
- Output is what we are going to send in the current transaction.
- The sums of inputs are added, and they form a sum for further sending.
Utxo explained the following: let’s take a transaction with 1 input and 1 output. One Satoshi (SAT) is currently the smallest Bitcoin unit in the blockchain. User №1 sends to the recipient 50.000 SAT. We have:
- Input 50.000 SAT.
- Output is the address of the recipient and a sum to receive (50.000 SAT)
User 2 sends 11.500 SAT. Now we have 2 separate unspent transaction outputs with a total sum of 61.500 SAT, the amount you see in your wallet as a recipient.
There are some important rules for such inputs and outputs.
- There can be any number of them.
- The sum of outputs must not exceed the sum of inputs. As a rule, there are more inputs than outputs. In this case, the change is formed and returns the difference to the sender.
- Each input can be used only once.
So how do inputs and outputs interact with each other? Let’s see how a transaction works from the inside.
The input hash
- The previous output hash is the hash of another transaction from which these coins arrived, which we will spend now.
- Pinpoint the previous output index of TX, which we will spend. As already mentioned, there can be several outputs of one TX, so it’s important to know which one will be used — for that, the outputs are numbered.
- The first two elements reference one of the outputs of another transaction done in the past.
ScriptSig is an unblocking script written in a special Bitcoin scripting language.
The output hash
- Value is the number of SATs we will send
- ScriptPubKey is the blocking script that prescribes the condition under which you can spend the funds in this output. That is, this program locks the funds in the output.
The transaction output is strongroom with a will note attached to it and a treasure inside. And this strongroom can only be opened by someone who fulfills the conditions described in the will. This condition is the fact of possessing a private key. How does it determine who can spend money from the strongroom? That is determined by the PubKeyHash parameter. The private key owner, which corresponds to the public key in the hash, can spend the money.
In the unblocking script, the recipient will put their public key and add a digital signature (private key data and transaction data) as their private key. The digital signature indicates that the necessary key is present, but the key record is not disclosed. Why not just a private key? Because, for security reasons, it cannot be shown to anyone.
At the exit of the previous transaction, the locking script connects to the unlocking script at the entrance of the current transaction. For this procedure, it is necessary to take the recipient’s public key from the unlocking script and make a copy of it. The copy is then converted into a command hash. Here the hash is compared to what the sender has specified in the hash folder. If there is a match, the recipient has shown the correct primary key, and they are declared as the rightful owner of the funds in the output.
Technically, it’s not the Bitcoins we give each other but the right to use them. When you’ve sent a Bitcoin, that doesn’t mean you own it. To prove you own a coin, you have to do another transaction, but you don’t own those coins anymore. By the way, you may need to pay taxes on cryptocurrency TXs.
Unspent outputs: a cash analogy
For a fuller understanding, think of it as a physical monetary system where users control different amounts of cash.
A holder with 50 SATs can own a single one worth 50 SATs or a combination of smaller outputs equal to 50 SATs. That is similar to how a person owning $50 can have a single $50 bill or a combination of smaller bills.
Previous blocks cannot be changed or reduced, so the transaction’s results must be spent entirely. If the user wants to spend only part, the remaining amount (output amount minus the desired amount) is sent back to the user’s address as a change.
For example, if one spends 10 SAT from a UTXO worth 50 SAT, the transaction creates two outputs: a 10 SAT output to the receiver and an output of 40 SAT change back to the original owner. That is analogous to if you gave $50 and received $40 in change from the receiver.
Unlike cash, the receiver never keeps the change. Instead, it is immediately returned to the original owner’s address. Another difference is that cash bills have set denominations, such as $1, $5, or $10. Unspent outputs can have any value, such as 2.83636.
Since the model operates without accounts and wallets at the protocol level, maintaining the user’s balance falls to the client side. The wallets keep track of the addresses controlled by the user and track the TXs associated with them on the blockchain. The sum of all unspent transactions determines the current balance outputs the user can control.
Comparing UTXO with Accounts System
For now, we got the Account network, and UTXO explained. But what are the differences?
Maintaining a global record of balances
The account-based system keeps a comprehensive, global record of all private keys and account balances. This information is stored across all network nodes and constitutes the system’s global state.
In contrast, the global state of the UTXO system is defined as the set of all transaction outputs and is constantly extended by new outputs. Meanwhile, the global state in the accounts model is constantly updated, with account balances changing as a result of TXs. The system’s state is a list of accounts and their corresponding balances.
Recording the system’s state
The main distinction of UTXO from the Account network is in recording the transition from one state to the next. The Account model maintains a database of network states, while the UTXO records the asset movement as a directed acyclic graph (DAG) between addresses. DAG does not allow circular connections between nodes.
The figure to the left shows the DAG of the UTXO model. Each state symbolizes a block in the blockchain. Each transaction output represents a node in the DAG and one or more edges emanating from the transaction output. Thus, a new transaction output has no outgoing edge. In the above example, transaction outputs 3, 5, 6, and 7 are unused.
The graph on the right depicts the account model. Each new block’s state is updated based on the TXs in the block. The number of balances remains constant and does not depend on the number of TXs as long as the number of smart contracts remains constant.
In the account model, the current set of balances makes up the global state. In the above example, this is the set of balances A, B, and C. User balances are updating globally.
In the UTXO, only transaction receipts are recorded. The entire graph of transaction outputs (both spent and unspent) represents the global state. Every transaction has the potential to change the state, but constant state transitions are not practical. All network members must remain synchronized in the current state. Developing a consensus mechanism that synchronizes all nodes becomes increasingly difficult as state transitions occur more often.
As the frequency of state updates increases, it becomes a problem to reach an inconsistent state where some nodes have a different understanding of previous events. Consequently, each new block represents a change in the system state, and TXs are grouped into blocks.
However, cryptocurrencies are not only a means of exchange; they have more and more functions daily. For example, Ethereum and Bitcoin have long been integrated into casino systems.
Hybrid Systems
The blockchain system of QTUM exemplifies the utilization of a hybrid structure combining the Utxo coins system and account models. The choice to incorporate the UTXO model, made during the inception of Qtum, was driven by the desire to build a versatile and secure blockchain suitable for business use. The UTXO model was deemed more secure than the Accounts system at its adoption.
With the inclusion of the Account Abstraction Layer (AAL), Qtum allows for the creation and execution of smart contracts using the account model popularized by Ethereum. The AAL merges UTXOs into a new transfer once two or more are accessible to the contract code. Qtum also works on BlackCoin’s Proof of Stake Protocol, which specifies parallel unspent outputs proofs.
Final Facts
All in all, both systems fulfill the requirement of maintaining accurate balances in a consensus system.
Advantages of the UTXO Model
- Privacy: the system offers a higher degree of privacy, especially when users use new addresses for every transfer. For even greater privacy, advanced techniques like ring signatures can be considered.
- Scalability: the capability of processing multiple outputs simultaneously enables parallel TXs and fosters scalability advancements.
Benefits of the Account Model:
- Efficiency: the system is more efficient since it only requires every transfer to validate that the sending sum has sufficient balance to complete it.
- Simplicity: the Ethereum network chose this model for the convenience of developers creating complex smart contracts, particularly those that entail state information. For instance, a smart contract keeps track of states to execute different actions based on them. The UTXO stateless nature would require TXs to carry state information, making the contract design unnecessarily complex.
The main disadvantage of the second system is its susceptibility to double-spending attacks. To counter this, each wallet in Ethereum has a public nonce that increases by one with every transaction made, ensuring that the same transfer can’t be submitted multiple times.
Both models have pros and cons, enabling cross-border transfers with completely new technology. Some blockchains choose the UTXO to capitalize on the advancements and innovations developed through the Bitcoin blockchain. Want to keep up with technology and news in cryptocurrency? Here’s our overview of trends in the crypto world.