or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Syncing
xxxxxxxxxx
Han (weihan) - Final Development Update
🌲 Why Post-Verkle State Expiry?
Significance of the project
As the blockchain grows, a looming challenge arises: State Bloat. With the increasing influx of new user activities into the network, more states are created, including accounts and contracts. The growing state imposes a storage burden on nodes, compelling them to store the entire state and affecting performance. When individuals like yourself and me can no longer run a node, this leads to centralization.
Do you see the flow here? More state leads to higher hardware maintenance costs, reducing the number of people able to run a node, which then leads to centralization. In other words, state bloat puts the entire blockchain at risk if not properly addressed.
The underlying idea is to remove redundant data—data that is not accessed for a long time. We can achieve this with state expiry. State expiry allows us to temporarily remove inactive data from the blockchain state, so nodes only have to store the most recent data (i.e., the past 6 months) needed to execute a block. If a particular state is needed in the future, anyone can perform a state revive by submitting a cryptographic proof.
Okay, that's the state expiry part. But why Verkle tree? Because the Verkle tree is inevitable. It brings numerous benefits such as stateless clients and faster sync time. Hence, it is worth exploring how state expiry looks in the Verkle tree.
Goals & Objectives
The primary goals are:
During the development process, it would also be beneficial to:
🎯 Project Outcome
Yes, the PoC works!
The PoC illustrates the outcome of enabling state expiry in a post-Verkle environment. I simulated an on-chain scenario where accounts expire and are later revived by submitting proofs.
To build the PoC, I wrote bash scripts to deploy nodes on a local private testnet. The testnet runs on PoA, so only execution clients (i.e., Geth) are required. The genesis file is also modified to include the state expiry hard forks.
How much useless state? I got it.
The following is the table of key-value pairs (i.e., accounts and storage slots) accessed in a block range of 1051200 (approximately 6 months each):
Looking at the combined block range between 13665600 (22th Nov 2021) and 14907811 (5th Jun 2022), it shows that only 19.75% of the total key-value pairs are accessed. It means that 81.25% of the rest of the key-value pairs are practically redundant and not accessed at all! It's just wasting nodes' storage space.
So, what's the impact of this state expiry scheme?
I did two conversions from MPT to VKT with 50 million key-value pairs. The first conversion uses normal VKT while the second conversion uses my modified VKT. The result shows about ~27% reduction in the storage space.
Right here, all the state bloat solutions.
In the initial phase of the fellowship programme, I wrote a document on all the available state bloat solutions that I could find so far.
Here's the link to the document.
📊 Project Evaluation
What Went Well
Working PoC with impact measurement
Considering the Verkle Tree may not be a stable release on Geth yet, having to modify directly on the VKT source code is challenging but worked out in the end. The project was able to showcase how state expiry would look like and clearly showed the amount of storage reduction before and after state expiry.
The first ever key-value pairs analysis
Based on my findings so far, nobody has done a key-value pairs analysis on ETH mainnet. By analyzing the key-value pairs, I was able to find out the exact amount of redundant data that exists on-chain.
Challenges Faced
It needs more testing scenarios
The PoC works, but not for all scenarios. There were certain cases where the local testnet broke down due to some bugs. While the minimal scenario passes, it would be great to have more test cases pass to show the robustness of the state expiry scheme.
Running a self hosted node is harder than I think
I ran a local self-hosted node for 2 months, and it broke down so many times that I'd have to restart the process again. Around week 15, a power outage causes the database to be corrupted. In the end, I was only able to sync the node from genesis up until block 14907811.
Conversion from MPT to VKT took longer than expected
I didn't expect the conversion will take so much time. At the end, I was only able to convert 50 million key-value pairs, which is just ~0.05% of the total key-value pairs.
And also, I should have enabled preimages collection at the start!
🔮 Future Plans
The key-value pairs analysis is certainly an interesting one, and it'll help with the future research of any state expiry scheme. I'd probably improve and optimize the performance of the key-value collection method and resync from genesis again. This time, I must have a fail-safe node setup.
While coding on the VKT components, I found out that there are certain technical debts that need to be addressed, as well as existing components that have not been integrated. It'll be a great opportunity for me to contribute to the VKT codebase in order to push things to the mainnet.
🙏 Acknowledgements
Special thanks to Ignacio and Guillaume for giving advices and helping me along the way. I certainly wouldn't have made it this far without their support.
🏠 Feedback on EPF
What went well:
Even better if:
🔚 Bye EPF, it was a great one
The fellowship program has undoubtedly been one of the best things to happen this year. Up to this moment, I remain deeply grateful for being part of the fellowship program and having the opportunity to contribute back to the Ethereum ecosystem.
As the fellowship program comes to an end, it signifies the commencement of a new journey. This time, it's a fresh challenge for me to contribute to more current Ethereum ecosystem projects. I can't wait to continue growing in the future!