简体   繁体   中英

Transaction Validity in bitcoin blockchain

I was reading about the working of blockchain in a bitcoin transaction, I have understood a lot about it, that the blocks are interconnected, block contains the hash of previous block, whenever a block is created the miners tries to solve a math puzzle so called proof of work and whoever solve it first, earn a bitcoin and that block is added, the one having the longest will considered as valid blockchain

What I didn't get is whenever there is a set of transaction, a block is created, suppose if one of the transaction in that is invalid, so what miners will start doing is to solve a puzzle, but what that puzzle has to do with checking of that invalid transaction ??

Block puzzle is irrelevant to transaction validity or invalidity.

Whenever miner (or another node) receives a new transaction from a peer, he validates transaction versus existing blockchain and some inner rules. If transaction is valid, miner adds this transaction into mempool, and forwards to a peers.

When transaction is added to the mempool, there is changed merkle root of mempool, which presents in the block header.

In process, miner trying to select nonce value, for generate hash of the block header less than target value.

If miner found a nonce, satisfy network rule, he distributes to a peers the block, contains valid transactions only (packed from mempool).

Peers, whenever receive the block, validate all transactions from this block and validate block integrity with check merkle tree and block hash.

Thus, if malicious miner adds invalid transaction to his block, his peers just reject such block.

they solve the puzzle first, after finding the desired nonce they create a block containing VALID transaction from mempool, previous hash and a specific transaction sending themselves the transaction fees and the reward of solving the puzzle.

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