Read Monero's Fair Mining Algorithm RandomX

Author: Pan Zhixiong

Source: Chain News

As professional mining equipment fully invades cryptocurrencies and blockchain platforms, more and more people are beginning to worry that the so-called "decentralization" is at stake. For example, in Bitcoin with the largest number of users, no one has used the general-purpose CPU and GPU to participate in network consensus, because the cost far exceeds the benefits. Some projects are trying to develop more general PoW algorithms to allow more people to participate. For example, the Monero project, which has been at the forefront of R & D resistance to ASIC mining algorithms, has just upgraded the PoW algorithm by hard fork. A modern CPU and at least 2GB of memory can participate fairly in mining.

The hard fork upgrade was activated at a block height of 1,978,433, which is about 3 am on December 1st. Monero will switch the proof-of-work algorithm to RandomX to replace the original CryptoNight algorithm and weaken the dedicated mining equipment ASIC pair. Impact of network computing power and optimization for CPU mining. In addition, other updates are included in this version, including: the long payment ID will be phased out to improve the user experience and reduce support for the exchange; each transaction must include at least two outputs; in the agreement The hierarchy will enforce a lock time of 10 blocks (about 20 minutes) after the transaction is received.

Monero upgrade planning

Is decentralization useless?

Now many cryptocurrencies based on proof of work consensus will face a question. Although this type of blockchain platform does not require everyone to join, the mining equipment participating in consensus has become more and more specialized. This will cause ordinary users to be unable to participate in the consensus decision of the network, which means that the concept of "decentralization" becomes useless. Even Bitcoin can't get rid of such a problem, maybe Satoshi Nakamoto didn't expect the PoW algorithm originally suitable for the CPU of the central processing unit. After the geeks' transformation, customization and R & D, the CPU and GPU are gradually eliminated. Dedicated ASIC devices occupy all the computing power of Bitcoin. For example, Bitmain and Jianan Technology focus on the development of such chips.

Explosive growth in Bitcoin difficulty

Therefore, many R & D personnel are trying to develop PoW algorithms that ASIC cannot obtain an advantage, or algorithms called "resisting ASIC", allowing more people to participate in the network using general-purpose computing devices. The degree of decentralization has also increased. The RandomX algorithm upgraded by Monero through a hard fork in the early hours of December 1st is one of these attempts worthy of attention.

RandomX for everyone to participate in mining

Tevador, one of the RandomX developers, wrote in the document: "RandomX is a proof-of-work algorithm optimized for general-purpose CPUs. RandomX uses random code execution and several memory technologies to minimize the efficiency advantages of dedicated hardware." RandomX It is also named after "random code execution".

Technically, RandomX uses a virtual machine to execute programs in a specific instruction set, such as integer operations, floating-point operations, and branch prediction. Such programs can be instantly converted into the CPU's native machine code. Finally, the output of the executed program is combined into a 256-bit result using the hash function Blake2b. RandomX can run in two modes, fast mode requiring 2GB shared memory or light mode requiring 256MB shared memory. These two modes can be switched at any time and the results are the same, but the fast mode is suitable for "mining" and the light mode is more suitable for verifying transactions.

Only 2GB of memory and a modern CPU can be used for mining, and the entry threshold for ordinary users to participate in mining has been reduced a lot. If you buy any new PC within the next two to three years, the memory requirement is definitely met. As for the CPU, the developer thinks that the CPU after 2011 is more suitable. The specific configuration depends on the relevant data. According to some existing data, it seems that AMD has an advantage over Intel. If you want to run a full node, you only need to use "light mode", and the memory requirement is only 256 MB.

RandomX hashrate comparison of some chips

Arweave will also integrate RandomX

Of course, for such emerging algorithms, security risks need to be avoided as much as possible. Therefore, the RandomX algorithm has undergone security audits by four independent security research teams, namely Trail of Bits, X41 D-SEC, Kudelski Security, and QuarksLab, and these four audits were organized by the "Open Source Technology Improvement Fund" (OSTIF) coordination. The first audit funding came from Arweave, a blockchain permanent storage protocol. They were also early adopters of RandomX. The other three funding came from Monero's community donations. The audit report did not find any serious defects in RandomX, and some other issues have been fixed in the code.

Arweave project official website

Arweave CEO Sam Williams said, "ASIC-resistant PoW algorithms such as RandomX will further enhance the permanent, low-cost, and tamper-resistant network we provide. RandomX helps us ensure decentralized content policies in the Arweave network , Will maintain a good distribution among all parties around the world. "

Not only are Monero officials exploring this, but there are also projects that are willing to try these more fair algorithms. However, such algorithms are relatively new. Although they have passed many security audits, there are still many details that require longer observation. Nevertheless, RandomX is still an experiment that cryptocurrency geeks are willing to see, and it may also be a nightmare for miner manufacturers.