in Project HOPE2 months ago

What is an Algorithm...?


Now , this is something you can easily get on the google search.
But let us talk about what is an algorithm in simple words so that every one can understand.

So an algorithm is basically a list of some steps for achieving something. These steps should strictly followed in sequential order that is one after the another.

let us take real life example to understand it even better. let suppose you want to go from one location to another location. You will first get out of your house , then take a cab or a taxi to desired location and then pay the driver his fees step out of the car and reach your location successfully right.

Now imagine can you randomly follow the above steps to reach your desired location successfully...? The answer is no you can't do that. in order to reach your location you first have to get out of your location then search for the taxi and so on and so fourth. you can't first reach your desired location by walking and then paying the taxi driver and then booking it , right.

it will all become a mess , and even if you achieve your desired result here it won't be the best way for achieving it.So i hope it is clear now that what is an algorithm , an algorithm is a sequence of steps that is being performed for achieving desired result.

What is Consensus Algorithm...?


Now , in the above image you can see different types of Algorithm but i am going to talk about Consensus Algorithm i have used for my blockchain development that uses Proof of Work to mine new blocks.
So a consensus algorithm is something that provides us a way for comparing one node with another inside the whole network to know whether the data on the node is correct or not.
Now different blockchain use different consensus Algorithm but what i have used is also being used by the BITCOIN blockchain network itself.
So the algorithm follows the longest chain rule.

Longest chain rule and it's Advantages


In longest chain rule , the chain on the current node is compared to all of the other nodes chain in the network present.
So while comparison if a longer chain is found in the network then the chain that was initially being compared with all the other chains is replaced by the longest chain found.

In the above image you can see a ataacker trying to send three blocks together to the network but as soon as these blocks are recieved they ll follow the longest chain rule and get replaced by the longest chain reducing the chances of attacker to be successful.

So why is the chain being replaced by the longest chain...?

It is because the longest chain on the network is that chain to which every node must have contributed and that's why the number of blocks in this chain is more.

As it has the more number of blocks that would have mined using proof of work , we can assume that the whole network contributed to this node because of how muc work went into this chain.

So , obviously longest chain rule in our consensus algorithm also protects the blockchain from attackers as well.

So that's it for today , i hope i was able to explain this concept well and everyone here would have learnt something new.

Thank you , se you all soon with my next post.



A really great and simple application, I had not found something so simple to understand and I congratulate you on it.
It is really impressive how useful these algorithms are, and the truth is that I find them magnificent that they are used in the blockchain, this generates a lot of security and trust in transactions.
I am very interested in knowing more about the project you are carrying out and I will be aware of the publications you make in relation to this.

This post has been manually curated by @bala41288 from Indiaunited community. Join us on our Discord Server.

Do you know that you can earn a passive income by delegating to @indiaunited. We share 80 % of the curation rewards with the delegators.

Here are some handy links for delegations: 100HP, 250HP, 500HP, 1000HP.

Read our latest announcement post to get more information.


Please contribute to the community by upvoting this comment and posts made by @indiaunited.

Congratulations @kamran-rkploy! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s) :

You received more than 700 upvotes.
Your next target is to reach 800 upvotes.

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Check out the last post from @hivebuzz:

Valentine's day challenge - Give a badge to your beloved!
Time to go on your Hive Tour