June 2024

Access Massive Blockchain Data From Your Contract Using Maru Platform


As the blockchain ecosystem continues to evolve, one of the critical challenges developers face is efficiently accessing and utilizing historical blockchain state data. This is where the Maru Platform steps in, revolutionizing the way dApps interact with Ethereum’s historical state using zero-knowledge proofs (ZKPs). Let’s dive into what makes the Maru Platform a game-changer for the blockchain community.

Understanding the State Accessibility

While the execution environment of the blockchain primarily deals with the current state, a vast amount of valuable data is stored in the historical or parallel state (of other rollup or L1). Until recently, using this data in a trustless and efficient manner posed significant challenges. The main limitation is the massive amount of data commitments required to be verified in order to trust this data, which exceeds the capacity of on-chain VMs. The novel approach is to use ZKPs to prove data commitments and operations over it off-chain and verify the output in an on-chain execution environment. While some projects are using an optimistic approach with an economic driven security model, Maru releases our approach of proving state data for web3 apps.

Leveraging Zero-Knowledge Proofs with Maru

Zero-knowledge proofs have introduced a new paradigm in ensuring data integrity and trustlessness. Maru Platform harnesses the power of ZKPs to prove each block, enabling developers to query and process necessary data through a comprehensive SDK. This facilitates the development of dApps that can trustlessly distribute rewards, create rebate systems, and incentivize users based on their on-chain activities as specified in smart contracts.

How Maru Platform Works

Maru Platform employs a four-step process to handle blockchain data:

  1. Prove and Cache Each Block: Every block is proven and cached to ensure data availability.
  2. Provable Query Execution: Queries are run to extract and filter the required data.
  3. Provable Computation: Computations are performed over the retrieved data.
  4. Aggregation and Proof Generation: The results are aggregated into a single output with a corresponding proof.

This methodology ensures that all operations are transparent, trustless, and efficient.

Key Components of Maru Platform

Merkle Proof Aggregation

Maru utilizes massive Merkle proof aggregation to cache all block data. This ensures that the platform is constantly updated with the latest on-chain commits.

zkEVM Integration

The zkEVM component allows developers to query contracts directly using the ABI. This simplifies the interaction with smart contracts, avoiding the complexities of memory slots and contract storage. The main advantages of this tool:

  • Security: you don’t have to convince users in correctness of your implementation, just use standard or widely used and audited smart contract and its interface;
  • Flexibility: to process the data in the same way it is done in the existing web3 apps (you don’t need to deal with raw state formats researching each contract architecture);
  • Adoption: Solidity is the most used stack in the web3 world.


zkMapReduce is a computational architecture that naturally arises from the blockchain structure. By splitting calculations into block-oriented Map part and chain-oriented Reduce part we can both make calculations more simple and efficient. This approach enables us to employ wide-scale parallelism to dramatically improve performance on historical datasets, when we need to prove calculation for thousands blocks at a time. We are using a special calculation-oriented DSL to code both parts in a low-level yet understandable manner. Programs written in this DSL yield faster proofs. Alternatively, the MapReduce part can be implemented in Solidity bringing every advantage of a popular high-level programming language to the table for a price of a bit slower proofs.

zkMapReduce provides the capability to perform custom computations over filtered data, catering to various dApp requirements such as volume calculations, user leaderboards, and funding rates.

Practical Use Cases

Maru Platform's robust architecture and versatile functionalities open the door to numerous practical applications:

  • DeFi Interest Rates and Earnings Data: For instance, an auto-rebalancing yield generation contract can utilize daily DeFi interest rates and earnings data. A prime example is AAVE Deposits and Borrows v2, where Maru Platform ensures seamless data integration.
  • Volume Weighted Average Price (VWAP): By leveraging data from AMM pools, dApps can compute VWAP without relying on third-party oracles. The Curve tricrypto2 ETH VWAP is a testament to Maru Platform's capabilities in this area.

Requesting Data

You can easily define what data you need using Maru API or Portal:

	"plonky2_inputs": {
				… ,
			"formula":[{"formula":"op1 aux0 mul 1000000000000000000 div"}]},
			"expressions":{"formula":"acc0 op0 add"}},
	"verifier_inputs": {

Where "formula" is an expression represented in reverse Polish notation and “hash” is used to identify various expressions in the proving system and is calculated as follows:

hash = sha256("{contract}{topics}{keccak(offsets)}{keccak(map)}{keccak(reduce)}")

While "contract" contains the address of the contract that has generated the expression events, "topics" contains an array of event topics that interpret the indexed event parameters.


After the proof is generated, it can be verified on-chain in the Sepolia Testnet network, in which contracts for proof verification are pre-deployed. A proof verification transaction is passed to the on-chain verifier and saves the result in the VerificationGateway contract storage. After a successful transaction Maru returns a link for it:

and other smart contracts can check whether Inputs with their corresponding proofs have been checked previously using the following functions:

 function isProofed(
     uint256[8] calldata input
 ) external view returns (bool);

 function isProofedUserInput(
     bytes32 blockhash_prev,
     bytes32 blockhash_end,
     bytes32 hash,
     bytes32 value
 ) external view returns (bool);

For this check, other smart contracts do not need to know the proof, but only need to pass the correct input data, which contains information about the period, expression, and result of the calculation.

The codebase for Maru Platform has been open-sourced here, and instructions for how to engage with this testnet can be found on Maru Docs.

Next Steps

While this is already significantly more efficient and faster than typical competitors, we have many planned updates that will further improve the performance as well as the user experience:

  • Index L2 rollups state;
  • Integrate SP1, Valida & Jolt verifier into Maru proof stack (to run arbitrary rust programs);
  • Gas as a metric proving cost calculation.

And of course adding node operators to our testnet to run proof generations will be evaluated and implemented soon. Stay tuned!