Unified EVM state capture, access and stateless re-execution
ETHCC 7 · 11 Jul 2024 · 17:05
Pranay Valson presents the block specimen, a columnar format that captures EVM state, transactions and blobs at sync time as a lighter alternative to the 20 terabyte Ethereum archive node. Validators publish specimens to IPFS and prove their work on a proof chain, while a stake chain and bridge handle incentives. A plugin-based refiner written in Elixir re-executes specimens statelessly to produce block results. He cites 237 indexed chains and outlines plans for light clients and validity proofs.
Speakers
Topics
From ETHCC 7, hosted by Ethereum France.
Transcript
Hello everybody. I'm Prene Walson. My colleagues sometimes call me Brown Jesus, even though they know that Jesus was brown to begin with. But enough about theological arguments. I'm here from Covalent to present to you the last three years of research, application, development, and deployment on unified EVM state capture access and stateless re-execution. So we have tried to combine this in a singular name. We call it the Ethereum Wayback Machine.
So let's talk about why we need something like this in the first place. So that's in the dimension of scaling of Ethereum in the execution side of things.
Technology that people are talking about, which a lot of people are working on right now. And then you have the PURGE, which is the EIP44s, where they aim to scale the nodes by decreasing the cost of hardware and storage and removing expiring state history, which is legacy. So this also means that they will remove any kind of client code that deals with legacy transactions, thereby decreasing the amount of effort that it requires to spin up a node and participate in consensus. So this is a double VAMI in some sense where you want to increase the number of transactions, but you also want to decrease the amount of state that's available and make it lightweight for nodes to be able to participate in consensus. And if you really want to get into accessing that data that's in the chain history, like the historical state, the current solution for that is the Ethereum archive node.
But as we know, the Ethereum archive node has been growing constantly, currently at over 20 terabytes. This is prohibitively expensive to service and maintain, and also is a bottleneck for applications that might need a lot of data concurrently consuming it for like machine learning modeling or any kind of historical data access, even for dApps or for sending transactions or for balances. So there's a lot of applications that as we scale, the archive node is not going to be able to suffice to prove those use cases. So we thought of something which was something in the middle in between a full node and an archive node, something that's lightweight, uh, something that we can universalize across all EVM chains.
So we came up with this idea of a block specimen. So a block specimen is basically a canonical format for columnar packaging of EVM state information at the time of sync of any kind of uh blockchain node in this particular case, uh all EVM nodes. Right. So what we do here is we at the time of sync are able to have hooks in the code which does not distribute the validator and the consensus side of things, and export this into a queue, where then we capture these state values in the queue and then package it in this format that you see on the right. So with the block specimen, we have what is known as a state specimen.
And the state specimen is basically a read of all the account and the address nonce balance related to the account, the storage related to the account, which is the key value pair of all the slots, the code red, that is all the byte information that might be stored for that particular account, and package it in the form of a state specimen. At the time of sync, we're also able to extract all the transactions and the blobs. So sometimes in discussions I come across the argument that blobs may not occur on the execution layer side of things, but actually during a mining time, syncing time, you can capture the blobs, the proofs and the commitments and form a uniform state snapshot. So this is a snapshot in time of both the CL and the EL in a singular format.
And this is what the block specimen is. And so now we have the concept of a pre-state, where the pre-state is the capture of all this data. What do you do with it? We basically have a bunch of validator nodes we call block specimen producers, right? They're running this to constantly extract this data, they post the file to IPFS and they make a transaction about the work that they have done. And the transaction payload is basically the chain ID that they're extracting from. So this can be any EVM chain, the object hash, which is the hash of the IPFS file that they're uploading, and also the CID, which is the content addressable ID to that particular file. So we capture this and we store it in the logs of a public blockchain.
So previously we had deployed these contracts, we call it the proof chain contracts on Moonbeam, but we kind of limp, we kind of got to the threshold of the amount of gas that was being consumed on Moonbeam. We were the highest consumers of gas. So we wanted to segregate our proof verification layer from our say staking smart contract layer. And that's something that you do as you reach the limits. So now you have a unified EVM state capture as a time snapshot, but what do you want to do with it? It's a raw object.
So the obvious next thing is to uh derive data objects from it by re-execution. And this can be any kind of re-execution. This can be a transformation of the data into a form that you want to index. This might be putting it into a structured form where you want to train neural networks with it. Um and in this particular case, it's executing it statelessly. So what's exactly happening here? Um in the block specimen, we already captured all the transactions from the block from the from the block itself. We captured the blobs and we captured all the senders of the transactions because sender recovery is quite expensive. And here we have uh a notation for the blobs which uh the blocks which contain all of this information.
We also extract the chain config in the block specimen process and the EVM config. So we know exactly for which EVM say version we have the state being exported. And that way we have this sort of um process where you have a target and you have a source, and you have a sort of engine version. And for every source, if there exists, it doesn't exist as a target, we run a pull-based machine called the refiner. Um, and so the refiner is basically an elixir process, an elixir lightweight process that is a pipeline that pulls in any block specimen that's been created, executes it, and produces a block result. So what is a block result?
In this scenario, it's the canonical sort of JSON RPC response that you would get. And how do we get it? We run this function called execute block fmirally as a plugin. So the refiner has a plugin based architecture, which means you can have any kind of binary, one against the raw information. And you can do this concurrently. So this gives you a lot of throughput in terms of having to analyze and re-execute a lot of state information simultaneously. And this is one of the soft fault tolerance effects of using something in Elixir or the Erlang runtime. So on the right, you can see we get the block result here, and this contains all the transactions and the receipts.
The receipts are generated from this stateless re-execution. So in all, uh right now, at this point, we've been able to capture a raw object, stateless steel transform it in a concurrent manner, and be able to prove that we did the work with a distributed set of validators. And so you have the ability to kind of coordinate this activity. But how do we do that? So in this process, I just want to introduce the stake chain, which is the chain on which validators come and make a stake based on the kind of work that they're doing, whether that be heavy, heavy duty work like extraction, or light duty work like verification of the proofs. And so on the left here, the validator you can see is trying to make an addition of the of himself as a validator.
And this is propagated through a canonical bridge. And this bridge is something that communicates between our proof aggregation layer, which is on the right, and the stake layer, which is on the left. So we make all the rewards and the collection of all the activity in terms of financial activity and settlement on the stake chain, while we have a proof aggregation layer that is gonna take all the computation that's gonna happen by the validators, all the re-executions that they're doing, and aggregate that as work that's done. So here we have a back and forth that's happening with the bridge, which is capturing the log events and is able to make a privileged transaction on either side.
And in this process, the validator can simply add himself on a smart contract that is deployed on Ethereum with a limited amount of stake and get enabled if he basically performs the minimum amount of stake required for that particular node role. And the ED the EWM bridge is constantly looking for meeting the minimum requirements and is able to make an enable validator call back to the stake chain, which then is propagated in the form of an enable proof validator on the EWM proof chain. So this completes the entire cycle of the incentive alignment for our validators.
In the next uh sort of cycle, I want to take a look at how a proof is being sent by a validator operator pair. So every validator has an operator key that's exposed or not exposed, but it's available on a server for him for him to make these proof transactions, where a proof is basically a combination of the chain ID, the proof type, and the proof type here uh represents the block specimen or the block result, the block height at which this was captured, the block hash, the proof hash, and the CID. And uh events are emitted for a proof session initiation. A proof session is basically a small amount of time for the live operation of a block specimen to execute a certain process, and we capture all the different proofs by different validators, and provided they meet a minimum consensus of currently 66%.
We can say that the proof session is validated. So it's a sort of proof of stake network or a proof of stake of validators verifying that the work that is being done by other validators is also true. And we collect these sessions over an epoch where an epoch could be the length of a day. And so we have a list of all the validators who participated in an epoch who achieved consensus on a quorum, and we're able to make a privileged transaction to the stake chain for the rewards that they can redeem. And so now the validator can go on the stake chain and then redeem those rewards for the work that is done.
So in this way we are able to scale both independently the incentives as well as the number of proofs that can be sent. So in all, this is the high-level architecture of the Ethereum ABAC machine. In all, there are three chains: the source chain that we're extracting the data from, doing the transformations for, the proof chain where we are aggregating all the proofs, the stake chain where the incentive alignment happens, and the bridge that is able to relay the messages back and forth. This allows us to scale independently of all the components, and hence it is a distributed modular protocol for shorted long-term data availability for ABM chains. So just to recap, um, with the EWM, we are able to achieve a unified chain state snapshot of both the CL and EL at a given point in time.
We have a bunch of modular components in which we can change the storage layout or we can change the execution sort of runtime and achieve the sort of independent scaling. We have the segregation of concerns of computation versus storage versus consensus in each of the different layers. We have the codec, which is the block specimen codec, which is a recursively describable codec for and for basically encoding the block specimen information. We are able to scale the proof transactions through the proof chain layer, and we are able to enable different kinds of operations of validators being heavy and light depending on how much they are staking. We have an arbitrary concurrent stateless reexecution of the block specimen data underneath.
And finally, there is a there is a market for block specimens where any kind of transformation plugin can be available for validators to pull in and hence create results that uh might uh that might be needed by clients. So there's a way to bootstrap the sort of demand for block specimens through the supply chain. And uh I just want to talk a bit about how we've been we've been doing so far. Uh we have a total of 237 chains that are indexed, um mostly EVM. 22% of the circuiting supply is dedicated towards validator operations, uh, over uh 11K CQT token holders, where the CQT token is the underlying token for staking as well as delegation, and these are actually bootstrapping uh the validator work and being able to kind of curate which validators are doing the better work.
Uh a 32 number of total operators across the entire stack, um, 60,000 um USD that has been earned in protocol revenue, and a total of 300 million wallets uh that are actively powered by uh this data. Yeah. So finally, uh I just like to leave you with uh the future work that we have on the EWM. Uh we want to release uh obviously the upgrades that uh match the kind of state lay uh state state layout for the pectra upgrade. Um we want we also we we also want to release the EWM light clients where the BSB BRP sort of uh data is erasure coded and then we have light clients kind of sampling them. So we move from a state of say uh proving multiple times and validating ones to proving ones and validating multiple times, and this is a much lighter process that many light clients can participate in.
We want to decentralize the bridge where uh currently it it is performing certain operations, but because the protocol is well defined, we can have a set of node operators kind of stake for that and then run the bridge themselves. Um integrating the block specimen codec for different execution layer clients is another thing that we're working towards. We currently only work on forks of geth. So if you're if your chain uses uh EVM, we can basically export the data and re-execute it. But if it's use erragon, we have to implement this. Um the query node operators in the future will be able to coordinate uh the supply of this sort of indexed model data, and we'll also add additional sort of storage layers as everything is modular.
Uh finally, we uh want to uh scale the number of proofs, and this is we currently have fraud proofs, which is the proof verification layer that is currently aggregating, but we want to move towards um uh uh validity proofs where you have KZG commitments made on the data which can be verified on the EWM proof chain. So finally, and in the future, we want to fully scale revenue where the query fees generates all the different um value that is being realized through the block specimen and feeds it back to the supply side. Yeah, uh that was my presentation.
If you want to apply as a builder, uh there's a QR code up there. Um if you want to become an operator on the network, uh second one, and finally, if you want to read about the problem statement, that's the last one. Um thank you so much for for listening. Yeah. We have uh five minutes left for questions. If you want to ask one, please raise your hand. Any question?
Last chance. Thank you.
Related talks
- Data is the Foundation for Dapps - Panel
- Indexing Ethereum data throught P2P protocols
- TrueBlocks Workshop | Thomas Jay Rush | ETHDam 2023
- Using Reth Execution Extensions for next generation indexing by Alexey Shekhirin | Devcon SEA
- Building Augur - Lessons Learned by Scott Bigelow (Devcon4)
- Otterscan, an open source, local block explorer for EVM chains by Willian Mitsuda (@wmitsuda)
- Supporting the Ethereum Roadmap with a Decentralized Blockchain Data Supply Chain
- Data Coprocessors For Sub-Second Blockchains.
- EthCC 2: E G Galano