【Blockchain Know-how】All Bitcoins Are Really UTXOs

2020-11-05 17:46:56

Many crypto newbies think that Bitcoin and real-world bank accounts follow the same transaction logic. As a matter of fact, Bitcoin, a decentralized cash system, does not use the bank account model but instead adopts a UTXO model. In the crypto community, there is even a popular view that all Bitcoins are really UTXOs.

 

What is UTXO?

 

To grasp the concept of UTXO (Unspent Transaction Output), we must first go through the transaction logic of UTXO-based cryptos like Bitcoin.

 

To help you understand the logic, we will not go into the technical definitions. Here is an example:

 

Suppose Smith, Brian, and Bob own $1,000, $2,000, and $3,000, respectively.

 

The three of them have business dealings with one another and often transact with each other.

 

Transfer 1: Bob transfers $1,000 to Smith

Transfer 2: Brian transfers $500 to Smith

Transfer 3: Smith transfers $800 to Bob

 

In the real world, all transfers and payments are based on two basic concepts: account and balance, and third-party systems such as banks only need to transfer the requested amount of balance between different accounts, making sure that the total balance remains unchanged.

 

 

If Transfer 1 is a real-world transaction, the bank would first check whether Bob’s account balance is at least $1,000, and it would reject the transfer request if not. If the balance is sufficient, the bank would deduct $1,000 from Bob’s account balance and add $1,000 to Smith’s account balance.

 

By the same token, after three transfers, the account balance of Smith, Brian, and Bob would become $1,700, $1,500, and $2,800, respectively.

 

 

Under the UTXO model, the system would regard the “account balance” of the three as UTXOs.

 

 

In the case of Transfer 1, when the transfer is initiated, the system would create an output transaction by dividing Bob’s $3,000 holding into two. It would then add a $1,000 output to Smith’s address and a $2,000 output to Bob’s address. At this point, instead of a $2,000 UTXO, Smith’s address contains two $1,000 UTXOs.

 

 

When Transfer 2 is initiated, Brian’s $2,000 UTXO will be divided into two UTXOs: a $500 UXTO added to Smith’s address, and a $1,500 UTXO added to Brian’s address. At this point, Smith’s address contains two $1,000 UTXOs and one $500 UXTO.

 

 

When Transfer 3 is initiated, Smith’s $1,000 UTXO will be divided into two UTXOs: an $800 UXTO added to Bob’s address, and a $200 UTXO added to Smith’s address.

 

Here is what their UTXO balance will look like after the three transfers:

 

 

If the above example is still confusing to you, we can also compare UTXO to cash.

 

Suppose Smith plans to buy a $90 product and now holds four banknotes that are worth $100, $50, $20, and $20.

 

There are no $90 banknotes in the real world, and it is impossible for Smith to tear a $100 banknote and use 90% of it for the payment. At this point, he could use a $50 banknote and two $20 banknotes for the payment or pay $100 and receive $10 from the vendor as the change.

 

We can consider all types of banknotes, whether it is $50, $20, $100, or $10, as UTXOs. Since Smith does not have a $90 UTXO, he could use multiple small UTXOs for the payment or a big UTXO that will be split between the vendor and himself.

 

Unlike the cash system, UTXO is burned and a new UTXO is generated every time it is used, which is easy to understand: UTXO means unspent transaction output, and once a UTXO is spent, it would no longer be UTXO.

 

For example, when Smith pays $100, the $100 UTXO is then “spent”, and two new UTXOs ($90 and $10) are generated. If he uses a $50 UTXO and two $20 UTXOs for the payment, then all three UTXOs are also “spent”, generating a new $90 UTXO.

 

Change address

 

Like the cash system, UTXO also features the concept of change. In the above case, Smith pays a $100 UTXO to the vendor, and the UTXO is split into a $90 UTXO for the vendor and a $10 UTXO for himself. Here, the $10 UTXO is the change. At this point, Smith will need to set up a change address to receive the $10 UTXO. It is noteworthy that the change address could be the original address used for the transaction or a new address.

 

Some of you might wonder, why do we need a new address? Can’t I use one address, just like my bank account?

 

The answer is yes. Of course, you can, but it won’t be safe.

 

As the saying goes, opportunity makes the thief, which is why most people are reluctant to disclose their wealth to the public.

 

Since the transaction data of most UTXO-based cryptos, including Bitcoin, are publicly available and traceable, using the same address for multiple payments might compromise your privacy.

 

If a user accidentally discloses his personal information in a transaction, the ownership of the address will be exposed. In such cases, malicious players could directly view the total balance in the address, and the user’s personal safety might be endangered in serious cases.

 

Just imagine how many thieves would come after you if they know that you’ve got a 6-digit BTC holding.

 

However, if you set up a change address that differs from the original address that initiates the transfer, you will benefit from significantly improved security. This is the case because the change address will be mixed between multiple (at least two) recipient addresses, and though malicious players are sure that you own the original address, they have no idea whether you have already received the crypto. Even if they do, there is no way for them to find out where the crypto is stored and how many cryptos there are.

 

How do we switch to another address?

 

In CoinEx Wallet, you can activate the Switch Address function for switching the recipient address of UTXO-based cryptos. Each time you receive a payment, including change assets, a different sub-address will be adopted, which fully ensures the privacy of the transaction.

 

After activating the auto-switch function, you’ll no longer have to worry about managing all the different addresses. With an HD wallet like CoinEx Wallet, you can control all your sub-addresses simply by remembering the mnemonic phrases.

 

The function is now available for UTXO cryptos like BTC, BCH, BSV, LTC, DASH, ZEC, DOGE, DCR, and LBC. For example, activating the auto-switch function for BTC involves the following steps:

 

1.Open CoinEx Wallet, go to your BTC address, and click on [Receive].

 

2.Click on [...] in the upper right corner, and tap [Switch Address] at the bottom to enter the switch address page.

 

3.On this page, you can see all sub-addresses of the current BTC wallet and whether they have been used before. Click on [+] in the upper right corner to create a new sub-address. Moreover, you can activate [Auto Switch], and your address will be automatically switched every time you receive cryptos.