“Blockchain”, this word is a very famous and very commonly heard and used word in the technology field nowadays. The very hot topic nowadays in technical, as well as financial fields, is Cryptocurrency. Cryptocurrency is also based on blockchain technology. So, it is very important to understand what a blockchain is, the structure of blockchain, and the features of blockchain. In this discussion, we are going to cover in-depth, the basic structure of a blockchain, and the features of blockchain. We will be discussing the structure of a block chain in detail first before going to the features as one cannot understand the features of a blockchain without knowing its structure.
What is a Blockchain?
Blockchain is a decentralized and distributed ledger. It was first introduced by Satoshi Nakamoto.
Fun Fact: Some people say that the person in the above photo is Satoshi Nakamoto. However, the reality is unknown because there is no evidence of anyone being Satoshi Nakamoto, the blockchain developer. Satoshi Nakamoto can be a person or a group of persons. The truth is that no one knows who developed the blockchain and most probably, no one will ever know.
Now, we will see the meaning of the above definition in detail. First, let us understand it in layman’s terms. What does the word “Blockchain” suggest about its meaning? Well, it is easy to guess that it is a chain of blocks. Now, to extend it further, let us say for now that a blockchain is a chain of blocks that carries some information. What kind of information does it have? Usually, blockchain has the details of transactions. Hence, it is called a “Ledger” since a ledger is a physical record book that contains all the transactions and their details of a particular organization.
So, we have got an idea that blockchain will be a chain type of structure and the blocks will contain data regarding the transactions. We now know the meaning of one word from the definition i.e. a ledger and why we call a blockchain a ledger. We will see why we have used the words “decentralized” and “distributed” in the features of the blockchain. For now, let us try to understand some more about the physical structure of a blockchain.
What does a Blockchain Look Like?
The physical structure of a blockchain looks like a Linked List data structure. In a Linked List, the nodes are connected to each other via the next pointers (i.e. each node has in the linked list has the address of the next node in the linked list (singly)) and in the blockchain, the blocks are connected to each other via a hash value. How? Let us see in the figure given below:
The diagram above shows the structure of the blockchain. The blockchain is the chain of blocks where each block contains certain properties. The very first property is called the hash of the block. The hash is a unique value that is assigned to every block in a blockchain. So, every block in a blockchain can be uniquely identified by its own hash. The blocks in the blockchain also have a property called the LastHash or the Previous Hash. This is the hash value of the previous block in the blockchain. So, with the help of the previous hash or Last Hash, we can get access to the previous block of the blockchain and this can be imagined in a way that the blocks are connected to each other via this Last Hash.
The blocks also have a property called the timestamp. The timestamp of a block depicts the exact time (in milliseconds) of creation of a block. Finally, the block contains the data. What data does a block contain? Usually, blockchain contains the data about transactions as blockchain is usually used as a ledger.
Some more knowledge about the hash value
The hash value that each block of a blockchain possesses is a unique hash code that is generated using some hashing algorithms. The examples of some such algorithms are SHA-256, SHA-224, etc. Here, SHA stands for Secure Hashing Algorithm. Since it is an algorithm, it would take something as an input. So, what is the input that we give to these algorithms to generate a unique hash value for a block?
Well, the timestamp of the block, its data (transaction data), and the hash of the previous block are the inputs to these hashing algorithms that generate a unique hash value for our current block. This is a very smart technique to generate a unique hash value as the exact timestamp and hash of the previous block combined together are going to be unique only.
The Genesis Block
We learnt above that a block’s hash value is a unique value that is generated using the timestamp, data and the hash of the previous block. But, the blockchain would start at some point, right? So, what is the very first block of the blockchain and how does it look? Let us see the diagram shown below:
The first block in the blockchain is called the Genesis Block. This block contains some random data (this can be anything) and the timestamp of the creation of this block. The hash of this block can be generated using the data and the timestamp because this block has no previous block to contribute to its hash value. So, this is the genesis block of the blockchain. All the other blocks have the same structure that we discussed in the above section. Only the genesis block is a little bit unique as it does not have a last block.
Mining a Block
The process of adding a new block to the blockchain is called mining. It is called mining because mining literally means extracting minerals from the ground. This requires a lot of cost and a lot of hard work in terms of manual labor. In the same way, mining a block i.e. adding a new block to the blockchain is a very difficult and costly task so that no unauthorized person can make changes to the blockchain.
Why is Mining Costly? (Blockchain Validation)
The process of adding a block to a blockchain i.e. mining is called so as it is very difficult and costly to do it. This is because it is not simply adding a block to the blockchain, rather creating an entirely new central blockchain every time. How? Let us see it, but, before that, we should know about the rule of blockchain validation.
Blockchain Validation Rule: Mining a block is successful only if the block added to the blockchain is valid i.e. its hash value matches with what the hash value should have been (considering its timestamp, last hash, and data) and also if the length of the new blockchain created by adding this block is greater than that of the previous blockchain. Also, longer length blockchain is preferred.
So, when a miner adds a block to the blockchain, first it is verified that whether the block has the correct hash value that it should have based on the last hash, the timestamp and the data. This is called validating a block. Validating a block is itself a tough task but for now, let us keep it abstract. After the block validation, the block is added to the miner’s copy of the blockchain and now we have to make changes to the main blockchain. So, it is checked whether the miner’s blockchain has a length greater than the previous main blockchain. If it is, then the central/main blockchain is replaced by the new blockchain and the blockchain of each miner is also replaced by the new blockchain.
Hence, mining is such a costly and difficult task.
We will not go into the depth of this topic as it requires a lot more knowledge of blockchain than just the basic structure. However, to give you an idea, you can understand in simple terms that since mining a block is such a difficult task, it makes attacking really difficult. This concept says that to attack a blockchain to misuse it, the attacker will have to change 51% of the blockchain. Currently, if we take the example of bitcoin, in order to make a 51% attack, it is estimated that the cost will be almost 13 billion US Dollars. So, the cost is so high that the attack is not that easy.
So, now that we have enough knowledge of the blockchain and its structure, let us discuss the features of blockchain :
Features of Blockchain
We said that we will understand the meaning of the two words, “decentralized” and “distributed” that we have used in the definition of the blockchain. So, the very first feature of a blockchain is that it is decentralized decentralised. What does it mean? Let us understand the meaning with the help of an example.
Let us say that you have an account at any bank ABC. Now, if you want to know some details about your previous transactions or some kind of information related to your bank account, who will you refer to? Yes, the bank itself. So, do you have any control over the data and transactions? No!! This is because the banking system is a centralized system.
This means that the bank holds the central authority of your data and transactions. So, for your own data and own transactions and especially, your own money too, you have to reach out to the bank for even very small tasks as it is the central authority.
However, blockchain is a decentralized system. Your data and transactions are owned by you and can control them yourself. Various organizations working on the blockchain have their own copy of the blockchain and they make changes to that copy directly themselves. After the changes are made, the blockchain validation takes place to check whether the changes made are valid or not. If there is no disruption of validation, the latest blockchain with the changes becomes the new main blockchain and every organization now has the copy of this new blockchain.
So, because of this, the authority is with the individuals (different organizations) themselves and there is no central authority.
As discussed above too, the organizations/users working on a blockchain have their own copy of it and they make changes to it. The changes made to one blockchain after validation are reflected to the blockchain of every organization. This establishes a distributed system.
Peer To Peer Network
If you have to send the money to your friend via your bank account, there is an involvement of the bank itself i.e. third party involvement is present in this scenario. However, in a blockchain, the transactions occur only between the sender and the receiver i.e. the money or currency (crypto usually) is sent from the sender directly to the receiver and there is no third party involvement. This is called a Peer-to-Peer network and this is another very important feature of a blockchain.
Security from 51% Attack (Proof Of Work)
As we have already talked about, every organization working on the blockchain has their own copy of it. If a new block has to be added, the block is added to the blockchain of that particular organization. After this, the blockchain is validated i.e. the hashcode of the newly added block is matched with what the hashcode should have been. Also, the length of the new blockchain should be greater than that of the previous blockchain. This validation ensures that the correct block was inserted and after that, the blockchain is replaced by this longer length blockchain with a newly added block. Hence, mining is completely secured in a blockchain.
We have learnt that to attain full control over a blockchain, the attackers have to attack the blockchain to modify 51% of the blockchain length and this is very difficult in terms of calculations required for modifying a block as well as the cost in terms of hardware required to perform such calculations. Thus, because of this Proof Of Work System, the blockchain is highly secured.
We studied that each miner (organization working on blockchain who is adding blocks) has a copy of their own blockchain. The block is added and the original blockchains are replaced by the new length (increased length) blockchains. This means that the block is not being added to the original blockchain but to some other blockchain and the entire blockchain is replaced by the new blockchain after every mining process. Hence, the blockchain is immutable and adding a block generates a new blockchain every time.
So, there are some of the major features of a blockchain. Blockchain is such an emerging technology that everyone should learn about and then explore it in detail if you are really interested in it.
- Blockchain is a decentralized and distributed ledger.
- Blockchain is secure because of the proof of work
- Every block in the block chain can be identified by its unique hash value.
- The first block in the blockchain is called the genesis block and it does not have a previous hash and has dummy data values.
- Blockchain is immutable.
- Blockchain has a peer-to-peer network that removes the third party involvement.