In order to create new blocks, miners need to have all the information about transactions. They compete with each other, as the miner who first created the unit receives payment for this service. The question is what prevents Miner from deleting previous transactions in the blockchain. Although he will not be able to steal coins in this way, he will be able to complete the same transaction several times. For example, to pay for the goods, and then delete the transaction information.
To avoid this, all miners in the network must have the same copy of the blockchain.
When a miner adds a new block, he must provide cryptographic proof of the transaction. To get proof, the miner spends the block through several rounds of a hash function — a calculation that takes a piece of data of arbitrary size and translates it into a meaningless alphanumeric string with a fixed length, which is called a hash. To make the process more reliable, the blockchain algorithm requires that the resulting hash begin with a certain number of zeros. It is impossible to predict in advance which hash will produce a given data set, so miners run the calculations over and over again, inserting a random number into the data set each time. When this number changes, a new hash occurs. As a result, miners get the right number of zeros.
The miner, which finds the correct hash, sends the block to other miners. They check it and add it to the full blockchain version contained on their computers.
This can be compared to closing the door. Suppose a person has a lock, and a set of keys, one of which can close it. He must try all the keys before finding the right one. And then leave it in the lock so that others can verify that the key fits.
Miners spend their money on network support – they buy equipment and pay for electricity. To change the block in the blockchain and conduct the same transaction twice, they will have to spend twice as much their money, so it becomes unprofitable to cheat.
In addition, with each new unit, the cost of changing previous ones increases. New blocks store the hash of the block in front of them. Any changes to the old blocks will result in invalid hashes for all subsequent blocks. Therefore, it is not possible to insert dummy modifications in the previous block without repeating all the work that was done after this block. If we draw an analogy with locks, it turns out that the lock at the end of the chain is connected with all the previous ones. If you change the lock in the middle of the chain, you will have to look for new keys for each lock after it.
It turns out that miners provide costly evidence, and then receive money for their work. Thus, Satoshi created the first viable peer-to-peer digital currency. But he also solved a more general problem that had worried scientists for decades. Bitcoin, which for 8 years has never been disconnected from the network for a long period, reliably encourages miners to perform work in good faith, providing a single network. The result is a secure, ever-growing chain of data that anyone who has an internet connection can check and supplement.
It is a complex world that begins to be very populated: in the map of the ecosystem appear the banks of bitcoin, the companies of “mining” (creation of currency) and work groups. By using cosmos crypto validator, you can validate your crypto currency, visit them to make your crypto life easy.