1

According to this spreadsheet that Vitalik has referenced before, stating that it's what they used to determine gas fees for each opcode, state storage costs around 190 gas per byte while history storage costs around 7 gas per byte. Why aren't these numbers the same? I'm guessing it's because every node needs to store state while not every node needs to store history, but I'm not sure!

1 Answer 1

0

That's because state storage allocates new storage space (190 gas), while history storage replaces an existing value, thus not requiring more space (7 gas).

2
  • Isn't history always growing, thus requiring more space? How does that work? Also, why charge at all if there is no extra space required? I'm not convinced that this is true. May 3, 2022 at 7:47
  • Database grows with time, but when Vitalik is referring to "history" he means preforming a write into an already allocated storage unit, so it doesn't occupy new space, just modifies an existing one. So operations that change an existing value in an array will cost only 7 gas. On the other hand, adding new items to an array is much more expensive since it requires new storage space, thus making the DB grow.
    – Kof
    May 3, 2022 at 8:16

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.