Difference between revisions of "Block chain"

From Bitcoin Wiki
Jump to: navigation, search
(Rewrote first two paragraphs)
(Rewrote another paragraph)
Line 5: Line 5:
 
Each block contains a [[Proof-of-work]] that protects the block chain. Generators will build on the valid chain that contains the most work (blocks don't neccesarily contain the same amount of work).
 
Each block contains a [[Proof-of-work]] that protects the block chain. Generators will build on the valid chain that contains the most work (blocks don't neccesarily contain the same amount of work).
  
For any block on the chain, there is only one path to the genesis block. Coming from the genesis block, however, there can be forks. One-block forks are created from time to time when two blocks are created just a few seconds apart. When that happens, generating nodes build onto whichever one of the blocks they received first. Whichever block ends up being included in the next block becomes part of the main chain because that chain is longer. More serious forks have occurred after fixing bugs that required backward-incompatible changes.
+
When two blocks are generated referencing the same previous block the block chain forks. This can happen for a number of reasons. If two blocks are generated simultaneously, the one that is built on by the next block will form the future chain. More serious forks can occur in a bug is found in the client which allows an invalid block chain to form, the chain will be recognised as invalid by future versions. As long as such invalid chains are recognized as such by at least 50% of computation power, the old block chain will be abandoned when more work has been put into the new one. Malicious clients attempting to fork the block chain (and thus alter transaction history) will not succeed unless they can perform work faster than normal clients (this is very unlikely).
  
 
Blocks in shorter chains (or invalid chains) are called "orphan blocks", and while they are stored, they are not used for anything. When a block becomes an orphan block, all of its valid transactions are re-added to the pool of queued transactions and will be included in another block. The 50 BTC reward for the orphan block will be lost, which is why a network-enforced 100-block maturation time for generations exists.
 
Blocks in shorter chains (or invalid chains) are called "orphan blocks", and while they are stored, they are not used for anything. When a block becomes an orphan block, all of its valid transactions are re-added to the pool of queued transactions and will be included in another block. The 50 BTC reward for the orphan block will be lost, which is why a network-enforced 100-block maturation time for generations exists.

Revision as of 22:05, 18 January 2011

Blocks in the main chain (black) are the longest series of blocks that go from the genesis block (green) to the current block. Orphan blocks (purple) are blocks that are not in the longest chain.

Every block contains a hash of the previous block. This has the effect of creating a chain of blocks from the genesis block to the current block. Each block is guaranteed to come after the previous block chronologically because the previous block's hash would otherwise not be known. The blocks thus form a history of the bitcoin state, with which address each bitcoin was assigned at a given time, it is not possible to change the contents of any block without invalidating the successive blocks (because its hash would change).

Each block contains a Proof-of-work that protects the block chain. Generators will build on the valid chain that contains the most work (blocks don't neccesarily contain the same amount of work).

When two blocks are generated referencing the same previous block the block chain forks. This can happen for a number of reasons. If two blocks are generated simultaneously, the one that is built on by the next block will form the future chain. More serious forks can occur in a bug is found in the client which allows an invalid block chain to form, the chain will be recognised as invalid by future versions. As long as such invalid chains are recognized as such by at least 50% of computation power, the old block chain will be abandoned when more work has been put into the new one. Malicious clients attempting to fork the block chain (and thus alter transaction history) will not succeed unless they can perform work faster than normal clients (this is very unlikely).

Blocks in shorter chains (or invalid chains) are called "orphan blocks", and while they are stored, they are not used for anything. When a block becomes an orphan block, all of its valid transactions are re-added to the pool of queued transactions and will be included in another block. The 50 BTC reward for the orphan block will be lost, which is why a network-enforced 100-block maturation time for generations exists.

Because a block can only reference one previous block, it is impossible for two forked chains to merge.