The base of each blockchain is built on a specific mining algorithm that forms this chain of blocks. For clarity, let’s consider Bitcoin as one of the most famous. Its forming algorithm is called SHA-256, or “Secure hash algorithm 256 bits”. The initial data can be anything: text, a number sequence, files of different sizes and extensions. But in the process of running the algorithm, they all transform into a specific “hash” of the same constant size — 256 bits.
The same initial data will always be processed into the same hash but only within the same block chain. If at least one bit of the initial data changes, the result will be different.
In addition, the algorithm works on the one-way function principle. It means that knowing the resulting hash does not allow you to determine the initial data. They can only be guessed based on a combination of zeros and ones, which is approximately equal to 2 to the power of 256. And this chance is incredibly small. Therefore, the algorithm is considered safe, which is displayed in its name.
Let’s examine a specific example of this algorithm operation
Suppose there are two people — Sam and Mike. Sam is going to transfer 5 Bitcoins to his friend. To do this, he sends a message about the transaction to all the miners of the Bitcoin network. This message contains information about Mike’s public address which the transfer is made to, the transfer amount, Sam’s personal digital signature and his public key. What is important, a digital signature is formed on the basis of Sam’s private key, so each network member is sure that the request comes from him/her. And that the bitcoins in question also belong to him/her.
After making sure that the transaction is real (this is important, but we’ll return to this later), miners put this information in a block, along with other similar transaction data. And they begin to mine, i.e. implement the SHA-256 algorithm and calculate the hash. The final result must contain a certain number of zeros at its beginning. It is determined by the overall “complexity” of the network, which directly depends on its capacity. A variable value depending on the number of participants and their computing power.
And in order to get the required number of zeros during the algorithm execution, network participants have to add to the original data the so-called “nonce number” — pieces of binary code obtained in the process of PoW mining. But this addition changes the final hash, so miners have to pick up such a combination of “nonce number” that will allow getting the right one.
As soon as someone succeeds in finding a solution to the problem — “getting the block” — he/she passes it to all the other participants in the network. Then re-checking and adding it to the general chain take place. What is important, the extracted block also contains information about the hash of the previous one, which logically connects them and forms the notorious blockchain. This verification, addition and connection tracking form the so-called “Proof-of-Work” — a criterion for the result reliability.
The longest block chains are most trusted. That is, with the greatest computational work done. And if someone decides to change at least one block in the chain, it will affect the whole further segment, since the hash will change in the block, and, consequently, everything will have to be recalculated again, which is real, but requires more than 50 percent of the processing power of the entire network. That’s why targeted hacker attacks aimed at changing the content of blocks are called “51% attacks” — this power is enough to create a new chain with supposedly “reliable” PoW.
There is another criterion of reliability — the so-called Proof-of-Stake (PoS). It is not so demanding on computing power and energy, so it allows scaling the chain for more active participants. More details about this can be found in the corresponding article.
That’s all about how the Bitcoin network works. Other networks may use slightly different principles, but are generally the same.
BlockchainAuthor: EXBASE.IO | Nov 23, 2020
BlockchainAuthor: EXBASE.IO | Oct 31, 2020
NewsAuthor: EXBASE.IO | Sep 03, 2021