简体   繁体   中英

Transaction verification in Blockchain

Lets consider that we have an AltCoin named ABCCoin,ABC. I will be referred as X, mined a block and got a freshly minted 25 ABC as a mining reward. Now, I want to gift this coin a friend Y. So,

Tx: X -> Y : 25ABC

And lets assume that this was stored in block B100. Now after some months, Ms. Y wants to transfer it to Z for any reason. So,

Tx: Y -> Z : 25ABC

Now, after few months later. Mr. Z wanted to buy a coffee in starbucks while going on a date with his girlfriend.

Now the chain of transcation will be as below:

|Tx|Minted -> X |
   --> "Tx: X -> Y : 25ABC" 
   --> "Tx: Y -> Z : 25ABC"
   --> "Tx: Z -> Starbucks : 25ABC"

So, in this situation. When we need to verify "Tx: Z -> Starbucks : 25ABC" do we have to trace it back the origin, ie to the point when this coin was minted OR can it be just verified just by check its immediate source. ie "Tx: X -> Y : 25ABC" and dont care about other previous.

Assuming You are asking about UTXO transaction based blockchains like bitcoin.

There are 2 types of verification

  1. FullNode Verification

  2. SPV Verification

Full node

Full node is a program that fully validates transactions and blocks such as bitcoind , litecoind or geth . So every time a full node receives new block from other peer, It does validate all transactions in the block and adds to its blockchain and update a list of UTXOs only if the block is fully valid.

to validate transactions, full node checks something like

  • Transaction format
  • Transaction signature(s)
  • find Previous transactions from its blockchain
  • double spending transaction existence

Because a full node has a list of UTXOs that it believes correct, checking transaction format/signatures and the list of UTXOs are enough to validate new transaction.

SPV

SPV client doesn't have full blockchain data nor a list of UTXOs, SPV checks only if a transaction is in a block using MarkleTree and block which contains the transaction satisfies block difficulty or not. And this is all SPV can check because It has to check all blockheader and blockbody one by one to create UTXOs list. So SPV cannot check if it's double spending transaction or not. But still, Because It costs a lot to create a fake block as long as a blockchain has enough difficulty, It's usable validation. like @Haardik mentioned in the comment, obntaining trustable UTXOs list without downloading all blockchain data using markle tree might be coming in the future update

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM