Network and blocks
What is RandomX?
RandomX is Monero's proof-of-work algorithm, designed to run best on general-purpose processors.
- Coin
- Monero, since 30 November 2019
- Main memory
- about 2 GB, shared by all threads
- Cache per thread
- 2 MB of L3
- Best hardware
- processors with large caches
- Monero block time
- 2 minutes
What it means in practice
It runs randomly generated programs that use the CPU's memory and instruction set, which makes dedicated chips much less of an advantage than on other algorithms. Hashrate is quoted in H/s or kH/s.
Processors and dedicated machines
RandomX leans on fast memory and the full set of things a processor can do, so a desktop computer is a real miner here. There are also dedicated Monero machines: they put many suitable processor cores and memory in one box and are quoted in kH/s.
Programs that nobody has written
For each attempt the header is turned into a random program for a small imaginary computer. It adds, multiplies, divides, works with decimals, jumps and reads memory. Several such programs run one after another, each made from the result of the last. The final state is hashed and compared with the target.
A chip that could do only a few of these operations would fail at the rest. The fastest way to run any program is a processor, and that is what the designers had in mind.
Memory sets the pace
A dataset of 2,080 MiB lies in main memory and is read all the time. Each thread also works in a private area of 2 MiB that should fit into the processor’s cache. Example figures: a processor with 64 MB of L3 cache feeds 32 threads, whatever its core count says.
Two sticks of fast memory, large pages switched on in the operating system, and a sensible number of threads often bring more than a higher clock. A light mode with 256 MiB exists for checking blocks. It is too slow to mine with.
A server with two processors needs a dataset for each, so plan about 2.5 GB of free memory per processor.
A dataset that changes
On Monero the key for the dataset changes every 2,048 blocks. At two minutes each that is about 2.8 days. The machine rebuilds the dataset then, which takes a few seconds to a minute, and the hashrate shows a short dip.
The new key is known 64 blocks ahead, so mining software can prepare it. A dip that returns every two or three days is therefore normal. One that comes every hour is not.
Counting energy fairly
Example figures: a desktop processor with 15 kH/s at 140 W for the whole computer uses 9.3 W for each kH/s. A dedicated box with 200 kH/s at 1,350 W uses 6.75. A computer that is running anyway only counts the extra watts, and for it the figure may be lower still.
Monero’s reward no longer falls toward zero. By its rules at least 0.6 XMR is created with every block, about 432 a day, so the supply of new coins for miners is known in advance.
Common mistakes
- Running as many threads as the processor allows when the cache holds only half of them.
- Judging a processor by its gigahertz instead of by measured RandomX results.
- Mining on rented or office computers without the owner’s permission.
Common questions
Is there an ASIC for Monero?
There are dedicated Monero miners, such as the Antminer X series. They run the same programs a processor would.
How do I compare Monero miners?
By watts per kH/s, and by the price of one kH/s.
Can I mine Monero on a laptop?
It runs, and it is a good way to learn. Laptops grow hot under constant load, so limit the threads and watch the temperature.
Do graphics cards work?
They can run it and do poorly, because the programs jump and branch in ways a card is not made for.
What is a huge page?
A larger block of memory that the processor can look up faster. Switching it on usually gives a clear gain in RandomX.