Coding

How Monero's proof of work works

Monero's consensus algorithm is redefined by its unique proof-of-work mechanism, which leverages cryptographically secure hash functions and adaptive block size targeting to secure transactions, while also employing a memory-hard proof-of-work function, RandomX, to mitigate ASIC mining and maintain network decentralization. This approach enables Monero to maintain a high level of security and resistance to centralization. The result is a robust, decentralized cryptocurrency. AI-assisted, human-reviewed.

Monero’s proof of work is called RandomX. Unlike Bitcoin’s SHA-256, which runs the same tiny hash function on every attempt, RandomX asks miners to execute a small random program on a virtual machine, hit memory hard while doing it, and then hash the result. The goal is to make efficient mining look as much like a normal CPU workload as possible — and to make custom ASIC design much harder.

Overview

RandomX takes two inputs: a key K (derived from an older block hash, changed roughly every 2.8 days) and a hashing input H (the candidate block header plus a nonce, changed with every attempt). The key builds a large shared memory dataset; the per-attempt input seeds a virtual machine that runs 8 chained programs. The final machine state is hashed into a 256-bit output. If that output is below the network target, the block is valid.

Step-by-step: what a miner actually computes

  1. Build the cache from the key. RandomX runs Argon2d on K to produce a 256 MiB cache. Argon2d is memory-hard, forcing the machine to touch a lot of memory.

  2. Expand the cache into the dataset. From that cache, RandomX builds a dataset of about 2080 MiB (2,147,483,648 bytes base + 33,554,368 bytes extra). This is read-only during hashing and forces regular DRAM traffic — each program iteration reads one 64-byte dataset item, totaling 16,384 reads per hash.

  3. Initialize the scratchpad from the block input. RandomX computes Hash512(H) using Blake2b, then uses an AES-based generator to fill a 2 MiB scratchpad. The scratchpad is split to mimic CPU cache levels: 16 KiB L1, 256 KiB L2, 2 MiB L3. It is meant to live in CPU cache, not DRAM.

  4. Generate a random program. RandomX generates a 256-instruction program for its virtual machine. Every instruction is 8 bytes long, and any 8-byte word is a valid instruction — so programs can be generated by filling a buffer with random bytes. Instructions include integer math, 64-bit multiplies, floating-point operations (IEEE 754 double precision, including division and square root, using all four rounding modes), 128-bit vector operations, memory loads and stores, and occasional branches.

  5. Run the program loop. The VM executes the 256-instruction program in a loop for 2048 iterations. Each iteration reads about 504 bytes from memory and writes

Similar Articles

More articles like this

Coding 1 min

GitHub Is Down

Global software development ground to a halt as GitHub's primary web interface and API services experienced a widespread outage, crippling the workflows of millions of developers reliant on its version control and collaboration platform. The incident, which lasted for several hours, highlighted the fragility of the modern software supply chain and the critical role of cloud-based services in facilitating global development. The outage's root cause remains unclear, but its impact on the tech industry is undeniable. AI-assisted, human-reviewed.

Coding 2 min

Alberta voter list leak is a potential public safety disaster

A massive breach of Alberta's voter registration database has exposed the personal data of over 3.8 million citizens, including sensitive information such as home addresses and phone numbers, potentially putting individuals at risk of harassment, identity theft, and physical harm. The leaked data, which includes detailed electoral district information, could be exploited by malicious actors to target vulnerable populations. This egregious security lapse underscores the need for robust voter data protection. AI-assisted, human-reviewed.

Coding 1 min

Does Employment Slow Cognitive Decline? Evidence from Labor Market Shocks

New research suggests that employment may mitigate cognitive decline in older adults, with evidence pointing to a significant slowdown in cognitive decline following labor market shocks, such as job loss or retirement. A study analyzing data from over 10,000 individuals found that those who continued working experienced a 30% reduction in cognitive decline compared to their non-employed peers. The findings have implications for retirement policy and workforce development strategies. AI-assisted, human-reviewed.

Coding 1 min

1966 Ford Mustang Converted into a Tesla with Working 'Full Self-Driving'

A vintage 1966 Ford Mustang has been successfully converted into a fully electric vehicle with Tesla's 'Full Self-Driving' (FSD) capabilities, leveraging the company's Autopilot suite and a custom-built battery pack. The conversion, which replaces the original 289ci V8 engine with a 75kWh Tesla Model S battery, marks a significant milestone in the integration of autonomous driving technology with classic car restorations. The project's lead engineer cited the use of Tesla's Vehicle-to-Everything (V2X) communication protocol as a key enabler. AI-assisted, human-reviewed.

Coding 1 min

I tracked 7,700 UK petrol stations every 10 minutes for 3 months

"Real-time fuel price disparities across the UK's 7,700 petrol stations have been exposed through a three-month monitoring effort, revealing a 10% price gap between the cheapest and most expensive stations. The data, collected every 10 minutes, highlights the need for more transparent pricing and better consumer tools to navigate the market. This analysis underscores the limitations of current fuel price comparison services." AI-assisted, human-reviewed.

Coding 1 min

Removable batteries in smartphones will be mandatory in the EU starting in 2027

EU regulators are poised to upend the global smartphone market with a landmark 2027 mandate requiring removable batteries in all new devices sold within the bloc, a move that could force manufacturers to rethink their designs and supply chains, potentially spurring a wave of innovation in modular phone architectures. The new rule is expected to apply to devices with screens larger than 15 centimeters. This seismic shift has significant implications for the industry's future. AI-assisted, human-reviewed.