msfew

Posted on Nov 25, 2022Read on Mirror.xyz

zkWASM, The Next Chapter of ZK and zkVM

0. ZK and zkVM

a) The Magic of Zero Knowledge

A so-called zero-knowledge protocol is a set of mathematical rules by which one party, usually called the prover, can convince another party, usually called the verifier, that given some instance, the prover knows some witness for that instance.

Zero-knowledge proof technology is disrupting and redefining blockchain and Web3.

Zero-knowledge proof technology solves various problems that have been inherent in blockchains since their inception through cryptography and different complex Moon Maths:

A side note is that Hyper Oracle will achieve all four usages of ZK in the future.

b) ZK App Development

Since a ZK-powered application, protocol or network is so robust, how do you develop it? Just like any software development field, you need to code, depending on the programming language and toolbox of it.

In short, there are two different main directions for a ZK application developer:

We believe zkVM will be the holy grail of ZK development since it will help quickly onboard all the developers into the ZK space.

Developers don’t need to learn new languages and hardcore cryptography or worry about the new toolchains, proving systems, and algebraic object but utilize their expertise in Solidity, Rust, C++, and all the toolings.

c) How zkVM works?

zkVM is a virtual machine that guarantees secure and verifiable trustworthiness by zero-knowledge proofs. zkVM outputs the new state and the proof in a trustless manner.

It allows all applications that run in the VM to be given the superpower of zero-knowledge proofs. Developers only need a program that can be run in the zkVM, and the zkVM will take care of all the rest.

If illustrated by a simple and possibly inexact example. The construction of zkVM is a three-step process in essence:

  1. Make a virtual machine (implement all the instruction sets of the VM)

  2. Add SNARK/STARK engine (add proving system)

  3. Add zk to SNARK/STARK engine (enable privacy)

Probably the most well-known zkVMs at the moment are zkEVMs of Ethereum Layer2.

1. zkWASM

a) zkVM Race

Remember the first step of building a zkVM? There’re plenty of choices of instruction sets.

I concluded in zk, zkEVM, and zkVM that “General zkVM is the future of Web3.” which is what the mainstream instruction set represents.

The reason for the popularity of zkEVM is that the teams are leveraging EVM’s importance in the blockchain developer community.

However, when we look at the bigger picture, we see that general zkVM can do not only what zkEVM can do (easy for Web3 developers to get started) but can also gain power from all of Web2’s mature ecosystem and toolchain.

b) WASM

WASM is essentially a binary instruction format for a stack-based VM. What makes it different from others are:

1. Embraced by Web:

2. Universal format:

WASM is benefiting the Web, cloud, programming language, and gaming by:

  • Accelerating media decoding with ogv.js or any other performance-sensitive modules

  • Creating Rust and Go Web frameworks of yew, seed, vecty, and many more

  • Shifting cloud-native and serverless application paradigms with wasmer, Wasmtime, WasmEdge, and many more

  • Boosting emulator performance, including wasmboy, and pinky

  • Creating game engines of ammo.js, and defold

  • Creating new programming languages of AssemblyScript, walt, grain, and many more

In addition, WASM is widely adopted in the blockchain space:

c) zkWASM

zkWASM is a zkVM its whole virtual machine of WASM is written in zkSNARK circuits.

zkWASM will give WASM runtime the ability to provide trustless computation for any program running in it. Simply put, zkWASM combines the best advantages of trustless computation and the rich ecosystem of zkVM and WASM.

In recent years, WASM has been moving beyond the browser to cloud and blockchain. Now, zkWASM is bringing a new paradigm of zkVM + WASM to the blockchain context, solving crypto-native security, trust, and privacy issues.

2. zkWASM Advantages

a) zkWASM is Adoption

The reason why zkEVM will gain a massive advantage in the ZK war because EVM is the most commonly used distributed runtime environment for smart contracts.

EVM and Solidity are significantly well documented, with a vast ecosystem of tools, tutorials, and open-source projects accessible to anyone. Other solutions unmatch the dominance of EVM. Therefore, such adoption makes zkEVM the crown of Ethereum scaling.

I mentioned in a previous post that Polygon zkEVM is the zkEVM solution I’m most excited about. It’s also due to adoption.

Polygon zkEVM may not be the most “Type-1” and native and may not have the best performance. Still, Polygon has the advantage of having a vast first-mover advantage with its PoS chain, with a loyal developer community, eco-partners, and various hackathon resources. On top of the zkEVM layer of adoption, Polygon zkEVM has an additional layer of adoption.

Well, the potential adoption that zkWASM has will be unprecedented.

It has a much larger WASM ecosystem than the entire Web3 ecosystem, and much of the Web3 ecosystem is a direct extension of the WASM ecosystem. The ecosystem that zkWASM has will make it a mature application since its inception.

b) zkWASM is Composability

In the Web3 world, composability pairs with open source, allowing for exponential increases in productivity and innovation. Composability is to software as compounding interest is to finance.

In the Cairo VM environment, we see the Kakarot zkEVM being built; in the RISC0 RISC-V zkVM, we see Sovereign Labs trying to build a zkEVM for the Rust language EVM implementation with RISC0’s zkVM; in the EVM, we also see many EVM in the EVM, such as evm2 and HyVM, even Python Interpreter in EVM.

As a Turing-complete virtual machine, zkWASM can do anything above and beyond, and WASM will make these things more possible and easier to implement.

These are just a few things you can build on zkWASM but they are enough to open up new narratives and possibilities for Layer 3.

We are excited to see how developers can build exciting and creative new applications on zkWASM, and to upgrade existing mature applications into the new era of zk with the zkWASM runtime.

c) zkWASM is All-around

Remember zk is about four usages of security, scalability, interoperability, and privacy.

  • zkWASM can take advantage of all those aspects.

Remember Crypto-Native DApp Architecture.

  • zkWASM is the only optimal solution for the off-chain centralization and security issues of dApps (RPC, Indexing, Oracle, Automation).

Remember how zkWASM’s WASM runtime is a huge part of Web.

  • zkWASM is more than just solving blockchain and dApp’s problems. For example, the implementation of ZK-ML and on-chain ML can be accelerated by the existence of zkWASM.

d) zkWASM is Decentralization

Hyper Oracle’s priority is to enable end-to-end decentralization for all DApps. We will also make our protocols maximally decentralized.

Remember when WASM was the only runnable language on the Web? zkWASM has the potential to run in the browser, and in the future, Hyper Oracle will explore the possibility of running ZK Prover on the Web. Like mina-rs, you can click on a link and become a node to participate in the network and mining.

Why is this important?

  • Permissionless: Anyone can be a node. There’s no centralized sequencer or beefy server requirement for the node.

  • Sovereignty: Anyone can run their own node. It helps privacy and prevents censorship.

  • Diversity: Anyone can contribute to the client and geography diversity of the network. This is a problem that even Ethereum is trying to fix.

  • Performance: Anyone can boost the performance of the network.

Also, maybe run zkWASM in your washing machine?

e) zkWASM is Performance

There have been voices suggesting that general zkVMs may have worse performance than purpose-built zkVMs. But this is not true.

The better practice is to build a generic solution like zkWASM first and then optimize it. We should not use tactical diligence to cover up strategic compromises.

It’s a simple choice between giving up the enormous benefits of WASM, or saving the additional performance optimization.

For optimization, there are very many angles to cut through, and each point can lead to huge levels of optimization mentioned by Taiko and ZKonduit:

  • Prover-level optimizations like Hyperplonk and Caulk

  • ZKP-specific hardware (FPGA/ASIC)

  • Composition of proof systems

  • General optimizations & tricks

  • Programming-wise tuning

  • Aggregation and recursion

  • Fusion and abstraction

3. Who is Using zkWASM

Hyper Oracle is partnering with Delphinus Lab to explore the cutting edge of zkWASM in indexing and automation middleware protocols.

The generality and WASM ecosystem that zkWASM brings allows developers to give zero-knowledge proof superpowers to programs with 100% of their custom logic without requiring any modifications.

zkWASM is completing full support for some of Hyper Oracle’s infrastructure components. Later, Hyper Oracle will make these infrastructure components fully open source as Public Goods.

4. What is zkWASM

Finally, let’s summarize what zkWASM is.

Architecture-wise, zkWASM is:

  • zk virtual machine

  • WASM emulator

Feature-wise, zkWASM means:

  • Adoption

  • Composability

  • All-around

  • Decentralization

  • Performance

Vision-wise, zkWASM is The Next Chapter of ZK and zkVM.