Cryptocurrency mining

Mining is one of the key points that enable a decentralised peer-to-peer network to work efficiently. It helps to both verify the reliability of transactions and generate new coins to be added to the common pool. True, this method is applicable exclusively to systems operating on the basis of the Proof of Work confirmation algorithm.

How it works

The main participant in the mining process is the miner. Miner’s task is to collect data on all transactions within the network, combine them into blocks and double-check the accuracy and sequence of ongoing processes.

Each transaction on the blockchain network is hashed into a shared memory pool. In addition, each new block begins with a “reward transaction” — “coinbase”. This transaction is the first and involves the transfer of a certain amount of bitcoins to the one who first confirms the reliability of the block.

Each transaction is taken from a shared memory pool and hashed separately. The resulting collection, called the Merkle tree or the hash tree, combines the individual hashes in pairs and passes them through the hash algorithm again. And so on, until you get one result — the root hash.

This root hash encodes most of the current transactions. Decrypting their contents using it is real, albeit very difficult. This element is combined with the hash of the previous block of the chain, as well as with a random number called a “one-time code” or “nonce”. All of them form a block header, which is also hashed and turned into a block identifier.

What is important, these identifiers must be less than a certain value strictly specified by the protocol conditions. Therefore, to obtain a “working length”, they are supplemented by a sequence of several zeros that determine the complexity of hashing. The more zeros are, the harder it is to choose a hash, which guarantees a stable and predictable speed of new blocks generating, which directly depends on the overall network capacity. Despite the great complexity of the process, it is possible that two different miners simultaneously find the correct confirmation and add new blocks. And two reliable and confirmed blocks are embedded in the blockchain instead of one. However, the structure of the algorithm does not allow such structure to exist. Therefore, the first block, which a new one is added to, will become the main branch, and the second will be considered obsolete or “orphaned”, and then will completely separate from the general chain. And those miners who worked on the information contained in it will go to the current chain, having lost just a little time on irrelevant work.

Pools

The problem is that the effectiveness of mining depends solely on the computing power of the computer. And if you consider that only those who are the first to calculate new blocks receive new bitcoins, then a single machine has little chance in comparison with large-scale mining farms. Therefore, a rather effective solution to this problem was invented, which allows even beginners to get a small profit — mining pools.

This is a remote combination of several different machines to solve one problem — hash calculation. And when they manage to do this first, the profit received is proportionally distributed among the participants, based on the invested computing power. Simply put, if your machine gives 1 percent of the pool power, then you can count on 1 percent of the reward received.