By Hein Dauven | March 2, 2023
In this article, we will explore the concepts of ZKPs, their applications in different use cases like rollups, ZK-VMs, and ZK-EVMs, and how it all relates to Dusk. We also delve into what scaling and virtual machines are from a high level.
Locked Boxes and Secret Words - ZKP Intro
Think of it like a game of 20 Questions: imagine you're playing with someone who is trying to guess a secret word that you know. Normally, you would have to tell them the word if they guessed it correctly, but with zero-knowledge proofs, you can prove that you know the word without actually revealing it. Rather than revealing what the answer is to prove that you know it, you would have a cryptographic proof that proves that you know the answer, but not sharing what the answer actually is.
However, sometimes privacy is not the point. Say a complex calculation takes a lot of time to be performed, for example calculating a high number of permutations of DNA, or computing the end result of executing millions of transactions. You can simply provide a ZKP of the correctness of your result and let verifiers skip the calculation and validate that proof instead.
In the context of cryptography and computer science, zero-knowledge proofs can be used for a variety of applications, from enhancing privacy to scaling, voting systems, digital identity verification, and more.
What makes something zero-knowledge?
The requirements to be considered zero-knowledge are; completeness, soundness, and zero-knowledge.
Complete; if the statement is true then a verifier will be convinced. It is sufficient and needs no additional proofs or work.
Sound; if the statement is false, no amount of cheating can convince the verifier otherwise.
Zero-knowledge; no information is leaked and all the verifier learns is that the statement is true.
The key feature here is that no information is leaked and all that has been proven is the validity of a given statement.
From Traffic Jams to Lunch Rushes - Blockchain Scaling
Scaling refers to the ability of a network to increase the processing power of its infrastructure by adding more operators. In decentralized networks, however, it often happens that increasing the number of nodes (operators) results in a much slower capacity to process transactions and increased costs. Think of it like a busy highway: just like how traffic can slow down and become congested on a busy road, networks can become congested and slow down as more users join the network and start using it. This is why the capability of scaling is paramount for a blockchain.
You can think of it like a restaurant during the lunch rush. Networks capable of scaling are like establishments that can increase staffing, equipment, and space to keep up with higher demands without customers experiencing any significant degradation of services or higher costs. On the other hand, the networks that are not equipped for scaling are like expensive but poorly managed restaurants where customers get continuously turned away, or have to wait much longer to be served during peak times. In short, if a blockchain is not able to scale it may become slow, expensive, or even crash during peak load.
There are several different types of solutions that can be used to scale blockchains. One approach is known as Layer 2 (L2) scaling, which involves creating a secondary ledger that is meant to redirect traffic away from the main blockchain, known as the Layer 1 (L1). Think of it like a subway that runs under a busy street: just like how the subway can sustain a much higher load of travelers than the street above, L2 scaling solutions aim to increase the load of transactions that can be processed by a blockchain without congesting the settlement layer (the main layer or L1). Although the concept might be simple, there is no single implementation that satisfies all cases and researchers have proposed a variety of architectures each presenting different pros and cons. The main ones are State Channels, Rollups, Plasma, Sidechains and Validium/Volition.
These architectures normally complement a so-called network partitioning strategy, which involves processing batches of transactions in parallel. The most popular partitioning strategy is called sharding.
Sharding involves dividing the main blockchain into smaller, more manageable pieces called "shards." Each shard processes a subset of the network's transactions, which improves the speed and efficiency of the entire network. These subsets can be created based on proximity, processing similarity, or random distribution to balance the workload Sharding can be compared to a restaurant with multiple kitchens, each with its own chef, servers, and maître D. Each kitchen is a shard, calibrated to efficiently serve a specific number of tables. Customers are distributed evenly among the available tables, so each shard can provide the same high level of service without being overloaded. Ultimately, all customers’ payments end up in the restaurant’s bank account, which in this example represents the settlement layer.
Similarly, sharding can help to ensure that blockchain transactions are processed quickly and efficiently by breaking the network into smaller pieces that are then presented and settled on the blockchain’s main layer.
Exploring Rollups and ZK
Rollups are currently one of the most popular scaling solutions for blockchains. They work by aggregating a large number of transactions off-chain and then submitting a single transaction to the main blockchain that represents all of the off-chain transactions. Think of it like a grandma preparing a large batch of cookies: rather than baking each cookie individually, the granny can prepare a large batch of cookie dough and then bake all of the cookies at once. This helps to save time and resources, while still producing the same delicious result.
ZK-rollups, or zero-knowledge rollups, are a specific type of rollup that use zero-knowledge proofs to provide additional security guarantees and, in rare cases, some privacy. In a ZK-rollup, transactions are bundled together by the rollup and processed by a smart contract on the main chain. A prover generates a proof that the transactions are valid. This proof is then submitted to the main blockchain, along with a small amount of additional data that is needed to verify the proof.
It's worth noting that most ZK-rollups don’t provide any privacy guarantee since they use zero-knowledge proofs for the efficiency of their verification, rather than privacy. Validity rollups, which is the more correct term for most ZK-rollups, simply bundle a large number of transactions together and submit them to the main blockchain as a single transaction, by using zero-knowledge proofs to verify their validity. Technically speaking, they only use the completeness and soundness properties of Zero-knowledge proofs, but not their zero-knowledge property, so while they may not initially share all the details of a transaction in the transaction hash, it is often decodable and not as private as users may think. The primary reason for doing so is to be able to reconstruct the rollup chain in case of failure.
Playtime in the Digital Sandbox - Virtual Machines intro
A virtual machine (VM) is a software program that emulates a computer, allowing users to run programs in a simulated environment. Think of it like a playpen: just as how children can play in a safe and contained environment without disturbing the rest of the room, developers can run programs on a VM without needing to worry about the physical hardware that is running the code. This can be useful for a variety of reasons, such as providing a consistent development environment across different devices or operating systems.
The Ethereum Virtual Machine (EVM) is a specific type of virtual machine that executes smart contracts on blockchains that are compatible with Ethereum. Smart contracts are self-executing programs that can perform various tasks, such as managing digital assets, validating digital identities, or executing financial agreements.
To continue on the restaurant metaphor, think of the EVM as the chef in a kitchen. The chef has a set of available ingredients and follows various recipes to prepare different dishes. Just like a recipe, smart contracts can use and combine the available instructions to define complex tasks that the EVM then executes.
The ZK-EVM is a special version of the EVM that uses zero-knowledge proofs to provide additional security guarantees for smart contract execution. In a ZK-EVM, the zero-knowledge proofs are used to verify that a smart contract has been executed correctly, which has been a large problem for most ZK-rollups that are currently live. Many ZK-rollups couldn’t leverage the existing Ethereum tooling and ecosystem to build smart contracts and instead had to build their own languages and VMs to support smart contracts. ZK-EVM designs are determined to solve this and prove that a smart contract has been executed correctly according to the EVM specification. Zero-knowledge proofs here are used to verify the correct computation of any arbitrary EVM instruction.
How does all of this relate to Dusk?
As the leading blockchain platform for confidential smart contracts and regulatory compliance, Dusk Network is at the forefront of leveraging zero-knowledge proofs to ensure privacy and security for its users. By utilizing zero-knowledge proofs, Dusk Network is able to keep transactions private, hiding both the assets and amounts being transferred from other participants on the network.
At the core of Dusk Network is the Piecrust VM, a virtual machine that has been designed to be as optimized and efficient as possible when accessing, storing, proving, and verifying zero-knowledge proofs. This VM is specifically designed to be ZK-friendly, meaning that zero-knowledge proofs play a crucial role in every aspect of the network.
Dusk Network is not a ZK-rollup or a ZK-EVM, it is a ZK sovereign L1 blockchain that has its own Proof-of-Stake consensus mechanism and doesn't rely on third parties for settlement. Additionally, Dusk Network has its own VM implementation that does not enforce EVM-compatibility, thus allowing the platform to avoid all legacy limitations and trade-offs of the EVM. In fact, smart contracts on Dusk's Piecrust VM compile to the much more modern and portable WebAssembly (WASM) bytecode.
For third parties looking to extend Dusk Network's existing ecosystem, creating ZK-rollups and ZK-VMs would provide great ways for Dusk to offload computation from the main blockchain and provide verifiable computation from external sources onto the main blockchain. A ZK-WASM VM could provide a pathway for a ZK-EVM equivalent solution for Dusk, enabling everyone to prove that a certain computation took place and is provably correct.
In conclusion, ZKPs have a significant impact on the blockchain industry by enabling more efficient and secure systems. With their potential to improve privacy and scalability, it is worth paying attention to how ZKPs will continue to shape the blockchain landscape in the years to come. ZKP-enabled dApps are still few and far between but will become more common as ZK-friendly blockchains like Dusk enable confidential smart contracts to be built. We encourage readers to learn more about ZKPs and explore the potential applications of this innovative and revolutionary technology.