[Glean] What Is Memory-Hard
What Is Memory-Hard?
Wikipedia1
In cryptography, a memory-hard function (MHF) is a function that costs significant amount of memory to evaluate. It is different from a memory-bound function; the latter incurs cost by slowing down computation through memory latency. MHFs find their use as a form of proof of work (PoW).
Linzhi2
- Read-many, write-few
- Memory size chosen to fit inside a CPU L2/L3 cache (can not fit into L1)
- Lack of information about chip design and economics.
Ethash designers learned from Scrypt, and in 2014 created a two-stage memory structure that is growing over time. The first stage is called the pseudorandom cache, and the second stage called the DAG.
The ratio between pseudorandom cache and DAG was set to 1:64.
The first-stage memory (pseudorandom cache) functions as a deterrent to memory down-sampling. We believe size and growth of it are secondary as long as it’s not smaller than 1 MB. The second-stage memory (DAG) functions as a deterrent to single-die solutions.
Ethash’s two-stage memory system works well to mitigate the use of logic to recalculate data (to replace actual reads from memory), but it now costs more to verify a block.
Methods from Linzhi3
Linzhi solves this problem by dividing the DAG memories into 72 mixers decentralised memory in several chips.
Each mixer stores part of the DGA and also contains the logic unit to compute the next DAG address.
I think it kinds of in-memory-computing.