Block chain

Revision as of 05:08, 22 October 2019 by Brendan (talk | contribs)

DISCLAIMER

This article is a direct copy of the original https://en.bitcoin.it/wiki/Block_chain and has not been checked for correctness or edited. 9 October 2019 Expected review by: 20 October 2019

22/10 First edit by Brendan Lee


A block chain is a transaction database shared by all nodes participating in a system based on the Bitcoin protocol. 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 reference to the block it builds upon. 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.

Honest miners only build on a block (by referencing it in blocks they create) if it is the latest block in the longest valid chain. A chain is valid if all of the blocks and transactions within it are valid, and only if it starts with the genesis block. Miners can dispute blocks by choosing not to build upon them. A block that is not built upon is called an Orphan 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. Forks can be created from time to time when two valid blocks are created just a few seconds apart. When that happens, nodes will attempt to build a new block whichever one of the blocks they received first. When a new block is found, the block it built upon becomes part of the main chain, orphaning its competitor.

Forks can also occur when nodes disagree on network rules. Two notable forks have occurred on Bitcoin, the first in 2017 when Bitcoin was forked onto the BCH network when BTC nodes elected to adopt Segregated Witness into the BTC network rules, and again in November 2018 when BCH nodes elected to implement new opcodes and consensus rules that were unaligned with the original protocol.

Blocks in shorter chains (or invalid chains) are not used for anything. When the bitcoin client switches to another, longer chain, all valid transactions of the blocks inside the shorter chain are re-added to the pool of queued transactions and will be included in another block. The reward for the blocks on the shorter chain will not be present in the longest chain, so they will be practically 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.

The block chain is broadcast to all nodes on the networking using the Bitcoin Network protocol.