Home

How does the RandomX algorithm work?

RandomX is the set of rules Monero uses to turn computer work into a chance to add the next block of transactions. It makes your processor run a changing mix of small programs and memory tasks, then checks whether the result meets the network’s target. This design favors ordinary computer processors over machines built to do one narrow calculation.

What your computer actually does

Your CPU, the main processor in your computer, starts with information about a candidate block. That is a proposed bundle of transactions for Monero’s shared record.

Mining software changes a small value called a nonce and runs RandomX again for each attempt. RandomX turns the input into a hash: a fixed-length result that looks like a random string of numbers and letters.

To qualify, that result must fall below a target set by the network. A lower target makes success less likely.

You cannot predict which attempt will work. Your computer keeps trying different inputs until it finds a qualifying result—or learns that another miner has found a block and starts working on the next one.

Why RandomX runs small programs

Monero adopted RandomX on November 30, 2019, replacing its earlier CryptoNight-based mining algorithms.

Instead of repeating only a simple calculation, RandomX generates and executes small programs inside a virtual machine. Here, that means a controlled software environment with its own instructions—not a whole extra operating system.

These programs mix tasks such as:

  • Calculations with whole numbers and numbers with fractional parts.
  • Decisions that change which instructions run next.
  • Reads and writes to working memory.
  • Accesses to a larger collection of prepared data.

The programs are generated from the mining input. They are not downloaded code from strangers. Despite the name “RandomX,” the process is repeatable: the same input and starting data produce the same result. That lets other computers check your work.

How memory shapes the work

RandomX deliberately makes memory important. Pure calculation speed is not enough if your processor must wait for data.

It supports two main operating modes:

  • Fast mode uses a dataset of about 2,080 MB, plus supporting memory. This is the usual choice for mining.
  • Light mode uses a 256 MB cache and calculates needed dataset items along the way. It saves memory but runs much more slowly.

Each mining thread, an independent stream of work, also uses a roughly 2 MB working area. For good performance, you generally want about 2 MB of L3 cache per thread. L3 cache is a small, fast memory store inside your processor.

That is why adding more threads does not always help. Once they compete for limited cache or memory access, extra threads can bring little benefit.

Why this favors CPUs

An ASIC is a chip built for one specific job. RandomX aims to make a specialized mining chip less advantageous by requiring many abilities that general-purpose CPUs already have.

It is better described as ASIC-resistant, not ASIC-proof. Graphics processors can also run RandomX, but its workload generally suits CPUs better.

In your browser, the same demanding work faces additional limits from the browser’s execution environment and memory handling. A faster CPU alone does not guarantee strong browser-mining performance.

The bottom line

RandomX combines changing programs, calculations, and memory access to make mining well suited to ordinary CPUs. You win a block by finding a qualifying hash through repeated attempts—not by solving a useful program or finding a clever shortcut.

All 1,000 questions

MyAiMiner.com

MyAiMiner.com — Monero mining blog. 1,000 questions. Clear answers.

Monero (XMR) Mining BLOG

Hashes0
Blocks accepted0
Blocks rejected0
Runtime00:00:00