简体   繁体   中英

How pending transactions are given to the miners to mine in Ethereum?

我需要知道如何将待处理的交易给予矿工以进行挖掘,以及如何获得每笔交易的奖励。

Transactions are not given to the miners, instead, miners are given the work for a particular block for which they have to find a hash which is below a certain target (target is computed from difficulty). The work consists of a Header Hash on which the hashing is actually performed. Each full node first creates a block, puts all the transactions in the block computes the state root and other parameters and then creates the work which is then sent to the miners. Once the miner finds a hash which is below the target, the miner then sends the solution back to the node. The node checks for the solution and accepts the block if the solution is correct.

Transaction's reward is the transaction fees which are collected by all the transactions fees from a given block. So, if a miner mines a block with 10 transactions and each transaction of 0.5eth fees then the total fees collected will be 5eth. However, in reality, the transaction fees are calculated by the amount of Gas consumed multiplied by the gas price paid by the sender.

Hope this helps.

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