zkVM Scaling With zkMemory - Pushing Beyond Standards

Zero-Knowledge Virtual Machines (zkVMs) are reshaping the way we think about secure computation. Unlike traditional virtual machines, zkVMs generate zero-knowledge proofs, ensuring computations are verifiable without revealing underlying data. This unique feature makes zkVMs perfect for applications requiring both transparency and privacy, such as blockchain smart contracts, secure multi-party computations, and privacy-preserving data processing.
To elevate zkVM capabilities, zkMemory was introduced - a groundbreaking memory prover concept enabling efficient and verifiable memory operations while maintaining zero-knowledge properties.
In this blog, let us take you through zkMemory's features and innovations.
I. What is zkMemory?
zkMemory is not only a back-end of our zkDA Layer but also a powerful building block for creating secure and efficient Zero-Knowledge Virtual Machines (zkVMs). As a modular memory prover, zkMemory is designed to be agnostic to specific proof systems. This means it can seamlessly integrate with a range of zero-knowledge proof (ZKP) systems, offering exceptional adaptability - crucial to meet the diverse and evolving needs of blockchain applications.

Generalizing Memory for zkVM (zkMemory)
Concept of zkMemory
At the core of zkMemory is a special library for zkVMs. We're ensuring that reading and writing data is safe and reliable while allowing users to customize how they work with data. This is a fundamental building block for secure and efficient computing in zkVM environments.
Memory as a State Machine
Imagine a digital memory system in a computer as a library. In this library, you can read books and write notes in them. However, this isn't just any library; it's designed to work in a special kind of system called zkVM, which stands for zero-knowledge virtual machine.
In zkVM, we want to create a memory system that can be used in different zkVM setups. To do this, we're reimagining how memory works. We're treating memory like a simple state machine with two primary instructions: READ and WRITE. Think of these instructions as reading from a book and writing in a notebook. Additionally, we're making memory configurable, which means you can choose the size of the chunks of data you want to read or write. This chunk size is called WORD_SIZE.
How zkMemory Works
READ instruction: When you execute a READ instruction in zkMemory, you're essentially querying a specific memory location, much like flipping to a page in a book. If that page hasn’t been written to before, you’ll receive a value of zero, indicating that the location is empty or unmodified. Once data is written to that page, every subsequent read will return the same value as the previous time it was written. This ensures consistency and reliability in the memory read process.
WRITE instruction: The WRITE instruction in zkMemory works like writing notes in a notebook. You can add data, but certain sections of this notebook are designated as "read-only," meaning you can only read from them, not modify them. When writing data, zkMemory ensures that you're only modifying areas that are designated as writable, maintaining the integrity of the rest of the memory.
Key Considerations in zkMemory Operation
1. How do we handle memory boundaries?
We need to make sure that we stay within the limits of memory while reading and writing. This is crucial to prevent errors and data corruption.
2. Do we need to deal with memory allocation and deallocation?
Memory allocation means setting aside space for your data, and deallocation means releasing that space when you're done with it. In zkMemory, we want to make sure that memory is used efficiently and that there are no memory leaks.
3. How do we deal with configurable WORD_SIZE?
We're allowing users to choose the size of the data chunks they work with. This flexibility is important because different applications may need different chunk sizes, and we want to support them all.
II. The concepts behind zkMemory
zkMemory leverages several advanced cryptographic concepts to provide efficient and secure memory commitment solutions. Below, we’ll explore the key concepts behind zkMemory, focusing on KZG Polynomial Commitment and the Verkle Tree, both of which are foundational to zkMemory's functionality.
Introduction to KZG Polynomial Commitment
KZG, short for Kate, Zaverucha, and Goldberg Commitments, is a cryptographic polynomial commitment scheme that plays a crucial role in enhancing the efficiency, security, and privacy of blockchain systems. The scheme allows users to commit to polynomials and prove that a specific value exists at a given point in the polynomial without revealing the entire polynomial. This ability is essential for systems like zkMemory, where efficient data verification is necessary.
KZG commitments are built on bilinear pairings and hidden order groups, algebraic structures that provide strong cryptographic properties. The key benefits of KZG commitments include:
Succinctness: The commitment is small in size, making it efficient to store and transmit.
Homomorphism: This allows operations to be performed on committed data without needing to reveal the underlying data itself.
Efficient Verification: KZG commitments enable the verification of large datasets without needing to process the entire dataset, making them ideal for blockchain applications.
Introduction to the Verkle Tree
The Verkle Tree, introduced by John Kuszmaul, is an enhanced cryptographic tree structure designed to combine the benefits of both Merkle trees and vector commitments. The tree has a k-ary structure, meaning each node has k children, unlike traditional binary Merkle trees. This allows for more efficient organization and verification of large data sets.
zkMemory leverages the Verkle tree for efficient memory proving. The tree’s structure allows zkMemory to provide memory proofs that are both privacy-preserving and computationally efficient. By utilizing the Verkle tree, zkMemory can reduce the complexity associated with verifying memory states and operations.
Benefits of Using KZG Commitment for the Verkle Tree
zkMemory combines KZG Polynomial Commitments with the Verkle Tree to provide efficient memory commitment and enhance the proof process. Here’s how:
Hierarchical Structure: The Verkle tree organizes memory in a layered structure, with each node committing to its children. This design simplifies the process of proving specific memory states or operations, as zkMemory only needs to interact with the relevant parts of the tree.
Efficient Proof Generation: By using KZG commitments within the Verkle tree, zkMemory ensures that the proofs of memory operations (such as reading or writing data) are generated with minimal overhead. The KZG scheme helps to maintain a constant-size proof for each memory operation, regardless of the tree's depth or the amount of data involved.
Shorter Opening Paths: The Verkle tree structure, combined with KZG commitments, reduces the number of steps required to open a memory commitment, improving efficiency.
Constant-Sized Proofs: The use of KZG commitments guarantees that the size of memory operation proofs remains constant, regardless of the size of the memory or the depth of the Verkle tree.
III. First Implementation of zkMemory with Orochi Network

We’re excited to be rolling out the first version of zkMemory within the Orochi Network, and here’s what we’re aiming to accomplish:
Building Memory Trace
For zkVMs, ensuring the correctness and consistency of memory operations is vital. To achieve this, zkMemory introduces memory tracing. This mechanism keeps a record of every memory access, allowing for verification and proof of the memory's accuracy. Just like a library logbook, we want to document everything that happens in our digital memory.
Memory tracing offers several benefits:
Building Memory Trace: zkMemory builds a comprehensive memory trace, which acts as a historical record of memory operations.
Committing Memory to Verkle Tree: Memory traces are committed to a Verkle tree, providing an efficient way to verify memory integrity.
Providing Witness for Correctness: zkMemory generates a witness after each memory state is committed, enabling the prover to validate the memory's correctness efficiently.
Committing to the Verkle Tree
To ensure the integrity and security of our memory, we employ a special technique called the Verkle tree. This is where things get interesting. Just as a library may use unique codes or labels to manage books and their location, the Verkle tree helps us organize and protect the data in our memory.
The Verkle tree is like a complex digital tree structure, where each piece of data is securely placed. By using the Verkle tree, we can make sure that memory is organized efficiently and that it's not tampered with. It's a bit like arranging books in a library in a way that makes sense and keeps them safe.
The KZG Polynomial Commitment Scheme
In the world of zkVMs, we have what's called a "prover" who needs to prove that the memory is being handled correctly. So, after every memory state is committed (like a library closing its doors at the end of the day), we provide a witness. This witness is like a way to prove that everything in memory is in the right place and hasn't been altered.
This is important for security and trust. If someone wants to check that the library books are all in order, they need evidence, just like in zkVMs, the prover needs a witness to show that the memory actions are accurate and secure.
One of the key tools we use in zkMemory is the KZG polynomial commitment scheme. It's like a special encryption method that ensures that data is kept safe and that we can prove it hasn't been changed.
KZG commitment works in a way that keeps the size of the proof (the evidence that memory is correct) small and the verification process quick. It's like having a small, yet highly effective, security guard for our memory library.
Why Does It All Matter?
You might wonder why all this matters. The answer is simple: zkVMs are increasingly used in areas where data security and trust are critical. Just like a library needs to ensure its books are correctly cataloged and securely stored, zkVMs need to do the same for their digital memory. This system ensures that data remains accurate, secure, and trustworthy, which is essential for the success of applications that rely on zkVMs.
Grant From The Ethereum Foundation

Orochi's zkMemory has received support from the Ethereum Foundation. This grant not only validates the significance of zkMemory but also empowers the project to further enhance memory commitment and contribute to privacy-focused technologies within the Ethereum ecosystem.
Implications and Benefits
Increased Resources: The grant provides the necessary funding to refine and enhance memory operations, ensuring that zkMemory can continue to innovate and scale.
Recognition and Validation: The support signals a vote of confidence from one of the most prominent institutions in the blockchain space, which will attract further attention and development opportunities.
Improved Privacy for zkVMs: With Ethereum Foundation's endorsement, zkMemory is positioned to offer more robust privacy-preserving features for zkVM projects, helping to improve memory operation integrity while ensuring confidentiality.
We were grateful for this support from Ethereum. With their backing, we're moving forward with developing zkMemory and other innovations, aiming to create a more secure and scalable future.
Conclusion
In conclusion, zkMemory is a groundbreaking module that simplifies Memory Prover for zkVMs. By introducing memory tracing, leveraging the KZG commitment scheme, and utilizing the Verkle tree, zkMemory enhances memory commitment and validation. This easy-to-implement system offers a flexible solution for zkVM projects, contributing to a more secure and efficient virtual machine environment.
Learn more about zkMemory in our Cookbook About Orochi Network
Orochi Network is the world's first zkDA Layer recognized by the Ethereum Foundation. By leveraging Zero-Knowledge Proofs (ZKPs), Orochi ensures data integrity, security, and interoperability, empowering developers with the tools to overcome the limitations of on-chain execution and scalability in Web3. At the core, Orochi offering the world's first verifiable database designed for enterprises, AI/ML, zkML, zkVMs, verifiable computation, Web3 applications, and more.