Kush's Blog

Kush's Blog

Fundamentals of Blockchain

Fundamentals of Blockchain

What is blockchain ?

The whole point of using a blockchain is to let people — in particular, people who don't trust one another — share valuable data in a secure, tamperproof way. — MIT Technology Review

A blockchain is a type of database; its a way of storing records of value and transactions however it differs from a typical database.

Blockchains store the data in blocks which are then chained together.

It is a growing list of records, called blocks, that are linked together using cryptography where each block contains a cryptographic hash of the previous block along with a timestamp and transaction data.

Nowadays most transactions between people require an intermediary to provide trust, security, and facilitate the transaction e.g., banks, financial institutions.

Blockchain removes the need of an intermediary, so that people can easily transact directly with each other.

Merkle trees

Merkle tree also known as hash tree is a data structure used for data verification and synchronization. It is a tree data structure where each non-leaf node is a hash of it’s child nodes.

The Merkle Tree has been around since 1979, Ralph Merkle wrote a paper titled “A Certified Digital Signature” during his time at Stanford, and unknowingly created a major component of blockchain.

In his paper, Merkle described a brand new method of creating proofs. Essentially, Merkle designed a process for verifying data that would allow computers to work much faster than before.

Merkle tree are basically binary trees that contain cryptographic hashes, they are also known as Binary Hash Tree.

merkleTree.JPG

Bitcoin vs. Blockchain

The goal of blockchain is to allow digital information to be recorded and distributed, but not edited.

Blockchain technology was first outlined in 1991 by Stuart Haber and W. Scott Stornetta, two researchers who wanted to implement a system where document timestamps could not be tampered with.

But it wasn’t until almost two decades later, with the launch of Bitcoin in January 2009, that blockchain had its first real-world application.

The Bitcoin protocol is built on a blockchain. In a research paper introducing the digital currency, Bitcoin’s pseudonymous creator, Satoshi Nakamoto, referred to it as “a new electronic cash system that’s fully peer-to-peer, with no trusted third party.”

  • Bitcoin is a cryptocurrency, while blockchain is a distributed database.
  • Bitcoin is powered by blockchain technology, but blockchain has found many uses beyond Bitcoin.
  • Bitcoin promotes anonymity, while blockchain is about transparency.
  • Bitcoin transfers currency between users, while blockchain can be used to transfer all sorts of things, including information or property ownership rights.

How blockchain works ?

Lets take the e.g. of Bitcoin blockchain which uses SHA-256 algorithm.

The SHA-256 algorithm generates unique, fixed size 256 bit hash, which is like a secret code that uses an encryption method to hide the given data in a way that makes it impossible to decrypt without proper authorization.

This hash that is generated is always of the same length for any amount of data entered.

Even if one letter is changed in the data the whole hash will completely change. The hash that is generated is random and it has no connection whatsoever with the data entered.

Therefore it is impossible to figure out the original data from the hash unless you already know the data or you have a private key.

Then the transactions are hashed into blocks.

hashBlock.JPG

The first block in a blockchain is block 0 or genesis block. There are 4 blocks, these four blocks have four pieces of data which have been converted to hashes.

These hashes are then added to block to create a blockchain that links them.

howBlockChainWorks.JPG

Blockchain consists of three important concepts:

  • Block
  • Miners
  • Nodes

Block

Every chain consists of multiple blocks and each block has three basic elements:

  • The data in the block.
  • A 32-bit whole number called a nonce. The nonce is randomly generated when a block is created, which then generates a block header hash.
  • The hash is a 256-bit number wedded to the nonce. It must start with a huge number of zeroes (i.e., be extremely small).

When the first block of a chain is created, a nonce generates the cryptographic hash. The data in the block is considered signed and forever tied to the nonce and hash unless it is mined.

blocksInBlockChain.JPG

Miners

Miners create new blocks on the chain through a process called mining.

In a blockchain every block has its own unique nonce and hash, but also references the hash of the previous block in the chain.

There are roughly four billion potential nonce-hash combos that have got to be deep-mined before the correct one is found.

When that happens, miners are said to have found the "golden nonce" and their block is added to the chain.

miners.JPG

Nodes

One of the most important concepts in blockchain technology is decentralization.

No one computer or organization can own the chain. Instead, it is a distributed ledger via the nodes connected to the chain.

Nodes can be any kind of electronic device that maintains copies of the blockchain and keeps the network functioning.

Every node has its own copy of the blockchain and therefore the network should algorithmically approve any freshly deep-mined block for the chain to be updated, trustworthy and verified.

nodes.JPG

Decentralization

Decentralization … confers onto local communities the power… to manage their affairs in order to promote their own development. -Bakary Thaore, Action Collective, (A Burkina Faso Publication on decentralization), October 2001.

By storing data across its peer-to-peer network, the blockchain eliminates a number of risks that come with data being held centrally.

The decentralized blockchain may use ad hoc message passing and distributed networking.

One risk of a lack of a decentralization is a so-called "51% attack" where a central entity can gain control of more than half of a network and can manipulate that specific blockchain record at-will, allowing double-spending.

decentralized.JPG

Advantages of Blockchain

Transparency

The data, when in a blockchain, is stored on a distributed network.

The participants on the blockchain network share the same data as opposed to individual copies of the same data which cannot be updated with the consensus from the other participants.

If anyone tries to change any information in the record, it will be nearly impossible for them to do it for all the blocks that their data exists in.

Removal of Intermediaries

Blockchain based systems allow for the removal of intermediaries involved in the record keeping and transfer of assets.

Traceability

With the blockchain ledger, each time an exchange of goods is recorded on a Blockchain, an audit trail is present to trace where the goods came from.

Decentralization

Blockchain-based systems can run on a decentralized network of computers, reducing the risk of hacking, server downtime and loss of data.

Security

Blockchain is far more secure than other record keeping systems because each new transaction is encrypted and linked to the previous transaction.

Faster processing

After the blockchain technology, speed of the transaction increased to a very high extent.

Before this, the overall banking process takes around three days to settle but after the introduction of Blockchain, the time reduced to nearly minutes or even seconds.

Interested in reading more such articles from Kushagra Sharma?

Support the author by donating an amount of your choice.