Any comments, contributions, or feedback? Ping me!
Follow @adlrocha Tweet to @adlrocha
RandomX: PoW for general-purpose CPUs
I was discussing today with the Fluence Labs team and they were describing how they want their Fluence network to be run by a PoW consensus algorithm. They want miners to be able to mine new blocks with just a general-purpose CPU, without requiring expensive GPUs or ASICs. And I didn’t know that there was already a PoW implementation, originally implemented for Monero, that is optimized for its use in general purpose CPUs.
This implementation is RandomX. “RandomX is a proof-of-work (PoW) algorithm that is optimized for general-purpose CPUs. RandomX uses random code execution (hence the name) together with several memory-hard techniques to minimize the efficiency advantage of specialized hardware.".
Borrowing a few paragraphs from their README:
RandomX utilizes a virtual machine that executes programs in a special instruction set that consists of integer math, floating point math and branches. These programs can be translated into the CPU’s native machine code on the fly (example: program.asm). At the end, the outputs of the executed programs are consolidated into a 256-bit result using a cryptographic hashing function (Blake2b).
RandomX was primarily designed as a PoW algorithm for Monero. The recommended usage is following:
- The key K is selected to be the hash of a block in the blockchain - this block is called the ‘key block’. For optimal mining and verification performance, the key should change every 2048 blocks (~2.8 days) and there should be a delay of 64 blocks (~2 hours) between the key block and the change of the key K. This can be achieved by changing the key when blockHeight % 2048 == 64 and selecting key block such that keyBlockHeight % 2048 == 0.
- The input H is the standard hashing blob with a selected nonce value.
If used with care, this protocol should achieve ASIC resistance, offering theoretical “equal” opportunity and access to mining rewards to all miners in the system.
The team at Fluence seems to also be exploring a RiscZero implementation for RandomX. Really cool stuff!
Any comments, contributions, or feedback? Ping me!