Are Solidity mappings stored in memory or storage?
I know that keys are hashed to a unique identifier for the value, which is stored where?
I can't seem to find any clue in the documentation.
remixsolcsolidity
Are Solidity mappings stored in memory or storage?
I know that keys are hashed to a unique identifier for the value, which is stored where?
I can't seem to find any clue in the documentation.
Best Answer
They will be in storage as memory should be cleared after each transaction. So if a mapping was anything but storage it would not persist. Anything defined within the scope of a contract will be stored in that contract's storage.
See http://solidity.readthedocs.io/en/latest/frequently-asked-questions.html#what-is-the-memory-keyword-what-does-it-do
Here's the proof of work Ethereum Blockchain Mechanism
Also see Where are the variables of a smart contract stored?