0

I would be grateful if anyone can help me understand the storage of a smart contract. Before someone mention the question as duplicate i want to clarify that i had read the post here but i was confused. Moreover i read the solidity docs here that states:"Every account has a persistent key-value store mapping 256-bit words to 256-bit words called storage." So can i imagine the storage as an array with two columns and 256 rows, where each cell holds 256bits?

The reason i am asking is because i want to use the smart contract as a storage of hash values. So i want each time to store a new hash but i need to know how many 256hash values can be stored.

  • The answer of your question is on the first post you linked. There are 2^256 different keys that can be stored, each one of 32 bytes (256 bit). – mirg Apr 4 '18 at 16:05
  • I was confused because i thought the answers given about the storage in the post were not the same as the one in the solidity docs. Now i get it, there are 2^256 free spots that each can store 256bits. Thank you! – kathi Apr 5 '18 at 12:25
0

I believe my blog post Understanding Smart Contract Storage will help.

As to how many hashes you could store:

There are 2256 locations to choose from in storage, which is approximately the number of atoms in the known, observable universe.

| improve this answer | |

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