简体   繁体   English

比特币区块链中的交易有效性

[英]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我正在阅读有关区块链在比特币交易中的工作,对此我了解很多,这些块是相互连接的,块包含前一个块的 hash,每当创建一个块时,矿工都会尝试解决所谓的数学难题工作量证明,无论谁先解决它,都可以获得一个比特币并添加该区块,具有最长的区块将被视为有效区块链

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.当交易添加到内存池时,内存池的默克尔根会发生变化,它出现在区块 header 中。

In process, miner trying to select nonce value, for generate hash of the block header less than target value.在此过程中,矿工试图 select随机值,以生成小于目标值的块 header 的 hash。

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.对等节点,无论何时收到块,验证来自该块的所有交易,并使用检查 merkle 树和块 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.他们首先解决了这个难题,在找到所需的 nonce 后,他们创建了一个包含来自 mempool 的 VALID 交易、先前的 hash 和一个特定交易的块,向自己发送交易费用和解决难题的奖励。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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