If you’ve ever been to Block Explorer to observe your Bitcoin income, have you ever been confused? This is precisely because the trading model used by Bitcoin is not intuitively account-based, but a model called UTXO. In my previous article, “Understanding NEX: Neon Exchange”, I also mentioned some functional differences between the UTXO model used by Bitcoin and the account model used by Etaifang. But what is the difference between the two models?
ETH and Account Model
The account model used by ETF is easy to understand, just as each of us has a bank account. In the world of Taifang, every address is like an account. After every deduction and transaction, the balance of the account is recorded in the block chain. So when authenticating transactions, you just need to check whether there are enough balances in the account. This method is simple and intuitive, which is more conducive to the development of intelligent contracts. If you have ever visited Etherscan to observe your trading records, you will find that everything is easy to understand and enter your trading ID. You will see this picture:
Simply from A to B, as long as you understand English, you should be able to understand.
Bitcoin and UTXO Model
The full name of UTXO is
Unspent Transaction OutputsUnexpended transaction output is less intuitive than the account model.
In the world of Bitcoin, there is no book that records all account balances. So how do you determine how much balance an address has now? Simply put, you need to review all previous transactions, find all the bitcoins sent to you, and add them all up before you know it.
Input and Output in Transaction
A “deal” in Bitcoin is also more complex. Let’s say today Fred gave Alice two BTCs and Ted gave Alice three BTCs. We sent these two to Alice. The total BTC of five is called BTC.
Unspent Transaction OutputsThat is to say, Alice now has two Unspent Transcation Outputs, which can be used to transfer money to others in the future.
If Alice wants to transfer 5 BTC to Bob now, he will use UTXO, which totals just 5, as input to the transaction. What miners need to verify is that no other transaction has been used in previous blocks.
Unspent Output。 If the same output has been sent, it is not.
UnspentWell, that’s bitcoin prevention.
Another condition is that,
inputThe total number should coincide. In fact, it’s not always possible to find two transactions that add up to the amount you’re transferring.
outputAs in the above picture, if Alice only wants to transfer 4.5 BTCs to Bob, he’ll add another column.
outputTransfer the extra 0.5 BTCs to yourself, so that the trade is balanced.
We can actually see what Bitcoin’s trading looks like. Now if we want to look at our own trading records on Block Explorer, we will find that it has the virtue of paying:
A deal involves a lot of money.
outputThis is probably a record of the amount of money transferred out by an exchange, so it contains a lot of money.
output。 And on the left
inputMaybe it’s a lot of money in exchange wallets.
Interestingly, we can’t actually “determine” the true amount of a transaction. For example, in the following record, there are three on the right.
outputWe’re not sure what 0.2, 0.03 and 56.38 are.
outputWhich is the real destination? Maybe Alice has only one pen.
Unspent Transaction OutputNo transaction cost 56.61 BTC output, so although he only wanted to transfer 0.2 BTC in this transaction, he had to use his only UTXO, and the remaining 56.38 back to himself.
Of course, the current Bitcoin wallet has helped us take care of these things, so when we use it, it’s like a bank account. As long as we export the destination address, the wallet will help us find the appropriate UTXO as input to complete the transaction. But if you are idle or do something you don’t want to know, you can pack your weird input and increase anonymity by yourself.
Advantages and Disadvantages of UTXO
UTXO allows parallel transactions because no account exists. If you have a lot of UTXOs, you can make multiple transactions simultaneously without being blocked. Then there’s anonymity. As mentioned above, you can easily hide your trading intentions. In addition, UTXO is also considered to be relatively safe and efficient, and can quickly verify and verify transactions through Simple Payment Verification (SPV).
But UTXO’s biggest drawback is that he is
StatelessStateless, which is very disadvantageous for developing applications on it. Just like the famous Qtum, which is based on UTXO’s trading model, it still designs it.
Account Abstraction LayerAccount abstraction layer to make application development easier.
Now block chain application development is in the ascendant, UTXO tends to be regarded as a model that can only deal with transactions simply. I think it is the product of the times to a certain extent. After all, it’s been 10 years since the invention of Bitcoin, and although some features are irreplaceable, people still prefer to move towards Account Model or hybrid architecture.
But anyway, Bitcoin will always be the leader of the block chain world! And now you have to use BTC transactions, so we still need to understand the UTXO operation!
In a word, I hope this article can give you a deeper understanding of Bitcoin.
- Java Bitcoin Development Course, which is for beginners, covers the core concepts of Bitcoin, such as block chain storage, decentralized consensus mechanism, key and script, transaction and UTXO. It also explains in detail how to integrate Bitcoin support functions in Java code, such as creating addresses, managing wallets, building bare transactions, etc. It is a rare comparison for Java engineers. Special currency development course.
- Php Bitcoin Development Course, for beginners, covers the core concepts of Bitcoin, such as block chain storage, decentralized consensus mechanism, key and script, transaction and UTXO. It also explains in detail how to integrate Bitcoin support functions in Php code, such as creating address, managing wallet, constructing bare transaction, etc., which are rare bits for Php engineers. Currency Development Course.
- PHP Ethernet workshop mainly introduces the use of PHP for intelligent contract development interaction, account creation, transactions, transfer, token development, filters and transactions.
- Java Ethernet development tutorial, mainly for Java and Android programmers to block chain Ethernet development web3j details.
- The introduction course of ETF mainly introduces the development of intelligent contract and DAPP application, which is suitable for the introduction.
- The advanced course of Etaifang Development mainly introduces how to use node. js, mongodb, block chain and IPFs to realize the de-centralized e-commerce DApp, which is suitable for the advanced stage.
- Python Ethernet workshop, mainly for Python engineers using web3.py block chain Ethernet development details.
- EOS introductory course, this course helps you quickly start the development of decentralized application of EOS block chain. It covers the core knowledge points of EOS tool chain, account and wallet, issuing tokens, intelligent contract development and deployment, using code and intelligent contract interaction, and finally completes the development of a note DApp with all knowledge points.
Here is the original text.