Cheap & Fast Cross-Chain Queries from Fraxtal with Lagrange’s ZK Coprocessor

May 9, 2024

Frax <> Lagrange

Lagrange Labs is excited to share that Lagrange and Frax Finance have partnered to enable developers to perform cross-chain querying from Fraxtal, using Lagrange’s Zero Knowledge (ZK) Coprocessor. This integration is a game changer for developers, offering them the ability to send a query from their smart contract and get the ZK-proven result cheaply and blazingly fast on an L2 chain like Fraxtal, even for data that is from a different blockchain, such as Ethereum. There’s also no need to build out bespoke data processing mechanisms or rely on intermediaries, and developers can leverage the strong security guarantees provided by ZK proofs. In short, this capability unlocks a whole new array of cross-chain and big data applications that weren’t previously feasible.

About Lagrange’s ZK Coprocessor

Lagrange’s ZK Coprocessor addresses the scalability challenges of onchain applications today, by pre-processing blockchain data into a Verifiable Database and then using an off-chain network of nodes that execute parallelized computations and generate ZK proofs of the result to bring back onchain. Lagrange’s ZK Coprocessor relies on a network of provers that are restaked on EigenLayer. Each prover provides cryptoeconomic guarantees behind the liveness of the proofs that it serves and face economic penalty on nodes who fail to deliver correct proofs on time. With Lagrange’s hyper-parallel ZK Coprocessor, developers and protocols can query extremely large sets of blockchain data directly from their smart contracts and access the data they need in an efficient and fast manner.  

About Fraxtal & Frax Finance

Fraxtal is a modular rollup from Frax Finance that utilizes the OP stack for its smart contract platform and execution environment. To fuel the ecosystem, Fraxtal has blockspace incentives called Flox that reward users and developers for spending gas and interacting with any smart contract on the network. The native gas token is Frax Ether (frxETH) issued by Frax Finance.

Frax is a DeFi protocol that issues decentralized stablecoins and supports them with an ecosystem of sub-protocols. Unlike traditional stablecoins that are backed by fiat reserves, Frax achieves stability and ensures decentralization through both a collateralized and an algorithmic approach.  

How It Works

Lagrange’s ZK Coprocessor is composed of a network of independent provers who execute computations in a parallel and distributed way, as assigned by the coordinator. The ZK Coprocessor proving network connects with data from a blockchain such as Ethereum, whether it’s reading updates, listening for registrations, listening for queries, or sending proofs of query results provided by prover nodes. With the Fraxtal integration, the ZK Coprocessor effectively becomes a middleman and listens for queries from Fraxtal smart contracts about data on Ethereum, executes the necessary computations and proofs, and send the query results in proof form back to the Fraxtal smart contract.

To illustrate using a concrete example, let’s assume you want to build an app on Fraxtal that enables Pudgy Penguin holders to mint a new NFT collection. Using the ZK Coprocessor, you can query the Pudgy Penguins contract directly from your Fraxtal app’s smart contract to verify that an address truly holds Pudgy Penguin NFTs. Having the option to query from Fraxtal yields various benefits, including significant gas savings compared to doing so on Ethereum and eliminating the need to build your own data processing scheme or use any sort of oracle. 

You can try out querying with this example by visiting our ZK Coprocessor ‘Euclid’ Testnet docs

Exploring Additional Functionalities Together

Looking beyond simple querying of an NFT contract, the Lagrange ZK Coprocessor enables a variety of new dynamic DeFi primitives to be built by developers on Fraxstal. Frax and Lagrange will be continuing to work closely together to pursue use cases related to using large scale verifiable computation to unlock new capital efficient DeFi primitives. 

For example, the balance of Frax Shares (FXS) staked by a user on L1 are currently summed with their L2 FXS stake to create their veFXS balance on the veFXSCounter L2 contract. With Lagrange’s ZK Coprocessor, any application on Fraxtal can verify a proof of the result of an SQL query over either the veFXS contract on Ethereum mainnet or Fraxtal L2. This enables applications to easily integrate veFXS positions into their contract logic, irrespective of which chain they are staked on. As Frax and FXS continue to spread across the rollup ecosystem, native staking of FXS can be made possible on veFXS contracts on any other L2. Lagrange’s ZK Coprocessor proofs can act as a glue to easily sum the balance of positions across each of these execution spaces.

Moreover, applications on Fraxtal can implement their own staking logic similar to veFXS with any ERC20 without requiring a sequencer update to adjust the sum of positions within the L2 contract.

Another relevant use case of Lagrange’s ZK Coprocessor with Fraxtal is blockspace incentives based on cross-chain positions. For example, the Flox Rank of a user could be amplified through a boost function that incentivizes users to provide liquidity in a DEX on Ethereum for a FRAX or FXS asset pair. With Lagrange’s ZK Coprocessor, Frax and other protocols building on Fraxtal can easily implement these mechanisms by verifying proofs of SQL computation over Ethereum mainnet state.