how does Scrypt use memory?

4

I saw in some places that Scrypt uses a lot of memory, therefore a good supply of system RAM is needed to hash with it. however, I saw in other places stating that is ONLY uses L2 Memory. which one does it use?

ZCoder

Posted 2014-01-08T23:21:52.600

Reputation: 325

Answers

3

The amount of memory that scrypt uses can be adjusted to get the desired behavior. If a particular CPU has enough L2 memory to hold all that's needed for a particular scrypt use case, then the performance of system memory will not be relevant. Scrypt-based coins can increase the memory requirements dynamically as one way of increasing the mining difficulty.

David Schwartz

Posted 2014-01-08T23:21:52.600

Reputation: 46 931

2

Litecoin use scrypt with 128 KB of memory (source), therefore it can be stored in the CPU cache.

Scrypt is a sequential memory-hard hash function. You can tell it, how much memory it should use to generate a hash. You can even tell it to use GBs, in fact. The problem is, you always need that much memory to verify a hash. This will make hardware very expensive and the generation rate will be much lower.

oleksii

Posted 2014-01-08T23:21:52.600

Reputation: 391

in my experience it seems to run out of memory only when the GPU does, so it doesn't seem to be using the system RAM(I can tell because the limit is higher for some GPUs than others, even with the same amount of system ram)ZCoder 2014-01-09T21:47:47.437

Litecoin uses low scrypt parameters to allow clients to verify the computed result fast enough. In case of proof-of-work cryptocurrency, all clients need to be able to verify the proof of work and if scrypt were used with high parameter values, that verification would be too costly.Mikko Rantalainen 2018-07-06T11:35:43.777