RandomX — Monero's Mining Algorithm Explained

TL;DR: RandomX is Monero's proof-of-work algorithm, active since November 2019. It's designed to run optimally on consumer CPUs — making ASICs and GPUs inefficient. Key innovation: random program execution + 2 MB scratchpad that fits in CPU L3 cache. Result: anyone with a computer can mine Monero, keeping the network truly decentralized.

How RandomX Works

🎲
Random Programs
Generates random code each round — ASICs can't optimize for a fixed pattern
💾
2 MB Scratchpad
Fits perfectly in CPU L3 cache, inefficient on GPUs
🔀
Branch-Heavy
Exploits CPU branch prediction, which GPUs lack
Full CPU Usage
Uses integer, float, and memory ops — needs general-purpose silicon

Each mining round, RandomX generates a random program from the block header. This program uses integer arithmetic, floating-point operations, branches, and memory access patterns designed to exploit every feature of a modern CPU. The program reads and writes to a 2 MB scratchpad — sized to match a typical CPU's L3 cache.

Because the program changes every round, hardware can't be optimized for any specific computation pattern. An ASIC would need to implement the full instruction set of a CPU to be competitive — at which point it is a CPU, with no economic advantage.

Two Modes: Fast and Light

ModeRAMInitializationSpeedUse Case
Fast Mode~2.5 GB~1 secondFull speedMining, dedicated rigs
Light Mode~256 MBMinimal~5x slowerVerification, mobile, low-RAM

Fast mode stores a 2 GB dataset in RAM for quick lookups. Light mode recalculates lookups on the fly — slower but uses far less memory. Mining uses fast mode; node verification uses light mode.

CPU Hashrate Benchmarks

CPUHashrate (H/s)Cores/ThreadsNotes
AMD EPYC 7763~36,00064/128Server, 256 MB L3
AMD Ryzen 9 7950X~22,00016/32Consumer top-tier
AMD Ryzen 9 5950X~18,00016/32Previous gen king
AMD Ryzen 7 5800X~9,5008/16Great value miner
Intel i7-13700K~10,50016/24Intel best performer
Intel i7-12700K~9,00012/20Good Intel option
Apple M2 Pro~6,00012ARM architecture
AMD Ryzen 5 5600X~6,5006/12Budget miner

AMD dominates because Ryzen CPUs have larger L3 caches (32-64 MB) than Intel equivalents. More L3 = more threads can hold the 2 MB scratchpad simultaneously.

Why ASIC Resistance Matters

Bitcoin's SHA-256 is simple enough to implement in dedicated hardware (ASICs). The result:

RandomX eliminates all of these. Anyone's existing computer can mine. No special equipment. No manufacturer dependency. Mining power distributes across millions of consumer devices worldwide.

History of Monero Mining Algorithms

PeriodAlgorithmASIC Status
2014-2017CryptoNightEventually broken (Bitmain X3)
2018 (Apr)CryptoNight v1Emergency fork to kill ASICs
2018 (Oct)CryptoNight v2Another tweak
2019 (Mar)CryptoNight RTemporary, randomized
2019 (Nov)RandomXNo ASICs since (6+ years)

Monero forked 4 times between 2018-2019 to kill ASIC miners. RandomX was the permanent solution — it's been unbroken for over 6 years, the longest period without ASIC interference in Monero's history.

RandomX vs Other PoW Algorithms

AlgorithmCoinHardwareASIC Resistant?
RandomXMoneroCPUYes (6+ years proven)
SHA-256BitcoinASIC onlyNo (ASICs dominate)
Ethash (legacy)Ethereum (pre-PoS)GPU/ASICPartially (ASICs exist)
ScryptLitecoinASICNo (ASICs dominate)
EquihashZcashASICNo (ASICs exist)
KawPoWRavencoinGPUPartially

Getting Started with RandomX Mining

Quick Start (XMRig + P2Pool)

# 1. Download XMRig wget https://github.com/xmrig/xmrig/releases/latest # 2. Start P2Pool (decentralized, zero fees) ./p2pool --host 127.0.0.1 --wallet YOUR_XMR_ADDRESS # 3. Point XMRig at P2Pool ./xmrig -o 127.0.0.1:3333

For detailed setup guides, see Mining Guide and P2Pool Guide.

The Bottom Line

RandomX is what makes Monero's mining truly decentralized. By leveraging the full complexity of modern CPUs — random code generation, branch prediction, large caches — it ensures that specialized hardware offers no advantage. Anyone with a computer participates equally. This is the foundation of Monero's censorship resistance.

Mine XMR and need to sell for cash? Cash by Mail EU-wide, Face-to-Face SW Germany. 683 trades, 454 partners, 100% feedback. Contact me on Telegram.