RandomX is the name of the new algorithm mining is. of Monero, the privacy coin and whose objective is to keep the network protected from ASIC mining, allowing only CPU mining, and at the same time providing enormous security to its protocol and blockchain

EThe RandomX mining algorithm, is an algorithm of Proof of Work (PoW) which has been designed to replace the well-known CryptoNight of the cryptocurrency Of privacy Monero (XMR).

Like its predecessor, RandomX was designed to be secure and to be Monero's new default algorithm. It offers a high level of cryptography, and is focused on systems with privacy and anonymity in mind. But above all, thought to be resistant to mining by ASIC. The latter, a capacity that CryptoNight had lost some time ago, and that it kept afloat with several updates. However, the Monero team made the decision to create a new algorithm from scratch. An algorithm that will take the best of CryptoNight and thus create a new mining base for Monero.

The result? A mining algorithm like never seen before and with very promising resistance to ASIC. This in addition to an improvement in mining capacity for CPU, which has once again led the currency to a better decentralization of mining.

But RandomX is much more than that, it is a proven, audited algorithm that has enormous growth potential. It is for these reasons that we will dedicate a space to analyze RandomX and all the new things it brings to the crypto world, and how Monero has benefited from it.

Origin of RandomX

As we have indicated, RandomX was born from the need of the Monero (XMR) project to have a new mining algorithm capable of resisting the advance of ASICs.

Let us remember that in 2018, companies Baikal y Bitmain they had announced the first ASICs for CryptoNight, breaking the resistance that said algorithm had posed for several years. Quite an achievement for both companies, especially considering that CryptoNight was quite a complex algorithm. In fact, this was designed in order to avoid ASIC mining from the beginning.

However, the companies' achievement was not well received by the Monero community and other blockchain communities using the CryptoNight algorithm. And above all, because Monero is a cryptocurrency where ASIC miners are not well received.

The manufacturing monopoly of ASICs and the access to them by entities with large sums of money leave no opportunity for normal people to benefit from the mining process, leaving everything centralized in a few hands. Something that in turn represents a single point of failure for the entire coin.

In Monero mining, in general, had been carried out by CPU and GPU, so the ASICs posed a serious risk of centralization and security, due to the possibility of a 51% attack.

To alleviate the situation, Monero began developing new variants of CryptoNight that negatively impacted the performance of ASICs. Some updates had a good scope, but the ASICs still held up. At this point it was obvious and what was happening, CryptoNight was insufficient and a new algorithm was needed.

This gave birth to Monero Classic, powered by miners who wanted the ASIC-mineable algorithm. However, this attempt was hardly received.

Even so, they continued to improve the ASICs for Monero, and on October 31, 2018, the development of RandomX began. This new algorithm would represent, according to the Monero developers, a radical change in mining algorithms. The work paid off on May 5, 2019, when the first version RandomX was released.

The RandomX algorithm was developed for Monero by the developers tevator, hyc, vielmetti, antanst y Schernykh and was successfully activated on the Monero network on November 30, 2019.

How does RandomX work?

The rough operation of RandomX is written in its name: randomness is its main premise. But what does this mean? Well, it means that RandomX is designed to create a completely random "work zone" or scratchpad, with a high memory consumption, and that it uses advanced virtualization techniques for its operation. These three pillars are what allow RandomX to be ASIC resistant.

In fact, RandomX is not only ASIC-resistant, but GPU-resistant as well, as these chips lack the necessary instructions to perform the complicated RandomX operations in the first place. As a result, RandomX seeks to be a CPU-only mining algorithm, offering the highest possible resistance to other types of mining. On the other hand, this is also aimed at avoiding the so-called very famous botnets in Monero, as RandomX will make them almost impossible to implement. Especially in low-power devices, such as Smart TV or IoT devices (Internet of Things or Internet of Things).

But how does RandomX make all this possible? Well, let's examine this new algorithm a little more thoroughly.

Two types of mining, for two different uses

First of all, RandomX has two mining modes. Each of them with very different requirements and performances. The most powerful and resource-demanding mode is Quick Mode, which requires at least 2GB of memory. But additionally if the operating system has support for NUMA (Non-Uniform Memory Access), Huge Pages (memory paging in large blocks), high-core processors and at least 2 GB of RAM per processor core, the final performance of RandomX improves substantially. This is because all of this memory is used to create RandomX's random scratchpad.

Second, we have Lightweight Mode, a mode that only requires 256MB of RAM and has been designed to be used in Monero's validation nodes. The mining performance in this mode is limited, and it is up to 6 times lower than the Fast mode, so the profits per mining would be rather meager using this mode.

Already at this point we have a first barrier against ASICs. While it is true that ASICs can now have large amounts of RAM (such as those in Ethereum that usually have between 4 to 8 GB of RAM), this makes these computers quite expensive.

Second, given the high consumption of computing power, if a computer is infected with a cryptojacking To mine Monero, it will be easily identified by the user. Something that greatly reduces the chances of success of a botnet.

Cryptography used

If the Monero (XMR) project has us accustomed to something, it is to the use of advanced cryptography in its developments. In this case, RandomX is not the exception to the rule, but the full compliance with it. In RandomX they make heavy use of the Blake2b hash functions, the Argon2d password generator, and AES symmetric cryptography. As a result, the cryptographic quality of RandomX is exceptional.

However, at Monero they have not settled for their work alone, and have decided to run formal cryptographic security and implementation audits on the RandomX algorithm. In total there are four audits carried out by the companies Trail of Bits, X41 D-SEC, Kudelski Security y Quarkslab, all of them managed by OSTIF, an organization with a long history in cybersecurity and cryptography.

All the audits have already been carried out, and the results of them are promising. If you want to know a little more about this point, we invite you to review the results in this link.

Your Proof of Work scheme

The RandomX Proof of Work (PoW) scheme is as follows:

First, a key is generated (called the K key) which is selected to be the hash of a block in the blockchain. This block is called "Key block". For optimal mining and verification performance, the key should change every 2048 blocks (approx. 2,8 days) and there should be a delay of 64 blocks (approx. 2 hours) between the key block and the K key change This can be achieved by changing the key when the following is true blockHeight% 2048 == 64 (where% is the modulus of the division) and selecting the key block so that keyBlockHeight% 2048 == 0.

At that point, the H input is the standard hash blob with a value nuncio selected.

Although all this seems a bit cryptic, what the RandomX algorithm means is that its proof of work works under two important premises:

  1. You need a key (called K) that must change every 2048 blocks. This key is vital for RandomX to be able to generate valid hashes and blocks for the network.
  2. The key is generated with data from the blockchain and ultimately with a secure key generation system.

On the other hand, the algorithm also makes things a bit more complex, by requiring specific execution conditions. Among these conditions we can include:

  1. 64-bit CPU architecture, allowing it to handle large volumes of data and memory.
  2. An FPU (Floating Point Unit) unit compliant with the IEEE 754 standard. If the unit is not compliant, the data generated by the algorithm cannot be validated.
  3. Support for AES. If the support is by hardware with extensions like AES-NI, the performance of the algorithm is much better.
  4. Lots of cache memory for each thread of the algorithm. At least 16 KB of L1, 256 KB of L2 cache, and 2 MiB of L3.
  5. An operating system with support for handling large memory pages. Remember that RandomX uses at least 2 GB of RAM and the demand may increase depending on the configuration.

The RandomX Virtual Machine

The functionality that is perhaps the greatest resistance to ASICs, and in fact is a unique feature of this algorithm, is its virtual machine or VM (Virtual Machine).

RandomX does all its cryptography and mining work within a simple virtual machine whose purpose is; isolating the entire mining process into a series of processes that act under their own instructions and virtualized architecture.

This seeks to increase the complexity of implementing an ASIC solution to levels never seen before. At the same time, the CPU implementation is simplified and can be adjusted according to future needs. This virtual machine can perform its different tasks thanks to a set of custom CISC-type instructions. This feature allows very easy communication with CPUs that use a set of instructions of the same type. Unlike ASIC chips, which use a RISC-type instruction set, and CISC-over-RISC emulation is computationally expensive, adding more complexity to an ASIC solution for RandomX.

The objective of this virtual machine is to create the necessary environment for the RandomX proof of work to be carried out. To achieve this, this VM creates a random workspace (scratchpad in memory), highly encrypted and full of entropy (random data that will later be used for the proof of work).

Once these conditions are created, the VM receives the instructions to start the mining programs. Each of these programs is created using the random data from the workspace and results in a unique program.

This program will apply all the processes allowed by the VM to perform the mining, that is, the program can only execute the instructions allowed by the VM (256 instructions and 20 registers), nothing more. At this point, what happens in the RandomX VM is practically invisible to the rest of the computer, due to the use of cryptography throughout this process.

This process of creating random programs to perform mining is called Dynamic Proof of Work, and it is the scheme that RandomX uses precisely at this point. This system can be defined as follows:

  1. The random program is generated first. It is what the VM does when starting the scratchpad and all the elements of the program in a first work cycle.
  2. Then the VM is in charge of acting as a translator between the CPU and the random programs. Random programs can only use instructions from the VM, but the VM translates these actions into machine code understandable by the CPU. In this way, the CPU responds to the actions and the VM receives the responses. As the instructions make use of cryptography the optimization is very expensive.
  3. Finally the execution of the program, at this point the VM allows access to the CPU and its capabilities without losing the association with the random program. This point occurs under very specific and special conditions already programmed into the RandomX algorithm. In fact, any variation ends up yielding invalid data because this process is completely reproducible.

Without a doubt, the RandomX VM is the most complex and difficult to replicate element, thus being its best card against ASICs.

How much do you know, cryptonuta?

Does the new RandomX implementation in Monero improve mining performance over CryptoNight?


One of the big problems with CryptoNight is that each new iteration or improvement required more computational power to work, which reduced the mining capacity of the CPUs and only slightly slowed the appearance of an ASIC capable of executing it. Against this, RandomX leaves behind the performance impact and offers better security, in fact, the performance of RandomX against CryptoNight is up to 20 times on the same hardware, and at the moment no ASIC can implement a viable mining system.

Pros and cons of the algorithm


  1. It is an algorithm with a clear security objective. The use of AES, Blake2 and Argon2 makes this algorithm very secure.
  2. Since it is designed for CPUs and has ASIC and GPU resistant structures, this algorithm can better exploit this hardware. As a consequence RandomX offers better returns for CPU miners so that they can continue to earn more for mining Monero.
  3. Resistance to ASIC allows blockchains using RandomX to be more decentralized at the mining level.
  4. RandomX is an algorithm that has four full formal audits.


  1. It is complex. The use of a VM and process randomness makes this algorithm much more complex to develop and debug.
  2. The use of VM opens the door to lateral attacks that can be used to break the system and exploited to improve performance under certain conditions. However, the use of crypto in the scratchpad makes this point very difficult, which is why many believe it to be impossible.
  3. Devices with 32-bit CPU cannot exploit the algorithm correctly.