Key concepts of blockchain

As I mentioned more in my previous blogs about Blockchain lets take it apart and discuss it in a bit more detail. Consider this as a single block of BC. As you can see there are multiple dimensions of this block.  

block

A block in Blockchain:

One of the dimension is the data block which will hold the data part of the Blockchain. This could be any type of data it could list of transactions it could be a document that you could sign or it could be any other business related data.  The second part of the block is the hash part which holds the hash of the block data.  the hash of the data along with the timespan is calculated and the resulting hash is stored in the hash part of the block. The third part of the block is the hash of the previous block. By adding that we ensured that block is connected with its peer block and also it knows the authenticity of the previous block so if anyone tempers with the previous block the hash of the previous block will be changed and we will have inconsistent block hashes. 

In the process of forming a Blockchain the first block of the Blockchain is called the Genesis block Genesis block is the very first block in ever block chain. In the structure of the genesis block the  previous block field is empty as there is no former block.  

forming a blockchain

Genesis Block:

The formalization of the blockchain not only require the genesis block but it also need some rules to obey to add a block to the chain. This is called the consensus protocol. The consensus protocol of the Blockchain dictates how the block is processed which means how we are  going to calculate hash of the block. If any block is tempered than the rest of the blocks in the block chain will be invalid. The only way to invalidate a whole chain is to temper with a block and recalculate all the later blocks .While we are talking about genesis block  here is the Genesis block of Bitcoin as you can see this is the first block of Bitcoin there is no previous block with no transactions to calculate. There is also a reward to calculate the hash in this block which is 50 BTC. It’s a very good way of contributing to the currency that is more explained in concept of mining

 btc block

Now that we know about the BC what if someone tempers with the BC so there will be an invalid BC for all the nodes. To deal with this problem the concept of distributed BC is introduced. So each node in the network will have its own copy of the BC and every change in one of the BC will be authenticated and synced with all the BC within the network. The distributed blockchain is still vulnerable with one famous security problem. So if you invalidate more than 50% of the BC nodes than you have successfully performed the control of the network. You can rewrite the consensus protocol. You can manipulate the transaction history.  But to do that action is not that easy it is really performance intense to perform such an attack on more than half of the network at the same time so for now its really hard to achieve that. If you have control of the more than 50% of the network then you have successfully performed a 51% attack. 

51% Attack:

Now let’s discuss the 51% attack in more detail. Consider that you have a network with multiple nodes. Let us divide the nodes in two colors red and blue. The blue nodes are the good nodes and each of the good nodes have their own copy of the blockchain. The red nodes are the bad nodes or the malicious nodes and they also have a good valid copy of the blockchain as well.  The bad node  then publishes a malicious block to the network and synchronously do that will all the local of the bad nodes. This will in return publish the same block to all the nodes on the network. 

 

 Now the good nodes will also get the same malicious block and there is a chance that they will invalidate the block tagging it as malicious block. But if we have more number of bad nodes on the network so the major nodes in the network will accept the malicious block to be part of the valid Blockchain. The good nodes will think there block chain is invalid as they are less in number and they will sync with the bad Blockchain. So now the whole network is infected resulting in a successful 51% attack. 

Proof-of-Work:

The 51% attack looks really simple to conduct as all you have to do is re-calculate the hashes of the Blockchain and then you can invalidate the whole chain with enough CPU power. To address this problem there is something called Proof-of Work. The proof-of-work dictates that you can calculate the hash but there are certain rules that are applied on a hash. The hash should have some particular number of zeros or it should start with at least ‘x’ number of characters or  numbers.  By intruding such rules the process is generating the hash becomes more difficult and requires more CPU-time.  So you try different key combinations until you reach an acceptable block and then you publish that key with the block so that the other nodes in network can validate your work. The rules for proof of work are different in different currencies or domains. For example Bitcoin accepts 1 block in every 10 minutes, Intense coin accepts 1 block after every 30 seconds. There is another part call the difficulty that is included in the proof of work rules. The more the difficulty is the harder it is to conduct a 51% attack.  

Mining:

let’s say if I am one of the node contributing my processing power to calculate hashes what will I get in return for the  processing power  that I m contributing. There are special nodes who contribute in the processing of the blockchain called the mining nodes. The concept is called mining in blockchain where the nodes receives a published block, calculates hash on that block using a random key until it reach the difficulty and once it has successfully calculated the hash then we can say that we have  successfully mined the block and then its publish to other nodes in the network.  The node will get reward in return of mining which is also in the form of the currency which helps building the blockchain and also it contributes to the currency . Mining is  a process of running the blockchain rules which keeps the Network’s stable safe and secure by processing validating and invalidating Blocks. But the problem with that is that it doesn’t have bright future. In many currencies because it takes too much electricity it takes too much power to calculate the hash  so maybe mining is not the future. There are different solutions alternate Solutions available which I will discuss later.

Summary:

So in this blog i have touched the concept of blocks in blockchain, proof of work, mining and 51% Attack.