Node Js Programming Lanuage is used here.
Testing all the commits(like Blockchain Validation, Mining function, etc)! Just to be On safe Sides 😀
Here NodeMon is used to Leverage auto run facility
With DIFFICULTY = 4 the time taken to generate the block is about 4 sec.
With DIFFICULTY = 5 there are five (0)s in the begining of the Hash and Time taken to generate the Block is about 47s.
Therefore we can observe that time increases exponentially as difficulty increases, therefore DIFFICULTY helps the Blockchain to prevent its exploitation! As more and more resource of the MINER will be utilised for mining the chain. Therefore if someone wants to replace the whole chain they will need about 51% power of the total Blockchain system and even after doing so it won't be worth it.
Here difficulty is varying according to the time taken by previous Block production.