Friday, August 26, 2011

How POW is a solution to synchronization and global view.

One would question how the system handles consistency of block chains (or the transactions database) of every node. Each of the nodes must have all the transactions in their block chains.

Transactions are publicly announced and are broadcast to the network. If two same transactions are propagated nearly the same time, nodes will only accept the first one that arrives and incorporate it in their potential block, rejecting the second transaction. Now if the two transactions are almost sent to the network at the same time, majority of the nodes would receive the first transaction while the remaining nodes would accept the second one. The first transaction will obviously have a huge advantage on being included on the valid block and the block chain first since the collective CPU power of the majority nodes is greater than the other nodes. Note that the time of finding a proof-of-work by solving a block is proportional to the CPU power of all the nodes working on it. When a proof-of-work is found, the valid block will be propagated to other nodes. Nodes will drop their current potential block, add the received valid block to their block chain and work on a new block. The second transaction after seeing that the first transaction is in the new block chain will be considered as invalid.

Blocks are created every 10 minutes. If the average time becomes shorter up to a certain threshold, the difficulty of creating a block doubles. Suppose two different blocks (with slightly different transactions) are solved and propagated throughout the network nearly at the same time. A node keeps them both but only the first one that arrives is accepted to the chain. The transactions in the second valid block which are not in the first block will be included into the new potential block.

No comments:

Post a Comment