ZK Coprocessor Euclid Testnet Phase 1 Recap
June 20, 2024
In mid-April, Lagrange Labs launched the Euclid Testnet, an important step in the development of the Lagrange ZK Coprocessor. Lagrange’s ZK Coprocessor allows developers to build expressive dapps with efficient, inexpensive and extremely fast querying of large sets of onchain data, directly from smart contracts. It does so by first lifting heavy computations offchain into a ZK-friendly Verifiable Database. When developers want to access historical blockchain data, they can easily do so performing SQL queries on the ZK database, the results of which are guaranteed to be valid with fast finality, due to the hyper-parallel ZK proving of operators within the decentralized Lagrange ZK Prover Network.
As we wrap up Phase 1 of the Euclid Testnet, here’s a recap of some exciting milestones that have been achieved, including:
- Integrations with several L2s, including Base, Fraxtal, Mantle, with more in progress
- Launched the Lagrange ZK Prover Network on EigenLayer mainnet, the first decentralized prover network to be in production in the industry, powered by top institutional teams
- Expanding support for different NFT contracts, such as Azukis, Sappy Seals, Uniswap V3 Non Fungible Positions and Miladys, from any chain supported by the ZK Coprocessor
- 81K+ queries
- 60K+ unique users
- 610K+ proofs generated
- ~1 min end-to-end to perform a query from an L2 for 1 million storage slots
- 2x faster preprocessing speeds compared to the start of Euclid Testnet
Engineering Progress and Key Learnings
Phase 1 of Euclid Testnet has been about testing the foundational features and system of the Lagrange ZK Coprocessor. Remarkable engineering progress has been made throughout this period, along with some key learnings and optimizations:
- Extremely fast, hyper-parallel computations - The Lagrange Labs team made a conscious decision to use Plonky2 amongst the different proof system options, and this has paired very well with the hyper-parallel approach of Lagrange’s ZK Coprocessor. While Plonky2 already has the best recursion time, we observed that it is performing even better as our big computations are split into small circuits that recurse over each other. In our case, we’re seeing that the same computation (including some expensive Keccak operations) can be performed 2x faster in our system, by splitting each Keccak into its own proof and recursing sequentially over many small proofs.
- Efficient update times - A key benefit of our Reckle Trees research applied to the Lagrange ZK Coprocessor involves identifying only what has changed and computing on the delta, rather than recomputing everything from scratch. This has been functioning well and resulting in very efficient update times.
- Reduced initialization costs - By launching the decentralized Lagrange ZK Prover Network on EigenLayer, the cost of initial spikes in initializing the Lagrange Verifiable Database has been decreased.
- Handling spikes in query volume - There were times during the last few weeks when the system experienced load spikes of tens of thousands of queries within a short amount of time. To handle this, we are throttling the query queue on our system, while still maintaining the ability to verify the proof when it comes back onchain.
- Block reorgs - At the beginning of Euclid Testnet, we would start processing a block, but would have to go back one block when there turned out to be a small reorg. These types of small reorgs of length 1 were happening a lot more than we expected, and so now we slightly enhanced our filtering of uncle blocks, so as to avoid spending effort on non-relevant blocks.
- Task allocation for diverse operators - Due to the different setups of the node operators within the decentralized Lagrange ZK Prover Network, which may result in varying computation efficiency and time, the Gateway for the ZK Coprocessor has a basic system to allocate tasks to ensure optimal proof generation times, and there is ongoing work to make this even more efficient.
What’s Next
Phase 1 of Euclid Testnet is concluding, and the team is already hard at work on Phase 2, which is going to be focused on unlocking more customizable options for users.
For Phase 2, the intention is to launch and test the limits of the following features:
- Self registration of any NFT or ERC20 contract with our ZK Coprocessor
- Custom SQL queries, including more SELECT queries like FROM tables, WHERE P1 AND P2 AND P3, LIMIT + OFFSET, and DISTINCT, etc.
- Transaction trie and receipt trie support, in addition to bloom filters/logs
Stay tuned for more updates on the Lagrange ZK Coprocessor, including applications starting to leverage its capabilities. We invite you to follow us on Twitter to stay updated, and if you’re interested in helping to test the system in the following weeks, join our Discord community.