I know that remix can measure the execution cost and transaction cost. I want to measure the storage overhead ( Size of data in Bytes) on creating a contract on the etherum blockchain or calling a function on the contract

1 Answer 1


Once you are fully aware of the control flow of your smart contract, then you can use the total gas usage of your transaction (transactional cost) along with the EVM fee schedule (defined in the yellow paper) to measure the storage overhead of your transaction.

Let's look at an example to give you an idea of the process, let's deploy this contract to the network.

contract NameAssignment {

    string public name;

    function addName(string calldata _name) external {
      name = _name;

Assume a transaction call to the addName function. In this call we want to assign the name "Amelia" to be stored in the name variable. Performing this transaction call has a transactional cost of 43082 Gas to add the transaction to the network.

Going through the fee schedule of the yellow paper, we can learn the relevant stuff related to calculating the storage overhead of our transaction.

enter image description here

So we have following rough calculation: (43082 - 21000) / 68 = 324 Bytes

  • What do u mean by the flow of your contract? Assume I have a simple contract that acts as a counter that increases when someone calls him. And the transaction cost is 30000 in gas. How can I measure how many Bytes stored in the blockchain? Jun 11, 2019 at 0:30
  • I edited my answer, I hope it helps.
    – 6egic
    Jun 11, 2019 at 1:31
  • Thanks a lot. But I can understand why u subtract 21000 from the whole 43082. But why u divide by 68? Also, by looking to the table, it contains gas used " not the bytes stored" so I think 68 is the gas being used for every non-zero byte of data or code Jun 11, 2019 at 5:00
  • because you want to find the storage overhead of your transaction. As per the yellow paper you know the cost per non-zero byte of data equals 68 Gas. Once you've subtracted the other variables from the equation i.e. txcost of 21000 and so on, then you're left with the total storage overhead in gas. If you know the gas used, then you know the bytes stored as well according to the yellowpaper.
    – 6egic
    Jun 11, 2019 at 12:26
  • Thanks a lot. That method also can be used to compute the storage overhead of sending a contract to the blockchain i.e., by dividing by 68 Jun 11, 2019 at 22:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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