Notes: Blockchain

A block chain is a transaction database shared by all nodes participating in a system based on the Bitcoin protocol.

  • So technically, a block chain is a chain of blocks. Where, a block links to the previous block, thus creating a chain of blocks.
  • It is a transaction database, meaning that the blocks contain the transactions.
  • It is shared, or distributed in nature, as the same copy of the database is with all the nodes in the system.

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.

  • Each block contains, transaction, which can be used to extract the information of the balance of individual.

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 bitcoins transactions irreversible. The block chain is the main innovation of Bitcoin.

  • Kind of a “linked-list” of blocks
  • The first block is called “Genesis Block”
  • As the block contains the hash of previous block, any block in the history cannot be altered, without impact on the current blocks.
  • Because a block can only reference one previous block, it is impossible for two forked chains to merge.

The first work on a cryptographically secured chain of blocks was described in 1991 by Stuart Haber and W. Scott Stornetta

Merkle Trees

A Merkel Hash Tree is a data structure with built-in verifiability. The data is stored in blocks which form the leaves of the tree. Each data block is hashed, and the level in the tree above it is formed by nodes which store the hash of the sum of the two nodes below it. Read request responses are accompanied by a list of hashes, and a client only needs to know the root hash in order to be able to verify the authenticity of data returned from the server maintaining the tree. Hash trees are used extensively in distributed systems such as P2P file sharing applications.

Architecture

Python Implementation of Merkle tree