Basics Of Blockchain

Nowadays, a lot of buzz is going around about a technology named Blockchain. Lots of people are wondering 'what it is', meanwhile many of the industry giants have already invested in Blockchain start-ups. Banks and financial institutions are adopting this technology faster than expected. C# Corner also launched Blockchain learning for developers’ awareness. Thank you C# Corner team.

In this article, we are going to discuss the basics of blockchain and questions like why, what, and how.

WHY Blockchain?

To understand the issue with existing system, first let’s have a look at traditional money transfer methods.

  1. When a buyer wants to send money to a seller, buyer and seller must have an account with a bank and both parties must trust the bank (which is third party as it is not involved in transaction) for maintaining their balances.
  2. Buyer will send money transfer request to bank for seller's account.
  3. Bank will not transfer money physically to seller but it will make an entry of this transaction in its ledger. This ledger is with bank only i.e. it is located centrally.
  4. Bank will deduct the amount from buyer’s account and credit it to seller's account.

This looks good, but what if,

  • Transaction data is altered by bank person or software, purposefully or mistakenly.
  • Centralize ledger is corrupted.

Solution to such queries is BLOCKCHAIN. Author Satoshi Nakamoto published a document in 2008 regarding peer to peer digital currency (named as bitcoin) transfer with a trust-less system. Blockchain is the technological term behind bitcoin network implementation.

What is Blockchain?

To resolve the issues associated with centralized ledger, blockchain recommends maintaining transaction's copy at every user which will make the ledger distributed. All transactions will be maintained in a sequential manner. Every transaction named BLOCK will contain unique ID of previous transaction (block). It will form a chain of blocks connected with each other and hence the BLOCKCHAIN.

How Blockchain works?

We need to remove dependency on third party trust. So, people with the same thought would come together and form a group, termed as a NETWORK. This group will have network ids of each other but unaware of id to user mapping. Every user in network will have its own container for transactions, termed as LEDGER. Whenever transaction happens, it will get added to that container.

Let’s say we have 5 users in the network (details mentioned in diagram, name and their IDs). Assume that buyer and seller (from previous example) also joined this network for a fund transfer.



Buyer wants to transfer a fund to the seller, so he/she will create a block with details like from user's name, to user's name, and amount. And he/she will broadcast the block to all network users. Users can see network IDs of from and to user (not the exact user names) and amount.

Users will validate the block by checking balance of Buyer account, if he has sufficient balance, transaction will be approved and every user will add this block to their ledgers.

How sender is validated?

When user creates a block, user also needs to send digitally signed data with the block. User will have private key associated with the account to sign the data. Other network users will verify transaction by providing public key to validation algorithm.

What is Mining?

There is puzzle associated with the block. After validating the transaction data, network users need to solve this puzzle to publish the block as valid block to other users. This is a mathematical puzzle which involves Hash Function. Hash function is a one way function which does complex mathematical operations on input data and gives output. It is difficult to find out input data by looking at the output. Hence, it is also called irreversible.

Let's take an example. The puzzle is to find out the value of ‘x’ where x is previous block hash and current transaction data when provided to HASH function, it will give output data starting with string ‘4444’ (like 4444……….667)

To find out value of ‘x’, users need to try different values of ‘x’ and feed it to HASH function to see the output. This will consume CPU for processing. The more CPUs you have, the faster you can solve the puzzle. Those who take part in solving puzzles are called as MINERS. They are mining the block by computing efforts.

One who solves the puzzle, will broadcast the block with value of ‘x’ i.e. solution of puzzle named as ‘nonce. Other users will check output by passing nonce value and other parameters to hash function. If the majority of users agree, the block will be added to the individual ledgers.

In our case, if Akshay (#4444) mined the block, he will send block with nonce value to all users. They will verify the nonce value and if valid, they will update respective ledgers. This is how ledgers will be kept updated. If in future, anyone tampered with  the block data, this ‘nonce’ will allow network users to check integrity of block data.

This is all about Blockchain basics. In upcoming articles, we will look into Ethereum Blockchain as a Service by Azure.

 Till then keep mining for blockchain articles.
 

Up Next
    Ebook Download
    View all
    Learn
    View all