What does a computer do when mining cryptocurrencies in simple words
- Created: Friday, 22 January 2021 05:37
The concept of cryptocurrency mining is familiar to many firsthand, because all experienced PC users have probably tried to run the program for mining. The fact that cryptocurrency is mined with the help of mining and you can make money on it is also familiar to many. But what exactly does a computer or asic (a specialized device for mining) do during mining, why go through some hashes, i.e. the technical side of the issue is already familiar to a narrower circle of users. Because of this, many "conspiracy theories" have arisen on the network, such as that Bitcoin is someone's project to seize huge computing power to hack the Pentagon or other similar organizations. That the computer powers of cryptocurrencies are used for secret scientific research, communication with alien intelligence, and that the cryptocurrencies themselves were invented as a cover for all these "dark deeds". Next, we will try to highlight the bitcoin mining process in the most understandable way 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 will give a small theory on Blockchain technology for those who are not yet familiar with this concept.
Blockchain means a chain of blocks, which reflects the essence, i.e. sequential writing of blocks. A block is a list of transactions (transfers). Those. we get a blockchain is a list of transfers between cryptocurrency wallets, recorded not separately, but immediately in a large batch.
For analogy, blockchain can be thought of 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 is not questioned, i.e. this is a tool that all participants in the transaction for the transfer of cryptocurrency from one wallet to another trust.
Those. Blockchain is an archive of all translations that exist and cannot be faked.
In order for the Blockchain to have 100% reliability and people completely trust transactions through the blockchain, several technologies are used, including verification of work, i.e. Proof of Work mining.
Now let's go directly to POW mining and figure out what computers actually spend their computing power on and what miners pay their electricity bills for.
To understand the further narration, you need to know the following terms: Hash, Hash function and Hash sum and others.
Hashing is the process of converting information into an unreadable form to protect it from strangers, as well as to compress information into a text string of a given length.
Hash function (hashing algorithm) - the way by which encryption occurs. 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 received after hashing, i.e. encrypted initial data that cannot be recognized without knowing the encryption algorithm used. The hash sum always has a specified and unchangeable number of characters. In cryptocurrencies, the hash is usually 64 characters or 32 bits long.
Hashing complexity (mining complexity) - for cryptocurrencies, the hashing complexity is set by including an additional condition when creating hash sums. To do this, an unchangeable number zero (0) is added at the beginning of the hash sum. As the complexity increases, the number of zeros at the beginning of the hash increases. At the moment, the Bitcoin hash 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. Hashing transactions is fast because there is no additional condition for creating hash functions, in contrast to finding the hash function of the entire block. The hash of the transaction is commonly referred to as the TxID.
Nonce (random random number) is a number that is added to the block data to simplify the creation of a hash sum with the current conditions (mining difficulty).
We explain all the 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's go back to the block that everyone is "looking for" so hard. The block contains the following information: the hash of the previous block, the hash of all transactions included in it, and the number of nonces. The hash sum of the previous block is needed to protect against writing inaccurate information to the blockchain, the hash sums of transactions are taken from the Mempool, which stores all unconfirmed transactions. It should be noted that each miner takes its own set of transactions from the mempool, i.e. everyone is looking for their own block (their own hash-sum), and not the whole network is looking for a specific block. A nonser or an arbitrary number serves, as we have already said, to facilitate the search for the hash sum of a block with a given complexity. Because if the data contained only hash sums of transactions and the previous block, 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 a block that tends to a given value (10 minutes for bitcoin).
An illustrative example of searching for a new block, hash sum, or cryptocurrency mining:
In this example, 4 hash sums are calculated with different Nonce numbers (3001, 3002, 3003, 3004), the hash sums of the previous block and the hash sums of the transaction remain unchanged.
Actually, due to the arbitrary number of Nonce, the time for the appearance of a new block is not constant and can vary within wide limits, but on average, mathematically, the time for finding a 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 resulting hash sum of the block after hashing meets the requirements of the network complexity (has the required number of zeros). Because the hashing process is not an instant process and requires mathematical and logical operations from the computer, therefore, for each algorithm, this or that equipment has its own hashing rate. For example, when hashing using the Dagger-Hashimoto or Ethash algorithm, the AMD Radeon RX580 video card hashes 30 million variants of hashes with different Nonce numbers within one second. That is why they say that the RX580 video card produces 30 megahash (MH/s). At the same time, the hashing speed 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 to the public. For bitcoin, see Blockchain.com. An example of block number 613181 can be seen below:
When a computer performs tens or hundreds of thousands of mathematical operations in order to get one hash sum or just a hash and at the same time 30 million of such hash sums are processed in one second, then with such a volume of work performed by the computer, talk about some kind of password guessing to break into the Pentagon or other secret conspiracy becomes ridiculous.
Now you are probably asking: "Why do you need all this at all?" The answer to this question lies in the blockchain technology itself, which needs to provide a certain interval for the appearance of new blocks to protect data from hacking. And this time interval is precisely regulated by the complexity of mining, and the mining itself serves as a Proof of Work, for which the miner receives a reward in the form of a newly issued cryptocurrency in the block he found. The work done in this case is also not free, because requires the purchase of equipment and waste of resources (electricity). Therefore, a stable economic model of cryptocurrencies is being built, due to which cryptocurrencies have an initial material value in society.
In conclusion, we can say that the blockchain is a reliable archive, and the mining process is the recording of confirmed information into this archive. Miners in this process are rewarded for a completely understandable and necessary work to maintain the entire system in working and stable condition.