3

I have been trying to understand the protocol and reading related documents, there is a point where i get stuck.

As far as i understand (correct me if not), when a transaction occurs, it is broadcast to the network and some miners receive it. When a certain number of transactions is reached, they are packed in a block and hash race begins.

What i fail to understand is; in this scheme, don't all the miners have to be in perfect memory coherence and time sync, so that they know when a block is to be sealed and start to iterate for hashes? Or do they not need to mine and hash the same global block, but have separate blocks which are later validated by other miners and interblock transaction collisions don't matter?

I know i misunderstand a very basic point in the protocol, but i can't figure what.

1

2 Answers 2

4

A miner begins creating a new block as soon as it receives a valid block from another miner. It then begins to construct and hash the next block on top of the block it just received.

You were correct when you thought that each miner has a separate block from the rest. Don't look at it as if miners are all cooperating to find a hash for the same block, but rather are competing against each other to make their own block the next in the chain. If they find a valid block, they broadcast it, and other miners give up their efforts, and instead focus their hashing power on the next block.

3
  • Alright... So for example transactions a, b, c and d have been submitted to miner M1; transactions c, d, e, f and g have been submitted to miner M2. Both M1 and M2 are on head BC1. M1 finds a legit hash and announces the new blockchain BC2. Now what about M2? Current BC2 does not contain e, f and g. M2 might start a new block candidate B3, but this will cause transactions c and d to be duplicates. M2's ex-block B2' cannot be completely dropped either, that would cause e, f and g to vanish.
    – corsel
    May 6, 2016 at 13:56
  • @corsel: M2 generates a new block header B4 that contains transactions e,f,g only, and starts looking for a matching nonce for it. May 6, 2016 at 13:59
  • Ah, so the blockchain is always in sync and are to be validated by majority of network, whereas block candidates are local and at the miners' will completely... If a malicious blockchain appears, it will be tested and rejected by other miners, or trying to manipulate history by hashing in deep levels fails, as in less time, a new chain will be announced.
    – corsel
    May 6, 2016 at 14:03
2

Part of your misconception is this: "when a certain number of transactions are reached". Mining doesn't need any particular number of transactions; it's legal to have a block with no transactions at all (except for the "coinbase" block reward transaction). The "hash race" is always going on; it doesn't start and stop. When a miner gets a new transaction, they just include it with the transactions they already have, generate a new block header, and continue hashing on the new header. There is no requirement that all miners be working with the same set of transactions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.