Blockchain Tutorial: Overview of Basic Concepts and Use Cases

Blockchain as a technology has changed how a lot of our day-to-day life functions are carried out. Digital transactions, for example, have seen a major overhaul since Blockchain came into existence. The rising popularity of Blockchain is only indicative of the fact that there is a growing job market for this skill and soon Blockchain specialists will be in high demand. This article will provide an overview of the concept.

For an understanding of Blockchain, we’ll start with an example that will elucidate our point of view better: There's a hacker who wants to steal from a bank. Now, every bank runs on an ecosystem that is centralized and that itself acts as a centre point of failure. If the hacker is able to get into the system, all the customer information available could get corrupted and lead to huge losses. Although the hackers can be caught, the information that is compromised is very difficult to secure at a later stage.

This is where technology can make a difference. The remedy is setting up a block using Blockchain.

How does that work? This tutorial will explain all this and take you through the following:

What is Blockchain?

Overview of the Bitcoin story

Features of Blockchain, including

Public distributed ledger

Hash encryption

Proof of work consensus algorithm

Concept of mining

A use case showcasing how Blockchain can be used for banking operations

What is Blockchain?

Blockchain is a list of records called blocks which stores data publicly and in chronological order. The information is encrypted using cryptography to ensure that the privacy of the user is not compromised and data cannot be altered.

Information on a Blockchain network is not controlled by a centralized authority unlike modern financial institutions. The data is maintained by the participants of the network and they hold the democratic authority to approve any transaction which can happen on a Blockchain network. Therefore, a typical Blockchain network is a public Blockchain.

As long as you have access to the network, you have access to the data within the Blockchain. If you are a participant on the Blockchain network, you will have the same copy of the ledger which all other participants have. Even if one node or data on one particular participant computer gets corrupted, the other participants will be alerted immediately and they can rectify it as soon as possible.

The Bitcoin story

Bitcoin was introduced in 2009 by someone or a group of people known as Satoshi Nakamoto. It aimed to solve the problem faced by fiat currencies with the help of Blockchain technology. As of 2018, there were more than 1,600 cryptocurrencies that followed the concepts of Bitcoin and Blockchain, including, Ethereum, Litecoin, Dash, and Ripple.

Whenever a sender has made a transaction, he sends Bitcoins to a receiver by submitting the transaction on a public Blockchain network of Bitcoin. Verifications to authenticate users is done by the miners around the world. Basically, there are specific participants in the Bitcoin network who are identified as miners and they verify the authenticity of the sender and the receiver. They also validate whether the sender has enough Bitcoins to send to the receiver and also ensure that the sanity of the underlying Blockchain network to the Bitcoin is not corrupt.

Once the miner has authenticated the transaction and verified all the parameters, the transaction is added to a block and then that block is made part of the main Blockchain. After this is done, transactions which were associated in the block are executed. Once the transaction is complete, the block is added and the ledgers across all the nodes are updated, thereby allowing all the participants to have the same copy of the information.

What makes Blockchain so special: Features of Blockchain

These are the four features of Blockchain which we are going to talk about in detail:

We have a public distributed ledger, which works using a hashing encryption

Each and every block has a hash value which is the digital signature of the block

All the transactions are approved and verified on the Blockchain network using proof-of-work consensus algorithm

The Blockchain network utilizes the resources of the miners, who are there to validate the transactions for rewards

Distributed ledger: Let's imagine four friends sharing a particular document. If there was only a single copy of that document and one of them altered the data, it may go unnoticed. However, the outcome would be different if each one of them had a copy of the data. Therefore, if each and every participant has the same copy of the data, as soon as one of them changed it, the others would be able to spot the changes.

In a similar fashion, the data within a Blockchain is accessible to everyone as long as they are part of the network. You could access the entire history of transactions since the Blockchain was created. The first block in any Blockchain is called the Genesis block. From this block to the current block, you will have access to the entire chain. Any additions to the block have to always be approved by the participants in the Blockchain network. This is called the public part of the ledger and is important because any additions made to the Blockchain are permanent and immutable. Such transactions cannot be altered or modified and are available for audit 24*7.

If someone tries to modify data on a block on a particular node, the other ledgers which have the same information will be alerted that someone has modified data on a one particular node. There is no central authority controlling the working of Blockchain network.

What about security? How is privacy maintained if everything is so public? This brings us to hashing.

Hash encryption: To understand hashing encryption, we need to understand the contents of a block. A block is like a container that holds aggregated transactions. A block has two parts: a header and transaction details, which are aggregated in the block. The header has following attributes:

The block version number

Hash of the previous block to which it is linked

The current timestamp

The nonce

The target value

The transaction details are records of the transaction in which the sender is trying to send certain amounts of Bitcoins from his account to the receiver’s account. It is represented in the form of a 256 bit hash value in the header called the Merkel root or the hash root. The Merkel root is the hash of all the transactions structured in a Merkel tree called the binary tree. It's a kind of a binary tree and the hash value of the root node of the Merkel tree is called the Merkel root hash.

The transaction details of a block are contained in the header in a hex value known as the Merkel root. This can be calculated by passing a list of each transaction through a hashing algorithm and following it up by pairing all the hashes of the transactions and passing them through another hashing algorithm until only one value remains which will be the root.

Now, let’s look at how a hash function works. Blockchain utilizes a hash function to perform cryptography. Data from a data set of random size is sent as input to a hashing function to get an encrypted value of each size. This is the feature of any hashing function. Some unique properties of hashing function are:

These are deterministic; the same input will always produce the same hash output

Small changes in the data can drastically change the output

It can be computed easily

Hashing functions are one-way functions;ou won't be able to determine the input based on the output value

Let's go back to our block now and look at the features in the header. The previous hash is the resultant hash of the previous block in the Blockchain. This is the way two blocks are linked together.

Transaction details are used to provide details about the sender-receiver and how much money they want to exchange. This is a list of transactions and they are structured in a Merkel tree. The hash of the Merkel root is put in the header.

Nonce is a value that is varied to create a unique hash address of the block which should be less than the target hash value.

This is the structure of the header it has a block version number. The entire header is then passed through a hashing algorithm in the case of a Bitcoin network. It is SHA256 and a hash value is generated thereafter. Now this hash value becomes the hash value of the block that is used to uniquely identify the particular block. SHA256 ensures that alterations to data can be easily detected.

Refer to our video for this example. Consider the two blocks in the Blockchain. They have a similar structure and different hash values. If someone alters the transaction details in the first block, the corresponding hash value of the block would change too. If the hash value of the first block and the previous hash value of the other block does not match, the block subsequent to the hacked block will get de-linked. This would raise an alarm among the users informing them of the data alteration. The users will then be able to flag the block and the alteration can be easily identified and rectified.

To add another layer of security, Blockchain also includes digital signatures. These ensure that the message comes from the right identity to the right person and that the message is not tampered with. Users are also provided with their own private and public key. A private key is used by the user to control his/her own account. This is kept as a secret by the user and acts like his own password. The public key is used to identify the user on the network. This is shared by the user along with the transaction on the network for others to verify.

Steps involved in creating and authenticating a digital signature

On the sender side, the message to be transmitted is passed through the hashing algorithm. In case of Bitcoin it is SHA256. The message is passed through the hashing algorithm to produce a hash value. This output is passed through a signature algorithm along with the user's private key to create a digital signature. During the transmission, the user’s message, their digital fingerprint that was generated in the previous step, and the public key are transmitted across the network. These three things are published on the network for the miners to verify the authenticity of the sender.

On the receiver’s end, first the message is passed through a hashing algorithm and at the same time, the sender's public key and his or her digital signature are passed through a verification algorithm. Both the functions generate a hash and if both the hashes are compared and they match, the transaction and the identity of the sender is approved.

Proof of work consensus algorithm

What about the people who verify these transactions and how do they actually do it? This question gets us to our third feature which is the proof-of-work consensus algorithm.

This involves miners around the world, who are trying to solve mathematical puzzles to be the first one to add a block to the Blockchain and be rewarded.

The miners need to find a hash value that satisfies certain predefined conditions. In order to find the hash value, they use nonce. The target hash value is decided months in advance for every block. The miners keep changing the nonce value to find an output that falls within the target requirement. They keep on generating a hash value using the nonce and if it is less than the target, the hash value is accepted and if it is greater than the hash value, it is rejected and the miner’s effort is not considered valid.

When a miner transmits that he has found the nonce that satisfies the target requirement, the claim can be verified by others. While the use of proof-of-work algorithm is very hard to use to generate the nonce and get the hash value, it is very easy to verify the transaction by the other miners.

Miners

Miners get paid in Bitcoins and a successful verification is the only way the Bitcoins get added to the network. This is the concept of mining and when a miner has completed the proof of work consensus, he is rewarded.

A miner’s fee is 12.5 Bitcoins for adding a block onto the Blockchain, however, the reward reduces by half every four years. When the fourth year approaches, the Bitcoin reward will go down to 6.25 Bitcoins and miners also get the sum of all the transaction fees for a particular block.

Blockchain as a use case in banking

Blockchain finds tremendous use in banking. As of now, a user validates his identity to each bank he goes to, over and over. Is there a way we can ease the process with Blockchain? The answer is yes. We can use truffle, ethereum, ganache and smart contracts, which are part of the Blockchain technology ecosystem, to make it work.

Check out our video to see a demo of how you can build a bank’s KYC using Blockchain.

Conclusion

Are you intrigued by Blockchain technology? If you want to know more, check out our free resources on Blockchain and how it is impacting businesses around the world. You can also check out our Blockchain Certification Training Course and sign up today to begin a career in this burgeoning field.

About the Author

Simplilearn is one of the world’s leading providers of online training for Digital Marketing, Cloud Computing, Project Management, Data Science, IT, Software Development, and many other emerging technologies.