I was already attracted to the world of cryptocurrency when I was a seventh grader. At first, I thought it was simply a free currency generator that would give me free cryptocurrency as long as I kept my laptop whirring like a hot wheel running crypto-mining software. Finally, my laptop did generate crypto, however, only very, very little. What I do with my laptop is essentially “crypto mining”. You may have heard of the cryptocurrency Bitcoin, and you may have heard of a term called "mining" associated with this type of cryptocurrency. Cryptocurrency mining, in simple terms, is the process by which miners or individuals use equipment to do "work" that supports the blockchain network in order to receive cryptocurrency rewards. Sketch of a small P2P network on Onenote Blockchain: It is a network distributed record or distributed ledger that records the actions of people on the network. Therefore, for the blockchain network of cryptocurrency, the function of the blockchain will be to record the transactions of individuals on the network. In this article, I will use Bitcoin as an example to explain the meaning behind mining. Back to the topic of the miners' "work". In order for miners to get Bitcoin rewards, the simple "work" that miners have to do is to verify transactions on the Bitcoin blockchain. When verifying, miners will perform a series of checks to ensure that the assigned transaction is legitimate and that the transaction participants do not pay the same amount of cryptocurrency twice . For example, when Joe sends Brandon 12 bitcoins, and Brandon tries to send Tony 7 bitcoins and Max 8 bitcoins, this will be considered a fraudulent transaction because 7+8>12. The situation I just gave is an example of the "double-spending problem": Brandon tried to spend the same bitcoin twice. After a miner has verified between 0-4 megabytes of Bitcoin transactions (roughly 1500-3000 transactions), equivalent to the approximate maximum size of a block, they have completed the easier half of the work to receive the Bitcoin reward. However, the tasks before verification are the most complex, making the miner eligible to verify transactions. By first solving a string sequence calculation, it is called Proof of Work. Proof of Work is the process that requires the most computing power for miners. (I will explain why it is called Proof of Work in the following chapters) In order to understand the Proof of Work algorithm, you must first be familiar with the word "hash" in blockchain. The way the network detects tampering with a block in the blockchain is through its hash value; a long string of numbers and characters defined by the information in the block. By passing data through a hash function, such as SHA-256 used by Bitcoin, a sequence is produced that is specific to that particular input. This means that if the input data is changed by even one character, the output hash value will completely change. In addition, a hash is an encrypted but not decrypted result, so it cannot be used to obtain the original data, only as a way to verify that the input data of the hash is the same. Creating a proof of work requires miners to run a hashing algorithm to "guess" the appropriate answer to the problem. For the Bitcoin blockchain network, miners must first create a hash value that meets certain requirements, which is called the "target hash." The necessary information to guess the target hash is in the block header of the new block, including: block version number, timestamp, hash value of the previous block, and target hash value. Guessing process sketch on OneNote The answer to the target hash is generated by the hash value of the previous block, the transaction data of the current block, plus an integer from 0 to 4,294,967,296 (referred to as nonce), which is then put into the hash algorithm. If the answer matches the target hash, the block is added to the blockchain. The miner who first verifies the transaction and finds the nonce added to the block hash is rewarded with bitcoins . Otherwise, they keep trying to find a valid target value. Due to the randomness of the hash algorithm, we need to make a lot of random guesses to determine the value that satisfies the target hash . Although it is quite difficult to find nonce by yourself, and there are ≥ million other individuals competing with you on the same network, the chance of a device getting a Bitcoin reward is similar to the chance of winning the lottery. Therefore, you can get a faster Hash Rate (units include: KH/s, MH/s, GH/s, etc.) by increasing processing power or using multiple devices. The term hash-rate can be explained as how fast a device or group of devices can calculate numbers and verify transactions (a measure of computing power). Decentralized P2P networks like the Bitcoin blockchain have no central figure and can only make decisions based on different consensus mechanisms. The consensus mechanism not only verifies transactions, but also lays the foundation for mining. Consensus mechanisms come in many forms, but they all serve the same goal: to "verify and ensure the authenticity and integrity of records" (source: Tech in Asia). There are three main mechanisms: Proof of Work, Proof of Stake, and Proof of Power. In this article, I will focus on the Proof of Work approach to consensus. Speaking of mining, this summarizes how the Proof of Work model works: individuals first create a Proof of Work , and then they verify Bitcoin transactions to ensure that the records in the blockchain are authentic . However, before verifying transactions, let’s take a deeper look at the purpose of Proof of Work . History and Purpose of Proof of Work This idea of Proof of Work has been around since 1993, when it was proposed by Cynthia Dward and Moni Naor in a paper (On Memory-Bound Functions For Fighting Spam) that explained different ways to stop spam. The paper focused on the idea of sending emails using computing power. For example, if you want to send me a message via email, then you have to prove that you spent, say, 30 seconds of computing power just to send me that message. Because of the speed of modern computers, spam messages/emails/transactions become a big problem in this context. However, by setting a "price" for each action, spam can be greatly reduced. Verify diligent door key example on onenote In short, the “prover” proves to the “vercker” that they invested a certain amount of computing power over a certain time interval. As time went on, Bitcoin's creator Satoshi Nakamoto modified the idea of having Bitcoin miners generate the data fragment, which is the difficult part. It would be easy for others on the network to verify whether it actually meets the target hash value, because they only need to pass the required data through the SHA-256 algorithm. Through this Proof of Work system, it is possible to ensure the security of systems such as blockchain and establish a verification consensus, because the actual verification of the block will be a device with huge computing power. This gives the network an economic reason to maintain fairness and integrity. For example, if a fraudulent transaction occurs and is approved, users will become "hesitant" to switch to other cryptocurrencies and lower the price. Economically, miners, who are the ones who "produce" Bitcoin, will be unhappy because the price has fallen. At the same time, only the controlling miners have enough computing power to trigger fraudulent verification. Therefore, the motivation of miners' work will shift to protecting transactions to ensure that the price of the currency does not fall. Disadvantages of Proof of Work While Proof of Work is used in some of the largest cryptocurrencies (Bitcoin, Ethereum, etc.), this does not mean it is the most efficient and secure system. The Proof of Work process takes a lot of work because the computer just uses all the possibilities to guess the correct answer in a brute force way. This wastes a lot of electricity and resources. On a larger scale, imagine all the miners in the world trying to "mine" to get the Bitcoin reward while wasting resources if they don't guess the nonce first and don't even contribute to the network. Violates the concept of decentralization Since mining requires a lot of electricity, miners set up central mining farms and controlled most of the block verification. This almost made the idea of P2P decentralization useless because it meant that only controlling miners would agree to attack the network. The cost of electricity also encourages miners to gather in places with lower electricity costs and higher profits in order to carry out mining activities. Centralized decision-making power. Proof of Work Alternatives As mentioned above, there are other consensus mechanisms that can replace PoW. For example: Proof of Stake, Proof of Authority, and Proof of Capacity. Proof of Stake determines the transaction validator by the amount of currency in the validator's wallet. Imagine a group of people buying lottery tickets. The person who buys the most tickets will have a greater chance of winning. This is similar to proof of stake, if you have the most cryptocurrency in your wallet, you will have the greatest chance of becoming a validator and receiving rewards. Proof of Authority determines transaction validators by their individual “trustworthiness”. Imagine a group of people selecting a few of the most trustworthy and reputable people to verify the validity of a transaction. Proof of Capacity identifies validators through their individual contribution to the network’s memory space. This mechanism allows contributing nodes on the network to share memory space, so the more memory a contributing device has, the greater the possibility of it becoming a validator and receiving rewards. The amount of computation required by the above methods is greatly reduced, which can save more power in transaction verification. Mining is the process of verifying and generating Proof of Work . Generating Proof of Work allows miners to verify transactions. Generating a Proof of Work is a process of numerical guessing and forcing. Proof of Work wastes electricity. In addition to Proof of Work, there are other methods, such as Proof of Stake, Proof of Capacity, and Proof of Authority.
Olivia edit
The content is for reference only and is not intended as investment advice. Please assume all risks All rights reserved. Reproduction without permission is strictly prohibited.
|