Get the Monday email →
Loading player…

Using Ethereum gas economics to blow up the state size

DevconSun, Nov 8, 2026, 12:00 AM

Transcript

[music]

Let's see. Are we going to see the slides? Yes. Cool. Cool.

All right. Welcome everyone. Good morning. It's good to see you all here because I am super excited and I hope you are also all super excited. Um today we are going to talk about using a fair and gas economics to blow up the state size.

Uh this is about one specific contract. Um

[snorts]

I'm going to talk about this specific one and then I'm also going to give a history afterwards about all the repricings what we have done related to the gas economics of of a fair game. So this contract is the XEN contract. And it has um well, when I checked this uh Tuesday, 175.6 million storage slots. And uh to give like to show like how big this is, um this is a factor bigger than the other largest uh contract and this is by a factor 6.

6. So the second contract is USDT and the other ones uh permit too, but we can see that 6.6 times this thing is bigger. And it's actually very interesting because uh when I saw these numbers, I remember that a while ago I checked this and then I think there were like 100 million storage slots or something like that. So it was like really surprised like okay, it has it is still growing.

So um also to give like like to state like um in the the entire storage size of a fair game, this is one in the 10 storage slots of the entire network and also uh one in 20 accounts. And more on that later because why are other accounts related to this? So first about the contract. What XEN is, it's a way you can uh it's an easy 20 token and you can mint this token. And how you do this is there are two actions what you do.

You do a claim rank with one argument. This is the amount of days what you have to wait uh order to claim your mint rewards. And after the after you wait these days, then you claim the rewards. And uh this has some some payment logic like an a rank delta. This is related to the amount of mints whatever happened.

An amplifier, this is the amount of days since the contract was created. This uh is being decreased, but more importantly it's the term. Every mint creates six storage slots. And every address can only mint uh certain mint once. So, these six slots, like what do they do?

Because it's really interesting like these slots are like not optimized at all. So, there are six slots. This first slot is the the user. This uh the second slot, well, index one is the term so the amount of days you have to wait. The second is some timestamp.

The third is uh the rank and amplifier which I think do not even have to be saved, but well, maybe there's an reason for this. Um and this could actually all be compressed in one slot, but for some reason this did not happen. So, the idea is that there's only like one address and per address you can only start one mint. So, what is actually happening? Like the reason why people are still minting this token is because there is like a market demand for it because there people are for some reason buying this this token.

Um and and uh so, if you want to mint more tokens, you will need more accounts. So, what do we see in the economy or well, what's what people optimize for? So, you want to create multiple accounts and then you want to mint with one transaction multiple tokens. So, what we see is we there are mint factories which create like proxy accounts. And uh these in one transaction start to batch mint these tokens.

So, these are some numbers from uh last Tuesday. Uh there were about 1,800 transactions. And in these 1,800 transactions there were 128 calls to the exam contract. Uh and you can see there were like 19 92,000 uh claim ranks um which started to initialize this process. And there were actually 30,000 claims.

So, it's it's somewhat falling behind. Um also, what we are seeing is that multiple boxes were deployed. It's like 56,000 of these uh these new boxes. So, there are also people who like these boxes are going to reuse that box to re-mint tokens, but these new boxes mean that either new people or well, more accounts are being created to mint mint these tokens. And what we are also seeing is that on that day there was 10.

3 billion gas being used to to execute this contract. So, that is 4.7% of the amount of gas that was used on mainnet that day. And in this this batching, what happens is we have like an EIP 7825 gas limit, which is about 16.7 million.

5 [snorts] 15.7 million gas is being used per transaction, and this mass mass mints these these tokens. And you can also see that there were 1 million S-store calls in this on this day, which was one in nine S-stores on that day. And oh, yeah. You can also see that well, 82% of the amount of create so accounts contracts being created was done by these by these factories.

So, if you check the exam contract and if you see like where does this this gas actually go, we see that on that day there were there was 8.75 billion gas being used to claim rank, and 1.54 used to mint mint mint these these tokens. And I want to also to state that if you create a new proxy, what happens is you then only do the claim rank to initialize this minting process, but then if you actually mint it, then you will actually re-init these mints. So, we can see this is about like this 56,000 proxy accounts which were actually also being being created.

So, [snorts] the question is why is this still happening? And this has to do with the token price and also with the the gas the base fee what you have to pay in order to to run these transactions. So, if the base fee is below this line um then it is actually profitable to mint these tokens and you can see that if you start if you have a fresh proxy or a new account the base fee has to be lower because you need to pay more gas to create this proxy and to start this minting process. And it also has to do with like this rank. So, you can see that in if you only wait for 1 day, then you get less tokens.

So, the base fee has to be much lower than if you wait for a longer time. But of course, this is a kind of risk because if you wait if the token price changes or if the base fee um raises above this level, then it is not profitable anymore. What's also really interesting is you might might think like, "Okay, but what if I would just wait by actually minting these tokens? I would just wait until my until the base fee is low enough that I can actually directly sell these tokens in order to to profit." The thing is that this contract also has like an a maturity.

So, if you wait like 1 day, then you get 1% less tokens. 2 days 3% and you can see after 7 days you get almost nothing. So, what we also see is there are a lot of abandoned mints because if you would mint it, you would pay more to actually you would pay more in gas than you would get if you would sell these these tokens. So, why does this keep growing? So, this is about like the base fee and you can see that this is really related to both the base fee and of course the token price.

And well, if we raise the gas limit, then the base fee usually drops and we can also directly see that this directly correlates with more mints mints happening and we can see that this is still growing. What we can also see is that the amount of slots being created and the amount of slots being cleared. Um this is about the So, the difference is also about like the abandoned slots. So, if you create a new proxy, then you are starting to create more more of these storage slots. Um and actually claiming these storage slots is also abandoning your mint.

So, how does this work like in the in these economics? Like if the gas limit goes up, then the base fee will go down. Then the amount of profit that you can get will go up. That means that we will get more proxies and that also means that the state growth is going up. And some numbers on like what is actually this this footprint on mainnet.

So, 10.4% of all the storage slots on mainnet are related to this contract. These proxy accounts are 5.2% of all the accounts. And in well, in the last 9 days, the new storage slots were 30 33% 23% new accounts.

So, these new proxies. The amount of create two opcode executions in the past 9 days sorry, on Tuesday was 82%. 40% of all the S-store gas, 8.9% of the actual S-store executions, and 4.7% of all the gas being executed that day.

Um yeah. So, what happens in all these blocks? Because this is like one of well, I don't say a bottleneck, but things what we have improved over time by benchmarking and also to um um um to give like an like an like an idea, like the storage size of this contract, it's very big and we use on a Merkle Patricia tree, which is related to it's an hexary tree. So, this tree has like 16 branches on every every node. So, that means if we have like 16 times more storage, then this contract depth gets one level deeper.

And that means that on average, you will need to have one more hashing operation by every storage store store what you do. So, this diagram shows like what happens in like if if you would like mint multiple tokens, you are going to change your storage slots. So, over this entire tree, you are going to change multiple nodes, and all these nodes you have to hash them in order to get the storage root of this of this contract. What's also interesting is the sinking um the demand or or um what happens in the sinking process of a node. So, if you launch a node, what you need to do currently, well, always, is you have to download the entire storage in order to execute new uh code.

And uh some clients not all clients they use snap sync. And what you do there is you start to request uh range ranges of the of the Merkle tree. And uh this itself works up to some extent because you have a pivot block. And um of course, during your sinking, the chain still adds new blocks. So, the storage tree actually actually changes.

So, if you have this pivot block, then there are some new blocks, and the storage tree still changes. And you also need to have a way to sync like these changed nodes. As you can imagine, like this chain contract, it is like we are just seeing like the the amount of execution happening uh on this on on on XEN. So, there are a lot of nodes changing, and this means this is the healing part of the of the snap sync. That means you have to heal like a lot of nodes.

So, this is like extra um uh extra logic what you have to do in order to to sync your node. And this is also like one of the reasons that it might look that you have you have almost synced the entire chain, but it it seems to be stuck at like 99% because this is the healing phase, and this is like the like the thing what is what's better hard. But, what is really nice, in Amsterdam, we are adding block access lists. And this has the nice side effect that this directly um uh adds a way in the network protocol in order to directly download the changing nodes. So, now we don't have this healing phase anymore, and now we can directly uh update these nodes what are actually being changed.

And this was not possible before the block access list, and this is about uh EIP 8189, which is a step to uh protocol in order to sync sync the nodes. And I will also want to state like I think it's really nice because this is actually a polite state bomb. Because in [snorts] some cases it actually cleans up. And what we also see is that proxies are being reused. And the cost of course this could have been worse because we the contract would also force for instance that an account could only mint tokens once.

And of course we could also like like make this layout bigger like we could use more storage slots. Um per per mint. But [snorts] I also want to state that XEN itself is not the problem. So what we really value is crops so censorship resistance, open source, privacy and security. And XEN is actually it's a very legitimate use of the protocol.

So we are not going to like I do not want to imply that we are going to ban XEN or something like that. It's just that XEN so shows that like this problem it's growing like every day. It's not like an acute problem but it is something what we well we have we have to think about like how we are going to to to tackle this problem. And now I will go into the history part of like how did we tackle these state problems before? So let's go back to the start of the chain.

Maybe some of you people know like the gas cost of some opcodes. In 2015 when we started like if you create a new storage slot you paid 20,000 gas. That's currently still the still the case. If you would change a storage slot you would pay 5,000 contract and if you would clear one you would actually get 15,000 gas in in refund. Self destructs which were actually an opcode what you could actually use back then you could actually destroy contracts even after where they were being created gave you a 24,000 refund.

New accounts cost 25,000 gas and a code code deposit cost 200 gas per byte. And that is like really nice. The SLOAD cost was only 50 back then. Balance and EXTCODESIZE 20 and CALL 40. And we will go into like how these were increased late.

So, in 2016, we had an DOS attack. They were called the Shanghai attacks because these attacks they had they had like bites into this call data which said, "From Shanghai with love." So, it was well, actually very cute attack, I would say. And [snorts] if you would re-execute these blocks, you will also see that you were these blocks are still really slow to execute. Because the DOS vector here was like you would you would either like load a lot of accounts or you would create a lot of accounts.

And there were like many variants of these these these attacks. And how was this saved? These were like some kind of emergency well, not really emergency, but somewhat well, actually it was very clear that something had to be be done because nodes were really slow. So, we had the EIP-150. This re-priced these these opcodes by a lot.

So, EXTCODE SIZE to 700. Balance to 400. SSTORE from 50 to 200. You can see you can see the numbers. SELFDESTRUCT was not not being free anymore.

And EIP-161 was about cleaning up basically garbage state. So, in the past what you could do is you create could create empty accounts into the the Merkle tree. Which had no balance, no nonce, no no nothing, but they were actually in the balance tree. So, you had to store like if an account is not there or if an account is empty. So, that's basically like a a waste of space.

And EIP-161 cleaned up these these accounts. In 2019, we realized again that that we had to do something about state because the state keeps growing. So, you have more hash operations and you need to do something about this. So, we had to re-price. And what happened then is EIP-1283 was proposed.

This was also going to re-price state operations. And 2 weeks before this fork happened, we got the security report that there was actually a smart contract re-entrancy problem. And this was So, this fork is called Constantinople, but officially it's actually called Petersburg. Because the way how we handled it back then is what we had like the Constantinople fork. And at the same block we had an an extra fork with which was called a Petersburg which actually removed this EIP.

So, it was a way to to deal on the development side with this uh this this thing.

[snorts]

And this state problem was actually solved in a later fork in the Istanbul fork. SLO2 from 200 to 800 gas, balance from 400 to 700 gas, extra data from 400 to 700. And this was also was actually also the first EIP which said, "Okay, the state growth is a problem and this is the reason why we actually reprice this thing." In 2021, we uh introduced the concept of cold and warm accounts. So, this has to do with reading a storage and reading accounts.

So, if you read an account for the first time in a transaction, then you have to pay an extra cost in order to load this account uh which is which was uh or is uh 2,100 for an uh for a storage slot and 2,600 for an for an account. And the reason for this is that um uh this is to limit the amount of of uh storage slots or accounts what you are going to read. The problem is that if you introduce this, so you are raising the gas cost of these storage slots and these accounts if you if you um uh read them for the first time, is that some smart contracts back then uh broke because there were gas assumptions being made like, "Okay, this call will cost like at most this amount of gas." Uh and then this call would actually these calls would actually go out of gas if we would not do anything about this. So, the way how this was fixed was to introduce access list in a transaction by EIP 2930.

And this was to to save this this problem. Okay, I have to to speed up a little bit, I see. Um So, but we also saw that uh there were gas tokens being created and this was a way to uh at low gas prices you would buy uh storage slots. And then when the gas prices were uh getting higher, then you could actually clear these storage slots to get a refund in order to um to basically to get a discount on your gas price. And this created like an artificial demand for for storage and for accounts on the network.

And the way uh this was solved was to uh create uh EIP 3529. And this was to put the maximum refund amount to uh to 20% instead of the 50%. So, what are we actually doing now to solve this problem? We are creating uh a way to actually limit the amount of state that is being created per block. And this is uh uh this is done by uh each time you create a new storage slot on an account, you have to to pay for this.

Um per byte, you're going to pay 50 uh 1,530 gas. And this is to to order or to bound the amount of state that can be created per block. Okay, let's go to the next one. So, this state problem, it's not it it it's not like a super acute problem, but it it is really something what we have to solve. And there are some proposals we are going to move to a or we might move to part partial binary trees.

Um and this solves uh in some to some extent the storage uh data structure itself. But, what we what we really need to do is we have to think about like how are we actually going to to price this uh this state. So, we can figure out like state expiry, state rental, other things. And this is where any of you can come in. Like if you have a great idea like how we should do this, then um please open an EIP, create a draft EIP, and then we can uh we can move on.

All right. Thanks, everyone.

All right, that was a great session on storage. We have quite a bunch of questions. Uh maybe uh we'll do the one with the most votes so far. So, if Ethereum state keeps growing because of contracts like send, how will this affect ordinary node operators who don't have expensive hardware?

Hm, okay. Um it depends like how you would define expensive hardware. Like I think No, no, I don't think. Like what has happened going to happen in Amsterdam is we are uh so introducing like EIP 8037, and this really bounds the amount of state growth what what we can have. So, you can basically reason like, "Okay, if we would have the maximum amount of state creation uh happening, then uh you can reason like, "Okay, I now need this disk size, and that means in like this time I would need like a bigger disk."

So, I think at this point uh if you like have like sufficient room left on your disk, then it's not nothing really to be afraid of at this point. But, it's really is like a problem what we have to solve in the future because the state will keep growing, and yeah, we have to we have to solve this. Yes.

Okay, next step. Uh what can Ethereum realistically do about contracts that have already created a huge amount of state? Can that data ever be safely removed?

[snorts]

It depends, of course, like what you mean by by safely removing. I don't think that we can remove any data. I mean, it is like how would we reason what data can we actually re- remove? Uh I think we can't um we we can do this. We cannot say this data is is a right data, and this data is this wrong data.

So, we can do that. But, there are proposals like uh for instance, like this uh this XEN contract, it also has like a lot of abandonment. So, these are storage slots which were created like like years ago. They have not been touched like uh like in recent recent time. And we could think for instance about like, "Okay, this could be like cold storage."

And we could think about like hot storage. So, hot storage could be like let's say like storage what what was being created or read or whatever in like the past week. And anything that's older than that, if you would like to to read this or like to to to change this, then you would have to pay an extra fee. Um because then the nice property of this is that uh depending, of course, on how you would price this, is that you they can then move this cold data to like a slow disk, and you can move the hot data to like a an a faster disk. So, you could for instance uh buy like a very disk uh very big um a slow disk um at at like low cost, and then like use a faster disk like a current SSD to to to host the hot state.

All right. Next question. Do you have projections on how extend means would behave in Amsterdam with EIP 8037 increasing gas price for store and create?

Yes. So, if you would assume that there were there were two things what is going to happen. So, we are going to increase the gas limit in Amsterdam from 60 to 200. So, what will likely be the result of that is that the base fee is going to to be lower. So, if the gas price will then So, if the if the 8037 will then not happen, that will mean that there the base fee will go lower, so will be more demand to create like these these extend tokens.

But, the thing is we are going to reprice this thing. So, about like new proxies being created, this will be much more expensive. So, likely that means that the amount of proxies what we currently have and the amount of minting what's what's currently happening, that will stay like this. But, at least the state growth is like no new proxies will be created because this will not be profitable anymore.

Thank you for that. I think we can do one more question. Let's see. Any up votes? Any anything?

Let's see. I I can I can answer this to to something.

Which one?

Let's see.

Okay, maybe the second one. If someone is willing to pay enough gas to store large amounts of data on Ethereum, should the network allow it or should there be any limits on how much data contract can create?

Hm. I I I I guess it depends like like one of these proposals what we also have is like we are going to price the the storage slot based on like how big your contract contract is. So, for instance, if you get like a very big contact, then at some point you would have to pay like a factor more in gas cost to um to to to to create like this this storage. So, what will happen then is that we would create like an economic incentive to sort of move a storage to like um um smaller uh smaller contacts. And I think that's something what we really should uh should explore.

Yeah.

[music]

Automatic transcript — names and jargon may be misspelled.