[Reprint] Bitcoin nature is actually UTXO

In fact, the essence of Bitcoin is UTXO

https://www.jianshu.com/p/7071e68c5262

 

In fact, there is nothing Bitcoin Bitcoin balance we show on the exchange or purse is actually UTXO. That in the end what is UTXO it, UTXO full name Unspent Transaction Output, translates the output of the transaction has not been spent.

It seems to me still do not understand. . . . ?

Bitcoin block chain in the record books of a sum of the transaction, each transaction has a number of input transactions (transfers are), which is the source of funds, but also a number of transaction output (payee), also that is, the money goes. Each transaction must spend a sum of input and generates a sum output, and this generated output is UTXO.

As a simple example:
There are a btc the address A, A should be transferred to a btc B, then the input is on the books A, address B is output transactions, then the script will check whether there is an address A a btc (balance enough how would you turn), that query to a certain sum output (UTXO) in the a does have a btc. So A can be transferred to a btc B as input, then there is a deal worth a btc address output point B, B at once until the deal is output B is not spent (UTXO) before transfers. Transferred to the subsequent B C B A-to-time and the operation is repeated.

One more complicated example:

 
  • The first transaction is Joe Smith # 1001 mining resulting coinbase transaction, the transaction is coinbase mining transaction, when the mining machine to find a qualified block after it obtained a privilege, can create a coinbase transaction, and the transaction output write their address, Joe Smith won 12.5 btc by mining, that is worth 12.5 btc the UTXO points to his address.
  • The second transaction seating transfer 2.5 btc to John Doe, John Doe # 2001 on the launch of the transaction, capital input is # 1001 (1), and in this UTXO transaction output in the 2.5 btc income payee address for John Doe. But the deal must be put on a UTXO completely consumed, so also the rest of the payment address transaction output 10btc for Joe Smith himself.
  • The third deal with Joe Smith and John Doe transferred king five five btc, Joe Smith or John Doe # 3001 initiated the transaction, input source has two parts, one is # 2001 (1) and # 2001 (2), output for the payment address king five. Joe Smith and left the 7.5 btc output to its own address. If you need to follow Wang Wu spent his five btc, you need to enter # 3001 (1)

Examples of transaction data

 

FIG above is a transaction, a plurality of inputs and a plurality of output TxIn TxOut.

  • prev hash, which indicates that the transaction is entered in the hash output.
  • index, indicates the index in prev hash of the transaction.
  • btc, the number of arrival btc
  • pkScript, namely publicKey Script, locking the script, you need to do to spend the UTXO.

The first line of mining revenue transaction is often referred to coinbase, it did not enter, so TxIn the hash is marked as 00000 ... 000, index is ffff.
From the second line are some of the transfer transaction, the only dates back to the block chain any TxIn will hash a transaction prior to this block, and an index.

 

FIG transactions and the hash index (starting from 0), the output of a transaction can be uniquely determined unspent, so that each Tx In both before and an associated TxOut. PkScript which is locked script, we need to verify this UTXO spent by the script to use the UTXO.

Verify the transaction script is how to verify?

to sum up

Bitcoin is not based on the account of the scheme, but on UTXO program. The traditional bank accounts and thinking is completely different. Joe Smith has 10 btc, in fact, the current block chain in the books, there are a number of transactions of output (UTXO) the payee's address is Joe Smith, and the total amount of these UXTO is 10. This address received a total number of UTXO, on behalf of the track is to be calculated by Bitcoin wallet, the wallet balance shows how much is actually btc value of output point to your address.

 
 
1 person thumbs up
 

Guess you like

Origin www.cnblogs.com/jinanxiaolaohu/p/11781526.html