SHA-256 consensus algorithm - all about the mechanism for cryptocurrency mining

Mining algorithms are the rules of interaction between network participants. They consist of a consensus mechanism as well as a cryptographic hash function. Depending on the mining algorithm, the optimal equipment for mining digital coins changes.

Each cryptocurrency operates on a blockchain, but despite using decentralized ledger technology, they all have different parameters. The differences are provided by algorithms - each of them creates certain operating rules that apply to all network participants. In this article we will analyze the current mining algorithms, which cryptocurrencies use them and how they differ.

What is a cryptocurrency encryption algorithm?

When characterizing any cryptocurrency, one cannot help but pay attention to one of its key characteristics – the encryption algorithm. To create it, it is customary to use complex cryptographic mechanisms, which makes the process of mining digital coins quite difficult. At the modern level, “miners” use sophisticated equipment, which is constantly updated, to decipher the algorithm and search for the hash.

The result of mining is the appearance of the next block of data that replenishes the blockchain.

Finding the correct hash leads to the blockchain generating a new block in the chain, inextricably linked with the previous one and containing data on:

  • transactions;
  • hash of the predecessor block;
  • the amount of reward that is due to the one who deciphered, etc.

Among the encryption algorithms used in the world of digital coins, some have gained exceptional popularity because they have proven their outstanding reliability in practice. They can be used not for a single blockchain, but for several cryptocurrencies.

SHA-256 in Bitcoin

Bitcoin is the first cryptocurrency to implement SHA-256 into blockchain technology. This algorithm is an integral part of the Bitcoin protocol.

Bitcoin uses the SHA-256 hashing algorithm primarily to verify transactions through the Proof of Work consensus mechanism. Additionally, it is used to create Bitcoin addresses.

READ:

Bitcoin address: Types and examples of BTC addresses Has the Bitcoin address changed? Why does my BTC wallet address keep changing?

Now there are a number of cryptocurrencies and blockchain projects that have adopted this algorithm. The three most popular coins using SHA-256 are:

  • Bitcoin (BTC)
  • Bitcoin Cash (BCH)
  • Bitcoin Satoshi Vision (BSV)

All of these coins use SHA-256 as the Proof of Work algorithm for mining.

Hashing Example


Scheme.
What is hashing? The idea of ​​a hash is based on the distribution of keys in a standard array H[0..m-1]. Distribution occurs by calculating a certain hashed function h for each element key. Based on the key, it helps to obtain an integer n, which will serve as an index for the array H. It is clear that you should come up with a hashed function that would give different codes for various objects. For example, if strings should be used as the key of a hashed table, then you can select a hashed function that is based on the following algorithm (example in C): int hash(char* str) {int h = 0; for (int i=0; i

Where m is the size of the hashed table, C is a constant greater than any ord(c), and ord() is a function that returns the character code (a number). You can create your own hash function for a specific data type. But the basic requirements for the function have been developed: it must arrange the keys among the cells of the hashed table as uniformly as possible, and it must be easy to find. Below is a table. It can be understood that the indexes of keys in a hashed table are the result of the h function that is applied to the key.


Key.

The image also shows one of the main problems. With a fairly low value of m (the size of the hashed table) relative to n (the number of keys) or with a bad function, it can happen that 2 keys are hashed into a common cell of the array H. This is a collision.

Good functions tend to reduce the chance of collisions to zero, but given that the space of all possible keys may be larger than the size of the hash table H, it still cannot be avoided. But experts have developed a number of technologies to resolve collisions. Setting up pool SHA256 for coin mining is shown in the video. You can understand how to mine cryptocurrency.

Where is SHA256 used?

The SHA256 hashing algorithm generates a unique 256-bit hash of a fixed size. This function allows you to check the integrity of data.

It is used in various applications such as: digital signatures, password verification, hash code authentication, hacking protection and blockchain.

Why blockchain and cryptocurrency are not interchangeable terms. How does a private blockchain differ from a public one?

Using this algorithm, you can determine the integrity of the data. That is, the user can make sure that the downloaded data does not change and is in its original state.

For example:

Let's say you downloaded a Bitcoin wallet. You want to make sure it's original. To do this, you can simply compare your wallet hashes with the original one provided by the developer.

The algorithm is also implemented in some popular security applications and encryption protocols. One widely used application is TLS and SSL certificates for websites. In addition, it is used in SSH, PGP, IPsec and S/MIME.

Pseudocode hash: functions


Pseudocode.
What makes Scypt-Jane different is that it supports more than 3 different stream cipher systems. And in order to form a clear understanding of the algorithm, you should familiarize yourself with the characteristics of the functionality. Main functions:

  1. Salsa20/8.
  2. ChaCha20.
  3. Salsa6420/8.

First of all we have Salsa20/8. This is a fairly simple function, the main task of which is to receive a 192-byte string (of numbers and letters) and then convert it into a 64-byte Salsa20 (x) string.


Salsa20/8.

Salsa20 is two-component: stream encryption for data encryption and a compression function (Rumba20 algorithm), which is needed to compress a 192-byte string to a 64-byte one. To put it another way: a line can be larger than 64 bytes until it becomes 192 bytes, and the line will be compressed to 64 bytes. ChaCha20 has slight similarities with Salsa20: it is also a stream encryption, but it provides some additional features, for example, increased resistance to cryptanalysis.

Chacha20 also increases data shuffling per round. In other words, when mining digital coins as part of a pool, you will notice that one mining round can include either a short or long time period. The length of time it takes for a mining pool to find a single block is partly determined by the better mixing offered by Chacha20 of Skript-Jane.

By the way, various factors influence the decrease in round time. Another important function for mixing information in Script Jane is Salsa6420/8. It is an improved version of Salsa20/8, and makes it possible to work with the highest byte blocks. In addition to these functions, Jane's Script also supports a number of hashes, including SHA256. The algorithm also supports its most innovative version, SHA512.

Technical specifications

The protocol is designed for data that is divided into parts, each 64 bytes in size. The algorithm provides consolidation, as a result of which a 256-bit code appears. The encryption technology is based on a relatively simple round, the cyclicity of which is 64 times.

  • 64-byte block size.
  • The maximum length of the encrypted code is 33 byte.
  • Message digest parameters – 32 byte.
  • The default word size is 4 byte.
  • The number of repetitions within one cycle is 64.
  • The algorithm speed is 140 Mbit/s.

As mentioned earlier, the SHA-256 protocol is based on the Merkle-Damgaard concept, which means that it is first divided into blocks, and only then into individual words.

The set of information passes through a range of repetitions - 64 or 80. Each cycle is accompanied by the transformation of a block of words. The final hash code is generated by summing the initial values.

SHA256 coins

Here is a list of popular cryptocurrencies for SHA256 mining. We rated them by popularity and network hashrate.

CoinWebsitePool
Bitcoin (BTC)bitcoin.orgpool.btc.com F2Pool
antpool.com
Bitcoin Cash (BCH)bitcoincash.orgBTC.com
bitcoin.com
Bitcoin SV (BSV)bitcoinsv.ioemcd.io
viabtc.com
DigiByte (DGB)digibyte.ioF2Pool
Syscoin (SYS)syscoin.orgmining-dutch.nl
Namecoin (NMC)namecoin.orgF2pool
Peercoin (PPC)peercoin.netZPOOL
Zergpool

Other SHA-256 based coins

Note: The coins below have very low 24-hour trading volume. They are rarely traded on exchanges and are difficult to sell.

  • Litecoin Cash (LCC)
  • Bitcoin Classic (BXC)
  • Elastos (ELA)
  • Auroracoin (AUR)
  • Bitcoin Vault (BTCV)
  • Super Bitcoin (SBTC)
  • Pyrk (PYRK)
  • EmerCoin (EMC)
  • HTMLCOIN (HTML)
  • Terracoin (TRC)
  • Myriad (XMY) – Multi Algo

Scrypt

The second most popular method for mining cryptocurrencies is the script algorithm. The emergence of this algorithm is due to the fact that shortly after the increase in the popularity of Bitcoin, the imminent arrival of hardware solutions that would take advantage of the simplicity of SHA 256 and take the mining of coins into their own hands became predictable. And so it happened, first the mining of virtual gold switched from processors to video cards, and then specially sharpened ASIC systems appeared, which were already out of the competition zone. But such an approach greatly threatens to destroy the basic principle of cryptocurrency, namely the decentralized structure. Such a situation could not suit anyone, so the script algorithm soon appeared.

The difference between the mining method for the SHA 256 and Scrypt algorithms is that the script requires a large amount of memory to function. Whether it was RAM when mining with a processor or video memory when mining with a video card, the fact is that if there was not enough memory, then the process of finding the desired hash took a very long time. This, undoubtedly, greatly delayed the appearance of ASIC systems for the script algorithm.

The dependence on the amount of memory is explained by the fact that the process of calculations and hashing is significantly more complicated compared to the previous algorithm. Memory is used to store pseudo-random sequences that are generated at the beginning of the execution of the algorithm. Without saving this data, the process of obtaining the correct hash lengthens significantly. Therefore, ASIC chips used for Bitcoin mining are not applicable here and a new solution is needed, however, universal computing devices, such as video cards, cope well with both one and the second algorithm.

After some time, the improved scrypt n algorithm saw the light of day. Its main difference from the previous version was the presence of a new variable, actually “N,” which significantly complicated the implementation of specialized systems. When calculating each new block, the complexity of the calculations and the required amount of memory increases, which undoubtedly leads to the need to expand the storage device of your system. While a large amount of video memory is not a problem for a video card, the same cannot be said about ISI chips. The introduction of scrypt n was a serious blow to ASIC miners and significantly increased protection against monopolization of those cryptocurrencies on which this algorithm was used.

Rating
( 1 rating, average 5 out of 5 )
Did you like the article? Share with friends:
For any suggestions regarding the site: [email protected]
Для любых предложений по сайту: [email protected]