Partitioned Binary Tree
EDCON 2026 · 18 Oct 2026 · 20:08
Muhammad Amirul Ashraf presents the partitioned binary tree, an Ethereum protocol topic, at EDCON 2026 in Kuala Lumpur. The recording is a talk of about twenty minutes from the De University of Ethereum channel.
Speakers
Topics
From EDCON 2026, hosted by De University of Ethereum (UETH).
Transcript
Hello. Okay. Hey guys. Good morning. My name is Ashraf. I work for Nethermind. Nethermind is the second biggest client for mainnet Ethereum after Go Ethereum or also called Geth. And today I'm going to talk about the partition binary tree short for PBT. This is a very prototype up in the air that is not hot yet. Right. So this is more of a research that the Ethereum is like coordinating with the client and it's like, okay, we think the next state now is going to look like this.
Something along that line. And then we'll discuss what are the structure and why are we going to do this? So firstly, we need to understand a bit what is a state tree. A state tree in Ethereum is the the thing that stores the key value and crucially in Ethereum is called a Merkle Patricia tree where any change in the value is going to to to cause a change in a hash within the header which is called a state root within the header. And yeah, and that is the tree structure that we are going to attempt to change because this thing is quite a lot. It's like 250 gig or something across thousands of client, right?
And but why are we going to do that, right? Which is we're going to change it to PBT. Before it's called MPT, now it's called PBT. So partition binary tree is is is a is a binary tree that is partitioned at the top. That is it's within the name. If you're if you're familiar with the state, a few years ago you might have heard of Merkle tree and Merkle tree is effectively cut down because of quantum quantum race. And this is what the current proposal is.
Which firstly, it's binary, which is that each of the node have two child instead of 16. It is partitioned, meaning that the key have like a partition byte at the first so that we separate a different part of the code. And then code is in the tree, which is also a big change from empathy which doesn't actually have the code within the tree. And we have a ZK friendly encoding which have a no RLP and relatively simple fixed format notes. You know, if if you've done the empathy encoding yourself, you understand it is fairly complicated to to update.
And the main reason why PBT is really wanted is because of ZK compatibility. So for that, let's try to understand what is ZK. How does ZK EVM going to work? I I'm I'm not really sure how ZK EVM work, but this is my understanding of how it works. Right? So you have a private data and those are the block, the transaction and the state and the contract and the and the which means that you also have the the proof to the state.
And then you you pass it into a guest program and I say a guest program because all of the ZK EVM nowadays are just RISC-V 5 that is just execute the the program. And the program will read will basically just execute the EVM like normal and then it will speed out a state root and post state root and block hash. And the the the intention is that just with the proof we can make we can be sure that the things are correctly executed without knowing what are the hidden hidden data.
And that means that all of the hidden data must be anchored into the pre-state root and the post-state root. And this is the main reason why the state wanted to change because with the current PBT this part, which is the proving part and you have to prove it within the program, otherwise then you don't trust the the whole mechanism doesn't work then well you are trusting a blind something, right? And and the proof is uh the proof need to change.
So in the case of MPT uh effectively the program have to go through roughly 1.8 gig of data per block at worst case. Uh this is a bit misleading because most of the part is because of the code. Uh the code is not part of the tree so it cannot hash just part of the code. You have to hash the whole code and the whole code is could be like 64 KB at worst case, which is why the the majority of costs come from. Uh and then we have around 144 megabytes for the MPT itself, right?
Uh not to mention of that, the MPT itself the Hello? Where where was I? Yeah right. So the structure of the MPT itself uh essentially is uh complicated and compute intensive because we're going to need to execute this as a guest program which is essentially inside a trusted ZK magic thing.
So so the point of the PBT is to make this cost much much lower. So first why binary? A binary makes the size of the proof itself much much smaller. Uh in the hex part we have we need to do 16 sibling hash and in the case of binary that is reduced to four four sibling hash for the same depth because 16 depth depth four and then binary depth four also. Uh but but there's more depth on it, but uh the proof become smaller. In the case over here is around three times smaller, three to four times smaller.
Uh aside from that, because the witness is smaller, the it helps a lot of other use case such as a stateless client, light clients uh uh bridges and such because their proof is now much smaller and also uh less compute intensive. It needs to be less compute intensive. That's that's the whole point right? Uh and then there's also the fact that the the hash change and I really don't understand why. I mean, I understand why, but I don't know why it is like that. You know, this is this is sorcery and I'm just giving them the magic pixie dust.
Uh and also uh because we're going to change the tree, we might as well change everything about it that we can. So that because this kind of upgrade is just nearly impossible practically. Right? Uh we are going to change the key structure. Uh the account header will be like that. Uh the code chunk, which is new because MPT doesn't keep the code chunk, now we have we are keeping the code chunk and then we also have a separate storage key structure. Uh this is basically roughly the same as Merkel Merkel Merkel tree. Uh right? The the the different is just you know a longer path because of another reason, collision and such.
Right? Uh the major difference would be like the code chunk over there, which means that the code is within the tree itself. Uh yep. So you also have like a consecutive consecutive slot is also put consecutively within the tree which would help with the IO a lot. And you can see that the the the header here is quite cleverly designed where the slot for 0 to 63 is put within the same place as the standard account part. So so a lot of the IO becomes one IO instead of multiple IO.
Similarly similar with the case of storage, which is also have this nice stem part. Except that in vocal tree there's a special structure just for the stem within the PBT is it becomes generalized. The different for the stem is just the way that the the slot to the key is is is roughly is structured. On mainnet this should reduce the key rate for the flat by about half but the the the bottleneck on mainnet is not exactly the key itself.
So it doesn't really help much. So how does it work with Nethermind right now? Right now the Nethermind is implementation is that it is essentially flat DB just with the with the key structure and the node structure change but everything else is kind of roughly the same. Yeah. There are certain things that needs modification to the core of Nethermind. Notably there is no storage root anymore which turns out to be a big problem a significant problem at least within Nethermind because there's a lot of optimization that simply just read the account and then see if the recon stood hash root hash is zero then you don't attempt to read the
storage at all. But we we with this new layout you you don't have that easy free check. Straight disrupt is also pretty much gone. It's it's already gone but but the code itself is not gone so so it's kind of like a tech debt that needs to go away within the implementation of Nethermind. Another problem is paralyzing the root update. You a lot of things says that the advantage is that PBT is a single layer and MPT is a two layer which is true.
With MPT you have to hash the the storage separately and then you get the the storage root and then you do the the the the PBT, the the state part. But a lot of it is kind of so optimized that it kind of doesn't really matter too much and in the end it might actually make it harder to deal with because the storage update is already paralyzed and then you optimize it and then you put the state try and within per try is already paralyzed also but it's much harder to paralyze per try rather than per storage, right? And in the case of PBT the only clear way to paralyze is the account and a zone which is clearly separated so you got like a
nice 2x boost but within the tree itself is a much trickier business to paralyze it. So you know who knows how it's going to deal with it. Another problem is that you you may mention that it's a binary tree instead of hexa tree tree. So the traversal goes from four bit advance to one bit advance, right? Which is obviously a bad idea if you're going in IO for each of them. So the way all of the client currently works is that we we group all of the bunch of nodes together within a P dev, right? So gas research for example uses five bit Nethermind currently uses three bit
which is to say that you bunch like a bunch of node within within a binary. So you you each of the IO goes through like four level at once instead of one level and level. But this come at the cost of IO lots of rights because a lot of the because when the state is large enough a lot of the bytes at the lower part is a redundant and any kind of shard node is only at the top part and and the bigger the nodes are the the less the portion of the shard so it doesn't really matter too much.
So so you have a lot of right amplification and in case of Nethermind it looks like three bit might be faster than four and in case of gas they they seems to think that five is the fastest, which is, you know, it it really depends on the implementation. But the good thing is that the client can now change the dev if they want because because the encoding is no longer specific to the right. Block processing so far, I'm not exactly sure what happened because in this replay, PBT seems to be faster than MPT, which may be accounted by the fact that the flat read is roughly half.
But this is with a custom plugin. I call a and it turns out something probably went wrong because it only ran at around 1 gigagas, which is definitely not the throughput that I'm expecting. Even without runs at two to 2.5 gigagas nowadays. But it should be a one-to-one comparison, which is to say that MPBT seems to be slightly faster. You can see the smaller and that's far less because the whole structure is a bit different. It doesn't have this reference six-year-old that Yeah.
What are the migration plan? The migration plan right now is that we pick an anchor block, we convert it offline, and then we distribute it to client that is running. And then we give the client maybe a few months to convert their their client so that they have both MPT and PBT running at the same time. And then once we decide, okay, seems like a good time to switch, we're going to push a and then hopefully everyone will just switch from PBT to MPT. So that's the plan.
But again, you know, it's it's 250 GB of data, roughly 150 GB of snapshot right now, roughly like that. So that's I don't know if that's going to work really. It's a bit there's a lot of computation This is how it the time it takes to import it Keep in mind that after it import the PBT you still need to replay up to the head and the idea is that you replay it with yeah and then and also because you are replaying it you you also need to make sure that the new period that is currently still running
does not become too slow so this is this is the number that the Ethereum Foundation wanted to see if we can we can how much is the safe spot essentially yeah so yeah there's still it's still a lot of open question not to be the hash what are the size of the node crude and there's also the state expiry on the zones are we going to use that or not and migration is it how what are the gas limit that we can put during the migration that's all for me thank you >> yeah your comparison between yeah this
one this one I wonder you have a bold text that with block access list right so that is I mean the block access list is activated in test net but you just deploy it on main net to see the access list how how can it accelerate the execution right so I I was curious about that if we doubt the block access list and what is the processing time per block thank you >> it's slower >> slow yeah I mean the ratio >> It's it's it's roughly 20% if I'm not mistaken.
>> 20% >> Yeah, slower. >> 20% slower or five times slower? >> 20% >> 20% So maybe >> Keep in mind that it's not this portion of the processing is not that big anymore. Right? There's so much optimization that already happened in Nethermind. That's why that's why that why I I use the ball replay because the intention is that ball is always going to be available when this is right. So so I want to focus on the ball so that I can drop all of the other optimization that doesn't matter anymore.
For example, with Nethermind we replay all of the transaction in parallel even without ball. We replay them in parallel and then we seed the the tri-node as part of the cache right? >> Yeah. >> So that kind of thing might be slower with PBT. >> Okay. And thank you. So so one one more question please. And so your importing is without the tracing DB or or you how do you config the trace DB that do you activate the configuration that because in my previous testing I found that where it is a very large difference between if I open up the trace DB or I just close
the trace DB. >> Sorry, what the trace DB? >> Trace the trace yeah I mean do you record the trace during the transaction per section? >> No, not normally. But it does replay the both of the MPT and PBT after the anchor which is which is the main concern right now because yeah. So after we import it we still need to catch up and during the catch up both MPT and PBT needs to replay at the same time. So that's going to double the load for this particular part. But normally we don' we don' store all of the state
diff. >> Okay. Okay. I got it. Thank you very much. So I'm not sure if I follow but there was a long time the discussions of being able to run a node on a very simple home machine and it being something that doesn't either require excessive storage or or bandwidth. >> Exactly. >> In this case how like do you see do you see the choice of the right Merkle architecture is something that contributes significantly to that? Is that like a a big barrier currently or or what's the objective or what's the
outcome that you're aspiring for here? >> It it definitely helps a lot right because if we don't do this change the size of the proof is large you know round two or three time larger than the block right. So even thinking about broadcasting the the the proof is just you know that's a lot of bandwidth. After the PBT the size of the proof hopefully is going to go down maybe about about three times so that will help stateless client because now they don't need to store the whole they they have all of the information in a relatively compact way that can be hashed back into the the the header.
But then again it is still quite a lot of bandwidth. So I I don't really know if it's going to be worth it or not. All right. Okay thank you.
Related talks
- Ethereum (Roadmap) in 30min by Vitalik Buterin
- gigagas L1
- The Next Five Years of Ethereum Core Technology
- Stateless Ethereum: Paving the Way for the Migration into ETH 2.0 – Piper Mirriam
- Stateless Ethereum and The Portal Network
- Ethereum P2P Networking / Sharding by Felix Lange and Péter Szilágyi in Taipei, March 2018
- Turbo-Geth and Stateless Ethereum
- Transaction pooling in 4844 How to not go boom, in theory - Péter Szilágyi
- The State of the ETH1–ETH2 Merge and the Future of the Ethereum Chain
