📜 ⬆️ ⬇️

What is mining, and why mine on video cards


What is mining? Why for the mining of cryptocurrencies in most cases video cards are better suited than CPU? Why are the Asiki so good? In this post, I tried to explain the basics of the technical side of mining in understandable language.

For an understanding of the overall picture, the information is given in a simplified form, some details are omitted.

What is mining?


Take the bitcoin blockchain as an example. If you simplify as much as possible, the computing power of mining computers is aimed at encrypting operations to transfer Bitcoins from one wallet to another.

What does this look like?

Suppose Satoshi Buterin sent 1 Bitcoin from his wallet to Vitalik Nakamoto's wallet. According to the essence of the blockchain, you need to encrypt the information containing the addresses of Satoshi’s purses and Vitalik, as well as the number of bitcoins translated. Here the mining equipment comes into play - he needs to find the correct encryption option.

According to the SHA-256 hashing algorithm, on which the bitcoin blockchain is built, this must be done in a strictly defined way. For example, the algorithm prescribed to encrypt information so that at the end of the encrypted string was zero. A similar requirement comes from cryptocurrency developers - they need a cipher with a certain character in order to increase the resistance to cracking.

"Iron" begins to work - to solve this mathematical problem by the method of selection. The information “Satoshi Buterin wallet ---> 1 BTC ---> Vitalik Nakamoto wallet” turns into an encrypted string like “dh523456l29e4f6ab42d99c81156d3a17228d6e1eef4139be78dgw5jh63f2348”. But in this variant there is no zero at the end. Then the "iron" begins to pick up a new encryption option, adding a symbol to the information that does not change its meaning.


As soon as the necessary encryption combination was found, it is recorded in the database (blockchain), and more specifically, in a small piece of this database, which is called a block.

Briefly about the blockchain
A blockchain is a database that is essentially a transaction log. His main ideas laid by the developers:

  • let there be a single transaction log;
  • Let everyone have a copy of the journal;
  • all log entries will be encrypted so as not to get the enemy;
  • we divide the magazine into blocks, and we tie the blocks into chains.

A copy of this database (a copy of the blockchain) is stored on the hard drives of each of the miners, but this database is in fact a single organism - it is updated and synchronized on all computers. Therefore, in order to crack a blockchain, you need to crack it at once on all computers connected to the blockchain.

The developers of the bitcoin blockchain have determined that the maximum block size cannot exceed ~ 1 MB. And in order for a block to be considered formed, it must be filled with encrypted transaction records. Once the block is formed, the blockchain automatically generates a bitcoin issuing transaction to reward the miner for his work.

But do not think that you can just take and quietly go through a thousand combinations, finding the right one. More than one dozen, or even more than one hundred capacities can “work” on one task. And who will be the first, "that and sneakers." It turns out that the more computing power you have, the higher the chance to be the first to find the necessary encryption option.

But one person miner can form a separate unit on his computer for a very long time. It is unlikely that someone will be pleased with the prospect of mining for several years without a break, forming a single block, and then get 12.5 bitcoins for it as a reward (this is the number of bitcoins now issued for forming a new block). Therefore, people pool their powers. In this case, the Bitcoin network allocates a reward for the formed blocks not to a separate miner, but to the pool. The pool, in turn, distributes the rewards to individual miners, in accordance with the time spent and power (minus the commission).

Why the video card, and not the CPU?


The graphics processor (GPU) and central processor (CPU) architectures are very different. Modern CPUs consist of 4-8 cores - this makes them suitable for solving large and complex tasks. In addition, with such an architecture, they can quickly switch from performing one task to another.

And graphics processors were created in order to solve a huge number of small and simple tasks. Therefore, they consist not of a pair of large nuclei, but of thousands of small nucleoli. In this form, it is much more convenient for them to handle millions of pixels and polygons. But to perform complex tasks, in addition, switching from one to another is too difficult for the GPU.


The creators of video cards initially sought to improve the image and its processing in computer games. And they didn’t exactly expect that such architecture of their graphic processors would be the best for mining.

What is mining? This is a search of hundreds of thousands of different combinations for encryption, differing in essence only by one symbol. Thousands of GPU cores are much faster to deal with this kind of simple work than 4-8 smart but small CPU cores.

For comparison: the CPU core processes eight 32-bit instructions per clock (AVX). And the Radeon HD 5970 video card processor processes 3200 32-bit instructions per clock.

But there are devices where mining takes place even faster - they are called ASIC.

ASIC


Translated from the English application-specific integrated circuit means "integrated circuit special purpose." This equipment, which is made to solve a strictly specific problem. If we talk about mining ASIC, then in essence it is “all in one”: a power supply unit, a cooling device and a small board on which the CPU, ROM, RAM and other units are located. And if the video cards were not originally created for mining, then such iron is “sharpened” precisely for this task.

Let us take as an example the AMD Radeon RX 580 video card popular among Bitcoin miners. It costs about 26,000 p., And its mining capacity is 1.5 GH / s. We put ASIC AntMiner R4 against it: at a cost of ~ 100,000 r. its power is 8.7 TH / s. The difference is obvious.


AntMiner R4

Moreover, manufacturers of mining ASICs create them for the extraction of a certain cryptocurrency. They select components and set up software in ASIC in such a way that it best copes with solving problems using a specific algorithm on which a particular cryptocurrency is built (for example, SHA-256 for bitcoin mining). That is, in theory, asik for Bitcoin can be used for mining another cryptocurrency , but its performance in this case will not be impressive.

But if the video card can then be plugged into a computer and quietly play various games with it, then this cannot be done with ASIC - they install highly simplified operating systems, whose abilities are “sharpened” especially for cryptocurrency mining.

Total


We presented mining on the example of Bitcoin in a simplified form and tried to explain it in the most understandable way. It should be noted that video cards from different manufacturers are more suitable for different cryptographic ones: Nvidia is more suitable for one, and AMD is the best solution for the other. This is due to the fact that cryptocurrencies are built on different algorithms: the video card whose design features are best suited for each specific one.

Source: https://habr.com/ru/post/409671/