> For the complete documentation index, see [llms.txt](https://abc-71.gitbook.io/curriculum/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://abc-71.gitbook.io/curriculum/week-9/scaling-ethereum.md).

# Scaling Ethereum

Zero-Knowledge (ZK) cryptography is a transformative approach to proving information without revealing the underlying data. At its core, ZK cryptography enables a “prover” to prove knowledge of a certain fact to a “verifier” without revealing the actual content of the fact itself. This is invaluable for privacy-preserving technologies, digital identity verification, and, crucially, for scaling solutions like ZK-Rollups in blockchain ecosystems.

## What is Zero-Knowledge Proof?

A **Zero-Knowledge Proof** (ZKP) is a cryptographic method where one party, the prover, can demonstrate to another party, the verifier, that they know a specific piece of information or that a certain statement is true, without revealing any other information about the data. This method relies on three principles:

1. **Completeness**: If the statement is true, the verifier will be convinced by the prover's claim.
2. **Soundness**: If the statement is false, the verifier will not be convinced (unless there’s a low probability of error in some cases).
3. **Zero-Knowledge**: The verifier learns nothing other than the fact that the statement is true.

### Types of Zero-Knowledge Proofs

1. **Interactive Proofs**: The prover and verifier engage in a back-and-forth interaction until the verifier is satisfied with the proof’s validity.
2. **Non-Interactive Proofs**: A single proof is generated by the prover, which the verifier can use independently to confirm the validity of the claim. Non-interactive proofs are critical for efficiency in blockchain and other applications, as they don’t require back-and-forth communication.

## Zero-Knowledge SNARKs

**Zero-Knowledge Succinct Non-Interactive Argument of Knowledge (ZK-SNARKs)** are a specific form of ZKP that is particularly efficient for use in blockchains and other large systems.

* **Succinct**: The proof is very short, enabling fast verification times regardless of the complexity of the statement.
* **Non-Interactive**: Only one proof is generated, which can be verified independently, which is key for scalability and efficiency.
* **Argument of Knowledge**: The prover must know the “witness” (the solution or secret information) to create the proof.

### **How ZK-SNARKs Work**

ZK-SNARKs are based on advanced cryptographic techniques, like elliptic curve pairings and polynomial commitments. Here’s a simplified outline of their workings:

1. **Setup Phase**: A trusted setup is used to create a common reference string (CRS) that all parties can use. This step is crucial, but the generated data must remain secret to ensure the security of the SNARK.
2. **Proof Generation**: The prover uses the secret data and the CRS to create a proof that demonstrates their knowledge of the solution.
3. **Verification**: The verifier uses the CRS and the proof to verify that the prover indeed knows the solution, without seeing the actual data.

### **Advantages of ZK-SNARKs**

1. **Privacy**: Data can be kept private, as ZK-SNARKs only prove knowledge of information without revealing it.
2. **Efficiency**: SNARKs provide a very succinct proof size and quick verification time, making them practical for blockchains.
3. **Scalability**: ZK-SNARKs enable rollups, allowing Ethereum to process thousands of transactions off-chain and then confirm them with a single proof on-chain.

### **Applications of ZK-SNARKs in Blockchain**

* **Zcash**: Zcash is a privacy-focused cryptocurrency that uses ZK-SNARKs to allow shielded transactions, meaning transaction details like sender, receiver, and amount are kept private.
* **zkSync**: zkSync is a Layer 2 scaling solution using ZK-Rollups with ZK-SNARKs to verify transactions in batches, dramatically reducing gas costs and boosting Ethereum’s scalability.

## Comparison with ZK-STARKs

Another type of ZKP is **ZK-STARKs** (Zero-Knowledge Scalable Transparent Argument of Knowledge), which have different trade-offs:

* **Transparency**: ZK-STARKs don’t require a trusted setup.
* **Scalability**: ZK-STARKs offer more scalability due to reduced reliance on elliptic curves.
* **Size of Proof**: STARKs have larger proof sizes but are generally more computationally efficient.

### Summary:

* **Privacy**: ZK-SNARKs are pivotal for privacy-preserving solutions, as they enable the proof of knowledge without data exposure.
* **Scalability**: ZK-SNARKs power Layer 2 solutions like zkSync, making blockchains faster and cheaper.
* **Real-World Applications**: Zcash, zkSync, and StarkNet demonstrate ZK-SNARKs in practical use.

### **Additional Resources**

1. **zkSync Documentation**: zkSync’s ZK-SNARK-based Layer 2 protocol for Ethereum [here](https://zksync.io/).
2. **Zcash Overview**: A privacy coin using ZK-SNARKs to secure private transactions [here](https://z.cash/).
3. **Introduction to ZK-SNARKs**: A comprehensive breakdown on Ethereum.org [here](https://ethereum.org/en/developers/docs/zk-snarks/).
