Lagrange Announces Public Testnet ‘Euclid’ to Enable Ethereum’s First Verifiable Database and ZK Coprocessing
April 16, 2024
Lagrange Labs is announcing a new public testnet ‘Euclid’, a monumental milestone in the development of Lagrange’s ZK Coprocessor and Verifiable Database. With Testnet Euclid, developers can start building dApps that leverage efficient and inexpensive queries on a verifiable ZK database of historical blockchain data. Unlike typical ZK coprocessing, which first proves the extraction of a piece of data from the blockchain (which can be expensive to compute and is limited to small datasets for each extraction) and then runs computations on the pulled data, Lagrange’s ZK Coprocessor verifiably indexes and builds a proof-friendly database of the blockchain data and then runs efficient and parallelized computations and proving on top of it.
ZK Coprocessor & Verifiable Database
Lagrange’s first testnet, Euclid, serves as a foundation for a unique ZK coprocessing approach that gives every smart contract on Ethereum its own Verifiable Database. With Lagrange’s ZK Coprocessor, developers have the opportunity to experiment with a new design pattern for defining, deploying and querying verifiable databases on-chain. The goal of this testnet is to test the features that Lagrange will enhance and refine with future iterations of the product, including:
Hyper-parallelization
The Lagrange ZK Coprocessor operates in a parallelized and distributed way, such that a computation is divided into multiple small tasks that can be distributed to multiple machines, and the clusters of machines can execute these computations in parallel. As such, computation in the coprocessor can scale horizontally, ie. as more machines participate, proofs can be generated faster over larger datasets. This results in significantly more efficient computations and proving of large amounts of on-chain state data, fundamentally enabled by Lagrange’s proof construction.
Dynamically Updatable
Instead of needing to prove the historical state of a chain and then subsequently proving a series of computations on top of the existing data set, the Lagrange ZK Coprocessor is able to execute dynamic and targeted computations on top of an existing verifiable database of historical contract storage state. This drastically reduces proving time and makes it particularly useful for computing specific datapoints over an ever-growing large dataset of on-chain state, such as calculating the average liquidity of an asset pair on a decentralized exchange (DEX) over a given period of time.
Ultra-scalable Queries
Our Verifiable Database approach means the ZK Coprocessor is able to query a much larger set of storage slots compared to other ZK coprocessors. While others can prove single storage slots but rely on the smart contract or a computationally intensive generic proof to execute computations, the Lagrange ZK Coprocessor can prove a significantly higher number of storage slots at the same time and also prove executions on top, before bringing the final result on-chain.
For instance, with every new Ethereum block, Lagrange generates and updates a proof of the correctness of the database’s indexing to insert the values 8888 new storage slots. The is already an order of magnitude larger than other storage proof or coprocessor solutions that struggle to compute more than several hundred storage slots per proof. Once storage data is loaded into Euclid, users can query across millions of storage slots within a single proof, far outstripping what was possible with existing state-of-the-art solutions.
Lagrange’s ZK Coprocessor is enabled by various aspects of Lagrange’s tech stack, including Verifiable Database, the proprietary Reckle Trees research for updatable, succinct batch proofs and our research into proving generic MapReduce computations. Developers using Lagrange can build blockchain application types that were previously out of reach and also unlock a level of scale in computations that is not possible with other solutions.
About Testnet Euclid
In Testnet Euclid, Lagrange instantiated a provably indexed version of the Pudgy Penguins’ storage into a Verifiable Database that developers can test out by querying on-chain. Our first Verifiable Database serves as a general framework for allowing developers to query any ERC-721 NFT contract using SQL, across a specified block range, and is live on Ethereum Mainnet.
To start, users can run specific SELECT statements over Pudgy Penguins NFT contract data, across requested block ranges. We’ve hard coded the following query:
SELECT DISTINCT(nft_ID) from DB.pudgies
WHERE owner = x AND
block_number> y AND
block_number <z LIMIT 5 OFFSET offset;
Once you have your desired variables, the coprocessor runs the query and returns a subset of all NFT IDs held by an owner in some specified block range. You can check this easily by typing the NFT ID on ethscan and seeing if the owner is the one present in the query.
In practice, SQL query is more involved, but the goal of Testnet Euclid is to demonstrate the power of Lagrange’s scalable system. Full SQL support will be coming in future releases.
Performance
Currently, for a block range of 100 blocks, it takes about 2 minutes end to end to get the full proof:
- the query is running over 8888 slots / block * 100 blocks = 888’000 storage slots in parallel in 1m20s
- An additional 40s is spent on just the final Groth16 proof to submit onchain
While this is already significantly more efficient and faster than typical coprocessors, we have many planned updates in the pipeline that will further improve the performance as well as the user experience.
The codebase for Testnet Euclid has been open-sourced here, and instructions for how to engage with this testnet can be found on Lagrange’s Docs.
What’s Next
The plan is to continue iterating on Lagrange’s ZK Coprocessor and Verifiable Database with developer input on future testnets.
In the coming weeks, the following will be made live on Testnet Euclid:
- Decentralized proving with the involvement of partner node operators
- Inexpensive queries from other L2s/rollups
- Self registration of a contract of a user’s choosing to be indexed and queried over
- Custom queries from users in SQL format
- A dashboard with example queries and smart contract interactions built in, along with analytics
There will also be a community involvement aspect, where we will solicit testing and feedback from different users in order to improve and build new features.
We will then be launching our ZK Coprocessor as an AVS on EigenLayer, at which point operators will be able to join Lagrange’s proving network to contribute to the hyper-parallel coprocessing. More will be shared on our roadmap soon, stay tuned!