Opinions
6 months ago

Zero-Knowledge (ZK) 101: Everything You Need to Know About ZK Proofs

Guest Author Nov 15, 2023 12:53
A closer look at Zero Knowledge and everything you need to know about the exciting and cutthroat concept that's been making waves in the crypto industry.

By Jay White, Co-Founder and Head of Research of Space and Time

ZK is the crypto buzzword of the year—and for good reason—but if you’re not a cryptographer or a developer, you may be wondering: what exactly is a zero-knowledge proof (ZK-proof)?

The core principle behind ZK-proofs is simple yet profound: they allow one party (the prover) to efficiently prove to another party (the verifier) that it possesses certain knowledge without needing to reveal the specifics of that knowledge.

The concept originated from the groundbreaking work of a few academic researchers in the mid-1980s and has since blossomed into a practical mechanism for verifiable computation and laid the foundation for the modern Web3 ecosystem, where ZK-proofs are becoming increasingly integral.

The Evolution of ZK in Blockchain

While ZK-proofs existed in theoretical cryptography long before the rise of blockchain, it is the decentralized nature of the latter that has propelled ZK-proofs into the public eye. Blockchain, in its essence, is a public ledger. Every transaction, no matter how trivial, is recorded and can be viewed by anyone. But while transparency is one of the blockchain’s greatest strengths, it’s also its Achilles heel when it comes to user privacy.

That’s where ZK began to show its power.

ZK-proofs address the dichotomy between transparency and privacy in the blockchain space. They allow for transactions to be validated without revealing transaction details, thereby preserving user confidentiality while maintaining the immutable nature of the blockchain. By the mid-2010s, projects like Zcash started to build ZK protocols offering private transactions, leading to a surge in interest and adoption of ZK in Web3. But over the last decade or so, the Web3 use case for ZK-proofs has evolved from simple privacy preservation to arguably one of the most important advancements for blockchain technology: verifiable off-chain computing.

Solving the Scalability Problem

Before we can highlight the importance of verifiable off-chain computing, we have to talk about the extreme limitations of smart contracts. Smart contracts are inherently limited in three key ways:

  1. Types of data they can access: Smart contracts can only access the most basic on-chain data points (like wallet balances) and can’t natively access most on-chain data—even as simple as token prices—or any off-chain data.
  2. Storage capacity of the blockchain: Blockchains aren’t built to store vast amounts of data. It’s prohibitively expensive and resource-intensive to do so.
  3. The logic they can execute: A smart contract can only execute very basic conditional logic without needing exorbitant gas fees.

Without a way to solve each of these problems, the blockchain can’t scale to meet the increasing needs of a growing Web3 ecosystem. Luckily, as Web3 has evolved, so too has ZK. While projects like Chainlink’s decentralized oracle network (DON) and cross-chain interoperability protocol (CCIP) have elegantly solved the first problem, several ZK protocols are working to solve the other two.

The most elegant way to solve the limited storage and computing of the blockchain is by moving some of the data and computational work off-chain. The idea that you can perform actions off-chain and use a ZK-proof to succinctly and trustlessly communicate a summary of those actions to the main chain without transferring all the underlying data has ushered in a new paradigm for blockchain technology. Let’s take a look at some of the protocols that are building in this space.

Solving for Storage: ZK-Proven Decentralized Storage

A well-known solution to the blockchain storage problem is off-chain decentralized storage networks. Instead of storing large amounts of data, the blockchain only has to store smaller references to that data as it’s stored in the off-chain platform.

However, simply moving data off-chain isn’t sufficient; in order to ensure that the off-chain data remains available and untampered (to be connected back to a smart contract), you need a ZK-proof. Filecoin’s PoST is a great example of this implementation: it provides periodic cryptographic proofs of continued data storage, fostering trust in the network while still alleviating the data load from the main blockchain.

Solving for Compute: Transaction Rollups

Perhaps the poster child of ZK, ZK-rollups have emerged as the preferred solution to the growing demand for faster and cheaper transactions on L1s like Ethereum. Instead of processing every transaction individually on the main chain, which can lead to congestion and higher gas fees, ZK-rollups take the computational heavy-lifting off the chain, aggregating multiple transactions into a single “rollup”.

For every large batch of transactions processed off the main chain, only a single, compact proof is submitted back to it, providing cryptographic evidence that these transactions were correct. The main chain remains secure without being directly involved in the verification of every individual transaction. ZK-rollups not only enhance transaction processing speed but also conserve the main chain’s resources, significantly boosting throughput and reducing transaction fees. Some of the most prominent ZK-rollups include Polygon’s zkEVM, Matter Labs’ zkSync, and Starkware’s STARKEx.

For an in-depth look at zk-rollups, please have a look at our podcast with Starkware’s Gal Ron:

The Next Generation of ZK

But while solutions like ZK-proofs over decentralized storage and ZK-rollups have certainly laid the groundwork for expanding the limitations of the blockchain, there’s still a critical missing piece. On one hand, decentralized storage solutions are just that: storage.

While storage in and of itself is an important tool, these platforms’ inability to perform any sort of “compute” beyond simple data retrieval severely limits the use cases they’re able to support. And ZK-rollups, though powerful processing solutions that cover a wide range of computing functions, still don’t fill the gap entirely.

Powering Applications at Scale

So, let’s go back to the idea of scaling the blockchain—what does that mean, and what does it look like? If you compare the blockchain stack to the traditional application stack, you’ll notice some obvious differences. In traditional SaaS, apps (at the most basic level) are powered by three steps:

  1. Retrieving a query result: Asking a question about data and getting back an answer.
  2. Executing an action: Performing a task based on the answer.
  3. Updating a state: Telling the system that it’s performed the task.

Let’s look at a couple of examples:

Example 1: Social media platform

  1. The app queries content associated with a user’s connections and gets a ranking of what’s most relevant.
  2. The app displays the content in the user’s feed, and the user views the content.
  3. The app updates the backend state by recording content viewership/engagement (which then adjusts the algorithm).

Example 2: Travel booking website

  1. The app queries available flights and gets the most relevant ones.
  2. The app promotes the relevant flight options to the customer, and the customer selects and purchases a flight.
  3. The app updates the availability and records customer booking details.

In Web3, the blockchain serves as a state management layer, and smart contracts execute actions as arbitrary code, but one key component is still missing: queries. Smart contracts have no way to ask questions about data. Even something as simple as “which wallets have ever owned 2 NFTs from this collection on my chain?” cannot be natively answered by a smart contract. If we are going to realize the vision of Web3 and scale the blockchain to meet the demands of enterprise applications, we have to give smart contracts a way to trustlessly ask questions about data on their own chain, on other chains, and off-chain.

Proof of SQL and the Verifiable Compute Layer

Database computing — essentially, the ability to ask questions about data—has historically been relegated to centralized, trusted solutions, like PostgreSQL (for simple queries) or Snowflake (for analytics). Decentralized databases exist, but they don’t operate with nearly the same scale or throughput as their centralized counterparts.

And while ZK has evolved to support verifiable off-chain computing, the solutions that have emerged are limited and fragmented, with no ZK project tackling the most important missing piece of the Web3 stack: queries.

That’s why the team at Space and Time built Proof of SQL: a ZK-proof that juxtaposes the scale of a data warehouse (an enterprise-scale database) with the verifiability of a blockchain. Proof of SQL proves that queries run in a database are computed correctly on the right data and that both the query and the underlying data haven’t been tampered with. This allows smart contracts to access off-chain database computing in a verifiable way, fills the query gap in Web3, and enables developers to build trustless data-driven NFTs, protocols, and financial instruments on-chain.

Proof of SQL enables Space and Time’s own decentralized data warehouse to serve as Web3’s Verifiable Compute Layer, but it can also be connected to any SQL database, centralized or decentralized, to provide verifiable query results to smart contracts.

In Conclusion

As we stand on the precipice of a decentralized future, the significance of ZK-proofs in reshaping Web3 cannot be overstated. The advent of solutions like Proof of SQL highlights the transformative power of ZK, expanding its utility far beyond mere transactional privacy. The continued evolution and adoption of ZK technology will be instrumental in creating a decentralized future that marries both scale and trustlessness, ushering in new paradigms of security, efficiency, and transparency.

About the Author

Jay White is a Co-Founder and Head of Research at Space and Time. His primary focus is on the research, design, and implementation of Space and Time’s innovative database tamperproofing mechanism, called Proof of SQL.

Before Space and Time, Jay was a Professor of Mathematics, with research focused on computational mathematical problems. Jay’s background in algorithmic development and algebraic research has uniquely positioned him to fuse the theoretical mathematics of cryptography with the scalable implementation needed to create cryptographic guarantees for enterprise-scale databases. At his core, Jay is a passionate problem solver, visionary, and researcher who is building an essential solution to the infrastructure of Web3.

Share This Article
Tags: Ethereum