# What does a computer do when mining cryptocurrencies in simple words

- Details
- Created: Thursday, 16 January 2020 05:37

The concept of cryptocurrency mining is familiar to many firsthand, because Probably all experienced PC users have already tried to run the mining program. The fact that cryptocurrency is mined through mining and you can earn money on it is also familiar to many. But what exactly does a computer or asic (specialized device for mining) do during mining, why sort through some hashes, i.e. the technical side of the issue is already familiar to a narrower circle of users. Because of this, a lot of "conspiracy theories" arise on the network, similar to the fact that Bitcoin is someone else's project to capture huge computing power to crack the Pentagon or other similar organizations. That the computer power of cryptocurrencies is used for secret scientific research, communication with an alien mind, and the cryptocurrencies themselves came up as a cover for all these "dark affairs." Next, we will try to most clearly cover the Bitcoin mining process and what tasks your computer solves at this time, so that you can more accurately represent the technical part of the mining process, and you looked at all the "conspiracy theories" as not a very good jokeу.

First, we give a small theory on Blockchain technology for those who are not yet familiar with this concept.

Blockchain - in translation a chain of blocks, which reflects the essence, i.e. sequential recording of blocks. A block is a list of transactions (transfers). Those. we get blockchain is a list of transfers between cryptocurrency wallets, recorded not separately, but immediately in a large batch.

For the analogy, a blockchain can be represented as a folder with sheets, and the block here will be a sheet on which transactions between wallets are recorded. Finding the next block means that a new sheet with new data (translations) has been added to the folder. All sheets are numbered and are in order.

At the same time, the data already added to the blockchain are not in doubt, i.e. This is a tool trusted by all participants in a transaction to transfer cryptocurrency from one wallet to another.

**Those. Blockchain is an archive of all translations that exist and cannot be faked.**

In order for Blockchain to be 100% reliable and people fully trust transactions through the blockchain, several technologies are used, including work verification, i.e. Proof of Work mining.

Now we’ll go directly to POW mining and figure out what computers actually spend their computing power on, and miners pay electricity bills.

To understand further narration, you need to know the following terms: Hashing, Hash function and Hash sum and others.

**Hashing** is the process of converting information into an unreadable form to protect it from outsiders, as well as to compress information into a text string of a given length.

A **hash function** (a hash algorithm) is the method by which encryption takes place. Writing text backwards, replacing all letters with numbers, or combining both of these methods can also be called a hash function. For Bitcoin, the hash function is much more complicated and is called SHA-256, Ethereum - Dagger Hashimoto, Litecoin - Scrypt.

The **hash sum** is the result that was obtained after the hash, i.e. encrypted initial data that cannot be learned without knowing the encryption algorithm used. A hash sum always has a given and unchanging number of characters. With cryptocurrencies, the hash sum usually has a length of 64 characters or 32 bits.

**Hash complexity** (mining complexity) - for cryptocurrencies, hashing complexity is set by including an additional condition when creating hash sums. To do this, an immutable number of zero (0) is added at the beginning of the hash sum. As complexity increases, the number of zeros at the beginning of the hash sum increases. At the moment, the Bitcoin has hash-summ must contain 18 zeros.

**Transaction** (transfer) - information on the transfer of cryptocurrency from one address to another, while this information is also hashed into a string of 64 characters by the same hash function (SHA-256 for bitcoin), and twice. Transaction hashing is fast because There is no additional condition for creating hash functions, in contrast to finding the hash function of the entire block. The transaction hash is usually called TxID.

**Nonce** (random arbitrary number) is a number that is added to the block data to simplify the creation of a hash sum with the current conditions (mining complexity).

We explain all terminology at the philistine level, for a complete understanding, refer to other sources, for example, Wikipedia.

Knowing and understanding the terminology, you can already understand what the computer actually does (processor, video card, asic, fpga) during cryptocurrency mining

Let us return to the block that everyone is so diligently looking for. A block contains the following information: the hash of the previous block, the hash of all the transactions included in it, and the number of nonce. The hash of the previous block is needed to protect against writing inaccurate information to the blockchain, the hash of the transaction is taken from the Mempool, which stores all unconfirmed transactions. It is worth noting that each miner takes a set of transactions from the mempool, i.e. each is looking for its own block (its hash sum), and not the entire network is looking for some specific block. A nonse or an arbitrary number serves, as we have said, to facilitate the search for the hash sum of a block with a given complexity. Because if only the hash sum of the transactions and the previous block were in the data, then it is possible that it will be impossible to find the hash sum from the current data in the mempool, not to mention the search time for the block that tends to the given value (10 minutes Bitcoin).

A good example of finding a new block, hash amount or cryptocurrency mining:

In this example, 4 hash sums with different Nonce numbers (3001, 3002, 3003, 3004) are calculated, the hash sums of the previous block and the hash sums of the transaction remain unchanged.

Actually, due to an arbitrary number of Nonce, the time of the appearance of a new block is not constant and can vary widely, but on average mathematically the time spent by the block will tend to one number specified in the program.

Thus, we get that cryptocurrency mining is the selection of an arbitrary Nonce number with subsequent hashing, so that the received hash sum of the block after hashing meets the network complexity requirements (it has the required number of zeros). Because The hashing process is not an instantaneous process and requires mathematical and logical operations from the computer, therefore for each algorithm this or that equipment has its own hashing speed. For example, when hashing using the Dagger-Hashimoto or Ethash algorithm, the AMD Radeon RX580 graphics card hashes 30 million variants of hash sums with a different number of Nonce within one second. Actually, that's why they say that the RX580 video card gives out 30 megahashes (MH / s). At the same time, the hash rate depends not only on the equipment, but also on the encryption algorithm, the complexity of mining and software (miners).

All information on the blocks is open in the public domain. For bitcoin, see Blockchain.com. An example of a block under the number 613181 can be seen below:

When a computer performs tens or hundreds of thousands of mathematical operations to obtain one hash sum or just a hash and at the same time 30 million such hash sums are processed in one second, then with such a volume of work performed by the computer. talking about the selection of passwords for hacking the Pentagon or another secret conspiracy is just ridiculous.

Now you probably ask: "Why do you need all this?" The answer to this question lies in the blockchain technology itself, which, in order to protect data from hacking, needs to provide a certain interval for the appearance of new blocks. And this time interval is just regulated by the complexity of mining, and mining itself serves as a proof of work (Proof of Work), for which the miner receives a reward in the form of a newly released cryptocurrency in the block he found. The work done in this case is also not free, because It requires the purchase of equipment and waste of resources (electricity). Therefore, a stable economic model of cryptocurrencies is built, due to which cryptocurrencies have an initial material value in society.

In conclusion, we can say that blockchain is a reliable archive, and the mining process is the recording of confirmed information in this archive. Miners in this process receive a reward for the understandable and necessary work to maintain the entire system in working and stable condition.