Blockchain is a digital piggy bank where people can keep their money safe. But, just like there are different types of piggy banks, there are also different ways to keep track of the money in the digital piggy bank. In this article, we're going to talk about two ways of keeping track of money in the digital piggy bank: account-based and UTxO-based.
Account-Based
Imagine you have a piggy bank with slots for different coins (pennies, nickels, dimes, etc.). You can put money in any slot and take money out of any slot. This is like an account-based system.
In an account-based system, each person has one or more "accounts" where they can store their digital money. They can move money in and out of these accounts as they please.
Ethereum, Solana, and other cryptocurrencies use an account-based system.
UTxO-Based
Now imagine you have a piggy bank where each coin has its own little compartment. You can't take money out of one compartment and put it into another compartment. You can only take money out of a compartment if you have the whole piggy bank. This is like a UTxO-based system.
In a UTxO-based system, each unit of digital money (like a coin) has its own "compartment" called an "unspent transaction output" (UTxO). When you spend digital money, you have to use the whole UTxO, not just part of it. And when you receive digital money, it goes into a new UTxO.
Bitcoin, Litecoin, and Cardano use UTxO-based system.
Both of these systems have their own advantages and disadvantages.
The account-based system is more flexible, because you can move money around in different accounts however you want. But it can also be more complex, because you have to keep track of multiple accounts for each person.
The UTxO-based system is simpler, because each unit of digital money is in its own compartment and you don't have to worry about moving money around between different compartments. But it can be less flexible, because you can only spend an entire UTxO and not just a part of it.
How Transactions Happen
Account-Based
In an account-based system, each person has one or more "accounts" where they can store their digital money.
When a person wants to make a transaction, they send digital money from one of their accounts to another person's account.
For example, if Alice wants to send Bob 1 ETH, she would send 1 ETH from her account to Bob's account.
The transaction is recorded on the blockchain, which is like a digital ledger that keeps track of all the transactions that have ever happened in the digital piggy bank.
The transaction is recorded in a block and added to the chain of blocks, the blockchain.
UTxO-Based
In a UTxO-based system, each unit of digital money (like a coin) has its own "compartment" called an "unspent transaction output" (UTxO).
When a person wants to make a transaction, they use one or more UTxOs they own as inputs in the transaction.
For example, if Alice has two UTxOs, one with 2 BTC and one with 3 BTC, and she wants to send Bob 1 BTC, she would use the 2 BTC UTxO as an input in the transaction.
The transaction is recorded on the blockchain, just like account-based system.
The transaction is recorded in a block and added to the chain of blocks, the blockchain.
The output of the transaction is a new UTxO, one holding 1 BTC that is assigned to Bob's address, and the other holding 1 BTC that is assigned to Alice as change.
Both systems, account-based and UTxO-based, have the same goal: to record the transaction on the blockchain and update the state of the ledger. The main difference is how they represent the state of the ledger and how the inputs and outputs of the transactions are selected.
In conclusion, both account-based and UTxO-based systems are ways to keep track of digital money in the digital piggy bank. They each have their own advantages and disadvantages, but both can be used to safely and securely store digital money. It's important to understand the difference between the two systems, so you can make informed decisions about which digital currency to use and how the transaction happen and recorded on the blockchain.
Commentaires