Secret of Bitcoin I : Bitcoin transaction - DotWallet

News Center

Secret of Bitcoin I : Bitcoin transaction
2020.07.31

Author: Linzheming

 

Preface

There remains many misunderstandings in Bitcoin technology. Hereby I will explain in several articles. I assume readers here have basic knowledge of Bitcoin, otherwise the article might be too long to read.

 

Outline

 

Low Bitcoin transaction processing rate

Many readers heard that “Bitcoin is the first blockchain”, “Low Bitcoin transaction processing rate” and “Bitcoin transaction is slow”. After that they began to learn “More potential” bitcoin technology. Bitcoin seems to be a very simple concept to skip with as part of Bitcoin V.1.0. Today we are here to discuss these misunderstandings above.

 

Transaction processing ability

One of the common misunderstandings is that bitcoin transaction processing rate is limited to 1 transaction per second(7TPS). Bitcoin is supposed to generate a 1M block every 10 minutes, and 1 typical transaction is about 240 bytes, therefore, bitcoin transaction processing rate is 1000000/10/60/240≈7. Then BTC moved transaction signature from blockchain by enlarging transaction size limit using Segregated Witness solution. Transaction processing rate increased to 14 TPS. However, this is far from meeting the demand of transaction volume.

However, transaction processing rate far exceeds this by bitcoin technology. Let’s start from transaction structure.

 

Bitcoin transaction structure

Skip this part if you are familiar with it.

All Bitcoin transactions are certain kinds of payment.

Bitcoin saved in UTXO (Unspent Transaction Outputs) is used as an input in a new transaction that contains one or more transaction inputs. Bitcoin contained in input will be aggregated in transaction. Then the bitcoin input will be spent by Unlocking Script into a new UTXO. When UTXO is used for transaction, it will be consumed.

Transactions are written in flexible script language that is been used to create scripts containing condition required to spend and authorization (rights to keep and control) of outputs. Through the script language and the cryptology operators contained in the scripting language, a series of conditions are constructed called "locking scripts", which are used to allow the output of bitcoin transactions to be used again in the way of signature.

A typical bitcoin transaction includes version number, lock time, list of outputs and list of inputs.

Bitcoin transaction can be deemed as a process that all inputs of bitcoin are melted and issue new bitcoins. Every input list contains previous transaction ID (TXID) and specific output serial numbers (Index).

 

Transaction and change in UTXO model

Just like cash, UTXO is indivisible. For example, you need to buy a cup of coffee (¥14.75) but you have five ¥ 20 bills only. You have to pay more than the value of coffee, say ¥ 20 and ask for change. In this case, change is ¥ 5.25.

Similarly, a UTXO can’t be cut in whatever denominations that user has available like paying ¥ 20 for coffee. If you want to send someone 15 BSV, and you have only one UTXO worth 20 BSV, you  need to send whole UTXO to receiver and accept the change. Blockchain protocol handles this process, change will be refunded while you don’t need to trust receiver. In this way, when you make this transfer, receiver will get 15 BSV and the remaining 5.25 BSV will be refunded to your address as a smaller UTXO.

What if you want to send 23.75 BSV to someone? This is the same as paying in cash. You have to send double UTXO ( using two ¥20 bills); one ¥20 bill will be used up, for the other, the change will be sent back in the form of new UTXO.

 

Differences between UTXO and cash

Comparing UTXO to cash is helpful for readers to understand the basic concept, but there remains differences between them.

First of all, transaction in blockchain takes certain transactions fees which is deducted from the balance you receive that differs from paying in cash.

Secondly, value of FIAT and coins is fixed. We can’t divide cash unit freely. For example, you can’t get change of cash like ¥ 5.25. In contrast, UTXO can be any arbitrary value.

 

Verification of transactions

After miner receives transaction, he needs to verify the legality of the transaction. Here we need to verify the transaction from the following aspects:

Transaction input values should be greater or equal to the sum of transaction outputs.

Transaction data format includes the size of certain fields and encoding mode.

Each input of the transaction can be found in UTXO.

After the unlocking script and the locking script referenced by each input in transaction are executed, a return value of -1 will be on the stack.

So for the verification of a transaction here, only transaction of this time and the previous transaction (ancestor transaction) and information of transaction matter. It won’t increase the verification cost of other transactions. Such costs can be borne by the transaction itself, the only exception is the need to find its referenced ancestor transaction in UTXO.

 

Time complexity of transaction verification

UTXO is a collection of all unspent transaction outputs which is a collection including hash value and outputs. The time complexity of finding/inserting/deleting items in its implementation is O(log(n)).

The approach is highly efficient. Therefore, even if a huge UTXO data collection appears, the cost impact on a single transaction is minimal.

According to Moore’s Law, when capability of our computers increases, transaction verification cost will decline over time after reaching processing peak.

 

Next

We’ve already known the sending and verification cost of a single bitcoin transaction. In the following article, I will explain why Bitcoin technology can support huge volume transactions.

 

 


 

 

■ ■■■■

 

Collaboration

(WeChat ID:Mempool-q)

(Telegram:@Elvira1106

 

 

Customer service

(WeChat ID:ddpurse)

(Telegram:@DotWallet2020

 

 

■ ■■■■

 

 

For more information please visit

 

▼▼▼

 

website:www.dotwallet.com

Weibo: @打点钱包DotWallet

telegram:@DotWallet

Twitter: @wallet_dot