2

I'm wondering how much data a smart contract can store per block.

Ex: The gas limit is currently ~6,700,000, and it costs 20,000 gas to store 32-byte word. So the EVM can store a maximum of 335 bytes (6.7M / 20k) of data per block? Is this reasoning correct?

2

Correct except 335 of 32-byte words not 335 bytes i.e. 10720 bytes. This is a very rough estimation as you need to subtract the 21000 intrinsic gas, gas paid for other opcodes executed in your transaction and your transaction will have to be included as the first and only transaction of a block.

Also 20000 gas is the price for the newly allocated storage slot, in case you're updating a previously allocated storage slot you only pay 5000 gas.

Also the storage is not actually included in the block. The block only includes the global state trie root hash. The storage data resides on the client nodes state database (leveldb in geth).

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.