Block chain: Difference between revisions

From Bitcoin Wiki
Jump to navigation Jump to search
Sgornick (talk | contribs)
m More description of how BlockChain.info differs from Blockchain.
Sgornick (talk | contribs)
m Link changed.
Line 13: Line 13:
Because a block can only reference one previous block, it is impossible for two forked chains to merge.
Because a block can only reference one previous block, it is impossible for two forked chains to merge.


It's possible to use the block chain algorithm for non-financial purposes: see [[Alternative Chains]].
It's possible to use the block chain algorithm for non-financial purposes: see [[Alternative chain]].


[[Category:Technical]]
[[Category:Technical]]

Revision as of 21:56, 15 May 2012

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.

A block chain is a transaction database shared by all nodes participating in a crypto-currency such as Bitcoin. A full copy of a currency's block chain contains every transaction ever executed in the currency. With this information, one can find out how much value belonged to each address at any point in history.

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. Each block is also computationally impractical to modify once it has been in the chain for a while because every block after it would also have to be regenerated. These properties are what make double-spending of bitcoins very difficult. The block chain is the main innovation of Bitcoin.

Honest generators only build onto a block (by referencing it in blocks they create) if it is the latest block in the longest valid chain. "Length" is calculated as total combined difficulty of that chain, not number of blocks, though this distinction is only important in the context of a few potential attacks. A chain is valid if all of the blocks and transactions within it are valid, and only if it starts with the genesis block.

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.

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.

It's possible to use the block chain algorithm for non-financial purposes: see Alternative chain.

See Also