Blog Articles

SUMMARY

July 03 | 8 min read

Crypto Mining 102: Algorithms

The MinerGate Team

Earlier this year cryptocurrency mining marked its 10th birthday – it stands now as an adult industry. Let’s celebrate this anniversary by getting to know crypto mining better.
It is a complex subject, but the core of it is rather simple: miners independently verify transactions on a coin’s network, and, in doing so, create more coins. Thus, miners increase the circulating supply of cryptocurrency worldwide and help the network operate effectively.
Anyone who is just testing the mining waters may wonder how exactly the process of mining works to achieve the best results. The best way of getting started would be to find out what kind of beast hash is and what group of algorithms it leads.

Hash

Hash is a “message digest” – a number generated from a string of text.
First, miners gather transactions from the memory pool and assemble them into a block. Each transaction out of the memory pool is individually hashed. Out of that a so-called Merkle tree or Hash tree is created, which is an order of all hashed transactions. The top of that tree is referred to as a Root hash or Merkle root. It is then placed into the block’s header (along with the most recent block hash and a random number called a “nonce”), which is also hashed afterwards.
The process of mining requires miners to hash consequently until a miner in the network produces a viable block hash (for which they get a reward; currently, it’s 12.5 BTC for every block mined). The probability of this happening is directly proportional to the mining power of the network.

A schematic image of mining.

Mining ecosystem.

Hashing Algorithms

Since we’ve nailed down the hash, we can move forward to hashing algorithms – the real weapons in the cryptography toolbox. Hashing algorithms are defined by their one-way functionality: you can get the output from the input but not the other way around. Moreover, the same output is created by the same input.

Different hashing algorithms are used for different cryptocurrencies, such as SHA-256, Ethash, Scrypt, Equihash, Cryptonight, X11, Momentum. Among these, SHA-256 and Scrypt are the most commonly used to authenticate blocks of transaction data. The main differences between them stem from the following relationship: the higher the mining difficulty is, the more hash rate is needed for successful coin mining. The practicalities of a few hashing algorithms can be defined as follows.

SHA-256 (the most-used in mining) stands for “secure hash algorithm.” In terms of mining, it’s a calculation method implemented to ensure a data block has not been altered from its original form. It’s encrypted and, thus, secure. The 256 digits stand for the size of digests it generates, so that a datum is encoded into a 256-bit code. The end result is what we’ve just looked at – a ‘hash’. Block processing time for SHA-256 generally ranges from six to ten minutes.

SHA-256 algorithm explained.

SHA-256-D or SHA-256 double: data is translated into 256-bit hash just like in SHA-256; additionally, hash is encrypted once more. It takes the same time to process a data block as in the previous case, even if in fact there’s a step more. In the cryptocurrency industry, both algorithms are usually lumped together and referred to as just SHA-256.

SHA-1 is used by only one digital currency so far - IxCoin (IXC). It differs from SHA-256 only in the size hash encoded within it - 160 bits, as opposed to 256. Processing time for SHA-1 is relatively comparable to that of SHA-256 and ranges from five to eight minutes.

Scrypt is a multilayered algorithm: it starts with translating data through the SHA-256, then proceeds to utilize elements of the SALSA algorithm (the Stochastic Approach for Link-Structure Analysis) in order to utter hash generation. It is used by Litecoin, Dogecoin, MonaCoin, and others. In comparison to SHA-256, Scrypt may use a smaller number for the hash size if a miner directs it to do so, which makes it a faster mining algorithm. A data block transaction can be completed in as little as thirty seconds in this case; however, transaction security may be vulnerable while other blocks (or generations) are processed.

Mining Revenue

After reviewing hashing algorithms, it is only logical to look at the profitability factor. Indirectly, we’ve already mentioned what can affect miner revenue, now it’s time to outline the main factors:

Mining difficulty

Power consumption

Hashrate

Hardware costs

Utility rate

Pool fees

To build a bridge between theory and reality, we’ve looked at the recently reported data, for example, of Bitcoin’s overall performance. It shows that the profits earned from mining have seen a clear rise from July 2018 until July 2019.

Miners revenue.

Bitcoin hash rate.

There is a great deal more to the process of cryptocurrency mining and its infrastructure. However, we hope that with the help of this information you’ll have solid footing moving forward in this arena.