Blockchain Primer

EP - 036 published on March 18, 2018

Blockchain Primer

A simplified view into the mysterious blockchain technology that powers cryptocurrency

The Blockchain Funda

  • According to Hubspot research, one of the most confusing emerging technology.
  • Blockchain is a digital method of economic transaction record-keeping – also known as a ledger.
  • Security keeps it differentiated from other technologies. Records are kept open within a network but no one can edit or delete.
  • It is like a database that can be updated only through solving a complex mathematical problem.
  • The chain is linked through hash from the previous block and the chain continues to the hash from the genesis block which happens to be the first block in the entire chain.
  • Designed to be resistant to modification especially backdating or other tampering with the timestamps and other details in a financial transaction.
  • Latest fad in the tech industry.
  • Described back in 1991 to timestamp digital documents.
  • Used in 2008 by Satoshi Nakamoto to create cryptocurrency called Bitcoin.
  • Each block contains data, hash of the block and the hash of the previous block.

Bitcoin:

  • On 9 Jan, 2009, Satoshi Nakamoto announced the release of bitcoin as a peer to peer, completely de-centralised network with no server or central authority.
  • The idea was to eliminate any middle-man agents like banks or other agencies in the digital transactions.
  • In a centralised network, the server keeps a record of all the transactions and validates them. In a decentralised network, every entity on the network does the job of comparing and then validating the authenticity of the transaction.
  • Every peer keeps a list of the transactions to ensure all the future transactions are valid.
  • Basically cryptocurrency is an entry in a database which can be changed only under specific conditions. Which is true in case of a bank transaction as well.
  • Cryptocurrency usually consists of a network of peers and every peer has a complete history of all transactions ever happened and hence the balance of every account.
  • A transaction file is signed by individual private key and published in the network. The authenticity of the transaction is confirmed by miners.
  • Bitcoin file size grew to 20GB in 2014 and is currently over 100GB in size.

Miners:

  • Miners confirm the legitimacy of the transactions and broadcast that to the network. Once a miner confirms, the transaction gets added to the blockchain in all the peers.
  • Miners get paid back in the cryptocurrency for this. In case of Bitcoin, the miners earn a specific amount of Bitcoin for validating a transaction.
  • To be a miner, some amount of computing power has to be invested into finding the hash to connect the block to the chain.
  • Miners compete to solve a series of cryptographic puzzles and as a reward, they are allowed to add a transaction to the coinbase which is the valid way of creating bitcoins.
  • Bitcoins are created only when miners solve a puzzle. The difficulty of puzzle increases the computing power required to solve the puzzle and this results in only a specific amount of currency being created in a given amount of time.

Mining

  • Bitcoin mining requires a computer and a special software. Miners use the computing power of their systems to compete with other miners to solve a series of complex puzzles.
  • Every ten minutes, miners try to solve a block that has the latest transaction data in it using cryptographic hash functions.
  • Computer warehouses have been set up to create a business out of bitcoin mining.
  • There is a minimum difficulty level set for the hash for the miners to solve. If the incoming hash does not qualify for that level of difficulty, an arbitrary string called nonce is added to the hash and the new string is re-hashed to create a new hash and this new hash is compared to see if it conforms to the difficulty level expected. If not, the nonce is changed and the process is repeated until the required difficulty is attained.
  • Once required difficulty is attained, block it added to the blockchain and the ledger is updated. The miners are then rewarded using Bitcoins.

Why cryptocurrency:

  • Irreversible: Once a transaction is made, it is irreversible by anyone. There is no way you can dispute a transaction and get the money back.
  • Anonymous: Transactions and accounts are not usually connected to real-world entities. Transaction flow can be analysed by not necessarily the identity of the users.
  • Speed: The transactions are almost instantaneous irrespective of the location of the users.
  • Security: Since cryptography is extensively used in cryptocurrency, it is secure. Cryptocurrency can be sent only using the owners private key.
  • No middle-man: No permission is required to use cryptocurrency. There is no middle-man. Anyone can send or receive.

Hash

  • Hash is a method of taking an input string and encoding it to and output of fixed length. A hashing algorithm is used for this conversion. In case of Bitcoin, SHA-256 is used for hashing.
  • The fixed length of output helps in saving data that might otherwise be of considerable size.
  • Hashes remain the same irrespective of the number of times the data is passed through the algorithm.
  • Hashes cannot be converted back to its inputs but can be identified by comparing the data after hashing the possible values again.
  • Brute forcing becomes virtually impossible due to the sheer number of tries that is required. For a 128 bit hash, it will take anywhere between 1 and 2128-1 tries. That means an average of 2127 tries which is a huge number.
  • Any change in the input will reflect in the hash.
  • Collision resistance determines the chances of two different inputs producing the same hash. MD5’s (128-bit hash) collision resistance was broken after 221 hashes and SHA 1 (160-bit hash) was broken after 261 hashes. SHA 256 is used by bitcoin and Keccak 256 is produced by Etherium.
  • The blockchain is a linked list of data and it’s associated hash pointer which points to the hash of the previous block and hence forming a block.
  • So if an intruder changes data, the resulting hash changes drastically and will no longer have its pointer point to the previous block. This way the blockchain remain immutable (unchangeable).

Pixabay