Ethereum storage fees paradigm shift

Vitalik keynote at TechCrunch Ethereum Meetup, a developer perspective.

Broillet Christian
Hortis
5 min readJan 15, 2019

--

Vitalik keynote at TechCrunch Ethereum Meetup

When I was in Zug to attend the TechCrunch Ethereum Meetup, I saw a lot of interesting conferences such as:

  • Intro to Cryptoeconomics from Karl Floersch
  • Research and Sharding from Justin Drake
  • What’s at Stake from David Knott

But from a developer perspective, the most important was Vitalik keynote.

There is a major proposal being discussed that could impact smart contract development: The storage fees paradigm shift.

As it will change the way smart contract fees are accounted, it is better to take it into consideration when you start developing your smart contracts.

Lets go deeper into storage fees:

Storage must be held not just by presently online full nodes, but also by all future full nodes. This is not a one time cost, but a recurrent cost.
Light nodes are not concerned because they hold only the chain of the headers and not the entire chain.

Here are the storage fee issues presented by Vitalik:

Source: Vitalik keynote slide at TechCrunch Ethereum Meetup

Lets take a closer look at what we have on ethereum blockchain :

  • “Storage is underpriced in absolute terms”
    Today you can store data for a few cents and it will be accessible 24/24, indefinitely. There is a strong commitment from the network to accept this. But thinking long term, we need incentives for new nodes to join the network.
  • “Not enough incentive to clear storage”
    You have mechanisms to clear unused storage from current and future state. In Solidity, you have the delete operator and the selfdestruct for a contract.

    For example, if you freed storage location (set to zero):

    a. You will Pay 5’000 for the gas cost of the operation (Gsreset in the Yellow Paper EIP-150).

    b. A refund of 15’000 will be added to the refund counter (Rsreset in the Yellow Paper EIP-150)

    c. The amount of gas in the refund counter is capped to max half total gas used (Eqn 72 in the Yellow Paper EIP-150). Yes, you read correctly, « capped to max half total gas used ». It means you will never receive some ether back. This because miners need incentive to mine your transaction. If miners have to pay you back, they would never mine your transaction !

    d. At the end of a successful transaction the amount of gas in the refund counter is added to the unused gas and returned to the caller.
  • “No incentive to clear storage earlier rather than later”
    For instance, if you use the Solidity selfdestruct function, you will have some gas refund. But the amount will be the same if you do it now or in five years. Same for the delete.

Let’s see Ethereum foundation propositions to tackle the issues above:

Source: Vitalik keynote slide at TechCrunch Ethereum Meetup

So yes, charging N wei per block per byte for every byte stored will incentive you to (i) clear storage and (ii) earlier rather than later !

But wait, it means your smart contract need some ether to support the ongoing storage fees.

If we take the well known ERC20 smart contract, today it can work without ether on its account (ie: fees are paid by the caller). This will not be true anymore !

Guys, are you ready to monitor the cash of your smart contract ? What will happen if your smart contract runs out of money ?

Here are Challenges presented by Vitalik :

  • What if an app depends on a contract that disappears?
  • How would you write a contract that today would allow anyone to save a storage key in the contract, and in this model would cause the contract to incur a permanent ongoing cost?
  • Who pays for upkeep of “public good” contracts?

As you see, it will radically change the way smart contracts are used today. To reduce this impact, Vitalik propose the hibernation concept :

Source: Vitalik keynote slide at TechCrunch Ethereum Meetup

So, before using a smart contract, you need to check if it’s in the hibernation status (Sleep) :

  • If yes, you have to pay to wake it up.
  • If no, check the balance of the contract to be sure it will not going to sleep before your transaction will be mined.

How to optimize the amount to pay to wake up or to maintain your contract up ?

Remember, you will be charged N wei per block per byte for every byte stored. You have to multiply this by the number of blocks you need your contract up.

At Hortis we will follow closely the balance of our clients’ smart contracts to avoid the hibernation status. This will be done by an off-chain process that will refuel the smart contract if the balance falls below a predefined security threshold.

Conclusion :

As you see, there are more questions than answers, because this concept is in the research phase; it still has to mature. Take note of the « Take away » below and you will not be disappointed when this storage fees paradigm will be live !

Take away :

  • Ask yourself if you really need this data on-chain instead of off-chain.
  • Make your smart contract as simple as possible to reduce the storage fees for your code.
  • Add a function to clear obsolete data in your smart contract.

Resources :

--

--

Broillet Christian
Hortis

Co-Founder @ Geneva Devchain | Senior Software Engineer @ Hortis.ch