10
$\begingroup$

My naive understanding of proof-of-work algorithms is that they are essentially a p=np type problem where it's easy to check a solution, but difficult to produce a solution.

I have recently read that some cryptocurrencies are based on algorithms that are designed to be resistant to ASIC mining - they're built to live on the GPU. This got me wondering if there is a proof-of-work algorithm that could be designed to run on CPU (and therefore GPU/ASIC usage would give poorer performance)?

My first instinct was no, but then I remembered that we don't use GPUs for the main operation of our computers and there is probably a reason. So is it possible to make CPU based proof-of-work algorithm that wouldn't translate to GPUs or ASICs?

$\endgroup$
9
  • 7
    $\begingroup$ I'm not confident enough to make that an answer, but I think you are looking for Argon2. $\endgroup$
    – fgrieu
    Jun 29 at 19:29
  • 4
    $\begingroup$ Also relevant: memory-hard functions and bandwidth-hard functions. $\endgroup$
    – ckamath
    Jun 30 at 4:11
  • 1
    $\begingroup$ Although CPU mining seems more egalitarian, this long article argues that ASIC mining can be a good thing. Because ASICs are only useful for a particular coin, purchasing the hardware is a sunk cost so that the miner is committed to upholding that coin and potentially producing better long-term stability. $\endgroup$
    – Nayuki
    Jun 30 at 6:12
  • 5
    $\begingroup$ Notice that GPUs are really only ASICs for 3d geometry calculations (and other stuff needed for rasteritation Rendering) with the latest generations adding circuitry specifically for Ray tracing. CPUs on the other hand are, by definition, the opposite. They must be able to carry out almost any calculation at a reasonable speed. As a result, they really aren't the best at anything. For almost any algorithm that one can conceive one can also make specialized ASICs that beat a CPU in that task. So as soon as your cryptocurrency offers large revenues someone will build one. $\endgroup$
    – marstato
    Jun 30 at 10:19
  • 2
    $\begingroup$ As pointed out by others: You are looking for memory-hard and bandwidth-hard functions which are typically found in the context of password hashing / password-based key derivation which try to be formulated that the best hardware implementation is reasonably close to current CPU designs. $\endgroup$
    – SEJPM
    Jun 30 at 10:45
11
$\begingroup$

CryptoNight, the pow function used by Monero is such a function. https://monerodocs.org/proof-of-work/cryptonight/ Basically it needs more random memory accesses, and GPU memory is not designed for that. So the bottleneck is not the computing power, but the access to the memory. The CPU needs fast and random access to the memory all the time to execute programs, so it is designed to be good at that. Additionally CryptoNight is designed to work great with the L3 cache size of most CPU for really fast access.

Edit: Monero uses RandomX now and not CryptoNight, as I was told in the comments. The principle of relying on random memory access stays the same. In addition the instructions used for calculation depend on the input, what is really bad for gpu, since the cores can only perform the same instructions (they don't have separate program counters)

$\endgroup$
2
  • 3
    $\begingroup$ just to specify that actually Monero isn't using CryptoNight anymore, RandomX instead $\endgroup$
    – baro77
    Jun 30 at 9:35
  • 5
    $\begingroup$ It is worth noting that CryptoNight is no longer used by Monero, since the emergence of ASICs that outperform CPUs - contrary to what they expected. This has proved to be something of a cat and mouse game. $\endgroup$
    – James_pic
    Jun 30 at 9:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.