So far so good, we have covered the basics of Blockchain and then we have understood the mining concepts, then we did a small java program to understand the blockchain flow in a very small scale.
Now you must be thinking that, who are the miners in a blockchain network and what is their work?
It’s simple, a computer or a program which does the calculation and computation to add a new block is called Miner (if a person or organization does the same then the person or the organization is the miner).
The basic work of a miner is simple, as they use CPU power or any other source to compute the nonce (unique number) generated for a block, using which they can create next block. The signature of the new block must be less than the previous block, and the one who gets the nonce first and announces it, will be rewarded. Pretty much like a game, isn’t it? Well, apparently looks it is simple, but it’s complex!
Enough of concepts now! Let’s look into something more interesting, real time application platform which can be used for implementing all the concepts that we have learned till now.
There are many open source blockchain based distributed computing application platform, Ethereum is one of the most widely used amongst them. Mainly Ethereum is used for implementing ‘Smart Contracts’ functionality. Like other open source other platforms, it also provides decentralized virtual machine, which is also known as Ethereum Virtual Machine.
Now you might ask, how Ethereum is different from Bitcoin? Valid question though.
The main difference is, the purpose and capability. Bitcoin offers a particular application of blockchain technology, whereas Ethereum is running the blockchain code is a distributed architecture.
Smart Contracts are combination of:
- Smart Contract Code: The code that is executed on Blockchain Distributed architecture.
- Smart Legal Contracts: The code acts as a legal contract to make sure the requirements are fulfilled.
As it is nothing but a computer code executed in Blockchain, it checks for the conditions of a contract if that is getting satisfied or not!
The whole Smart contract code is distributed into distributed ledger, and it is done in same way how the ledger gets updated.
As it is in distributed systems, hence single computer is not responsible for running the code and based on the consensus of other computers the execution and result is determined to get a Smart contract compliant Blockchain.
What apps are being developed using Smart Contracts:
- Real Estate
- Record Keeping
- Data Security
- Decentralized Organization
To avoid the conflicts in the blockchain. But before going into the nitty-gritty details, let’s go through an example of a conflict. Let’s say, all the nodes have synchronized the Blockchain and at present the total block numbers are 50 and they are all synced in all nodes. Now, based on the consensus theory, let us assume 4 or 5 people has mined a new block 51 at the same time. All the blocks have a different signature. Let’s take them as 51<i>, 51<ii>, 51<iii> and 51<iv>. Now, the question is which one to take here? Seems like a deadlock in a system in this scenario.
Here the solution is, Longest chain rule: Generally, in public blockchain (like bitcoin, this kind of problems are solved using longest chain rule). Let’s solve the above problem using the longest chain rule:
- Let’s say the miner received first block 51<i> and he will start building the block 51<i> on top of 50.
- When another block 51<ii> comes, then miners first will keep an eye on the same. If another new block 52<ii> is detected by other miners then it will take the block 51<ii> rejecting others.
That’s how the longest chain always get better and more preference.
How about the private Blockchain to solve the problem:
Make the minor trusted (using MSP or membership service provider). So, every time the block receives a block, that’s the final block in the chain.
When to use Blockchain:
- Store immutability:
- When you want to store something immutably
- When things or ledgers keep on adding but the older one do not change [Ex: court judgements/ health records]
- When you want to decentralize the control [Ex: User Identity Management System]
- Proof of Ownership:
- When you want to prove that you are the owner of the digital document [Ex: Proof of existence systems like Block.ai]
To be contd…