描述
<h2>0. ZK and zkVM</h2><h2>a) The Magic of Zero Knowledge</h2><blockquote><a href="https://leastauthority.com/static/publications/MoonMath080822.pdf" rel="noopener noreferrer" target="_blank"><em>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.</em></a></blockquote><p>Zero-knowledge proof technology is disrupting and redefining blockchain and Web3.</p><p>Zero-knowledge proof technology <a href="https://zkdeconstructions.substack.com/p/zk-has-nothing-to-do-with-blockchains" rel="noopener noreferrer" target="_blank">solves various problems</a> that have been inherent in blockchains since their inception through cryptography and different complex Moon Maths:</p><p class="ql-align-center"><img src="https://miro.medium.com/max/1400/1*nbSMWbmN9O0Cv1uilWr7kQ.webp"></p><p>A side note is that Hyper Oracle will achieve all four usages of ZK in the future.</p><p><br></p><h2>b) ZK App Development</h2><p>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 <a href="https://www.youtube.com/watch?v=ru-fCNOWals" rel="noopener noreferrer" target="_blank">the programming language and toolbox of it</a>.</p><p>In short, there are <a href="https://www.youtube.com/watch?v=wyBNZzLEgkA" rel="noopener noreferrer" target="_blank">two different main directions</a> for a ZK application developer:</p><p class="ql-align-center"><img src="https://miro.medium.com/max/1400/1*pe4nZauQfCCDE-E57NjrYw.webp"></p><p><a href="https://mirror.xyz/msfew.eth/Yl64OK3lLG48eJpVB3GxqFEhmWOm6yMlAo9sc1VrQP4" rel="noopener noreferrer" target="_blank">We believe zkVM will be the holy grail of ZK development</a> since it will help quickly onboard all the developers into the ZK space.</p><p>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.</p><p><br></p><h2>c) How zkVM works?</h2><p>zkVM is a virtual machine that guarantees secure and verifiable trustworthiness by zero-knowledge proofs. <a href="https://docs.google.com/presentation/d/1XB96F9ahIlGUevpOTdi-yx_gkrwmX4WGcCjwf3gEiYc/edit#slide=id.g13232b2e9d8_0_401" rel="noopener noreferrer" target="_blank">zkVM outputs the new state and the proof in a trustless manner</a>.</p><p class="ql-align-center"><img src="https://miro.medium.com/max/1400/1*ADShLCWbaCzbtQIgFpx-qw.webp"></p><p>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.</p><p>If illustrated by a simple and possibly inexact example. The construction of zkVM is <a href="https://www.youtube.com/watch?v=Nz4OYntBVMg" rel="noopener noreferrer" target="_blank">a three-step process in essence</a>:</p><p><br></p><ol><li>Make a virtual machine (implement all the instruction sets of the VM)</li><li>Add SNARK/STARK engine (add proving system)</li><li>Add zk to SNARK/STARK engine (enable privacy)</li></ol><p class="ql-align-center"><img src="https://miro.medium.com/max/1400/1*bEXRe0ap0xZcbPeYMliNXg.webp"></p><p>Probably the most well-known zkVMs at the moment are zkEVMs of Ethereum Layer2.</p><p><br></p><h2>1. zkWASM</h2><h2>a) zkVM Race</h2><p>Remember the first step of building a zkVM? There’re plenty of choices of instruction sets.</p><p class="ql-align-center"><img src="https://miro.medium.com/max/1400/1*AdJO0ppKv3U-rNi0F95y7w.webp"></p><p>I concluded in <a href="https://mirror.xyz/msfew.eth/Yl64OK3lLG48eJpVB3GxqFEhmWOm6yMlAo9sc1VrQP4" rel="noopener noreferrer" target="_blank">zk, zkEVM, and zkVM</a> that “General zkVM is the future of Web3.” which is what the mainstream instruction set represents.</p><p>The reason for the popularity of zkEVM is that the teams are leveraging EVM’s importance in the blockchain developer community.</p><p class="ql-align-center"><img src="https://miro.medium.com/max/1400/1*WqMLfY8Dvx9Fl8Zm129XbA.webp"></p><p>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.</p><p><br></p><h2>b) WASM</h2><p>WASM is essentially a binary instruction format for a stack-based VM. What makes it different from others are:</p><p>1. Embraced by Web:</p><p class="ql-align-center"><img src="https://miro.medium.com/max/1400/1*h-bfVYtbJWspPgT4sP7bMw.webp"></p><ul><li>WASM is <a href="https://www.w3.org/2019/12/pressrelease-wasm-rec.html.en" rel="noopener noreferrer" target="_blank">one of the only 4 languages of the Web.</a> The other 3 are HTML, CSS, and JavaScript.</li><li>WASM is <a href="https://webassembly.org/roadmap/" rel="noopener noreferrer" target="_blank">shipped into all major popular engines of the Web</a>.</li><li>WASM enables any programming language to be run in the browser context.</li></ul><p>2. Universal format:</p><p class="ql-align-center"><img src="https://miro.medium.com/max/1400/1*h-bfVYtbJWspPgT4sP7bMw.webp"></p><ul><li>WASM is a compilation target for any programming language. WASM ecosystem has compilers like <a href="https://github.com/emscripten-core/emscripten" rel="noopener noreferrer" target="_blank">emscripten</a> (LLVM-to-WASM).</li><li>WASM is <a href="https://aws.amazon.com/docker/" rel="noopener noreferrer" target="_blank">a virtualization container that runs code in a standardized way</a>. The founder of Docker <a href="https://twitter.com/solomonstre/status/1111004913222324225" rel="noopener noreferrer" target="_blank">even says</a> he wouldn’t create Docker if WASM existed then.</li><li>WASM is <a href="https://wasmer.io/posts/wasm-as-universal-binary-format-part-1-native-executables" rel="noopener noreferrer" target="_blank">a universal binary format</a>. It means it can create native executables for any platform.</li></ul><p>WASM is <a href="https://mp.weixin.qq.com/s/MlNDNOChyWAJkeNbts2aIQ" rel="noopener noreferrer" target="_blank">benefiting the Web, cloud, programming language, and gaming by</a>:</p><p><br></p><ul><li>Accelerating media decoding with <a href="https://github.com/brion/ogv.js/" rel="noopener noreferrer" target="_blank">ogv.js</a> or any other performance-sensitive modules</li><li>Creating Rust and Go Web frameworks of <a href="https://github.com/yewstack/yew" rel="noopener noreferrer" target="_blank">yew</a>, <a href="https://github.com/seed-rs/seed" rel="noopener noreferrer" target="_blank">seed</a>, <a href="https://github.com/hexops/vecty" rel="noopener noreferrer" target="_blank">vecty</a>, and many more</li><li>Shifting cloud-native and serverless application paradigms with <a href="https://wasmer.io/" rel="noopener noreferrer" target="_blank">wasmer</a>, <a href="https://wasmtime.dev/" rel="noopener noreferrer" target="_blank">Wasmtime</a>, <a href="https://wasmedge.org/" rel="noopener noreferrer" target="_blank">WasmEdge</a>, and many more</li><li>Boosting emulator performance, including <a href="https://github.com/torch2424/wasmboy" rel="noopener noreferrer" target="_blank">wasmboy</a>, and <a href="https://github.com/koute/pinky" rel="noopener noreferrer" target="_blank">pinky</a></li><li>Creating game engines of <a href="https://github.com/kripken/ammo.js/" rel="noopener noreferrer" target="_blank">ammo.js</a>, and <a href="https://github.com/defold/defold" rel="noopener noreferrer" target="_blank">defold</a></li><li>Creating new programming languages of <a href="https://github.com/AssemblyScript" rel="noopener noreferrer" target="_blank">AssemblyScript</a>, <a href="https://github.com/ballercat/walt" rel="noopener noreferrer" target="_blank">walt</a>, <a href="https://github.com/grain-lang/grain" rel="noopener noreferrer" target="_blank">grain</a>, and many more</li></ul><p>In addition, WASM is <a href="https://blog.devgenius.io/webassembly-wasm-in-blockchain-f651a8ac767b" rel="noopener noreferrer" target="_blank">widely adopted in the blockchain space</a>:</p><p><br></p><ul><li>Polkadot <a href="https://www.parity.io/blog/wasm-smart-contract-development/" rel="noopener noreferrer" target="_blank">believes Wasm to be the foundation of decentralized systems development</a>. They are all in WASM, and <a href="http://troubles.md/why-wasm/" rel="noopener noreferrer" target="_blank">consider it lesser evil than EVM</a>.</li><li>Cosmos visions <a href="https://cosmwasm.com/" rel="noopener noreferrer" target="_blank">CosmWasm</a> as the main engine for building robust dApps on secure, multi-chain smart contracts.</li><li>Near sees <a href="https://www.youtube.com/watch?v=s6-DtXFLeyE" rel="noopener noreferrer" target="_blank">WebAssembly is at the core of the decentralized Web</a>. Near <a href="https://madewithwebassembly.com/showcase/near-protocol/" rel="noopener noreferrer" target="_blank">uses AssemblyScript as its language of choice for smart contracts</a>.</li><li>Even though Ethereum is not using WASM, <a href="https://github.com/hyperledger/solang" rel="noopener noreferrer" target="_blank">Solang</a> can compile Solidity code into WASM (EVM → WASM).</li></ul><h2>c) zkWASM</h2><p>zkWASM is a zkVM its whole virtual machine of WASM is written in zkSNARK circuits.</p><p>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.</p><p>In recent years, WASM has been <a href="https://pradeepl.com/blog/webassembly-from-browser-to-cloud/" rel="noopener noreferrer" target="_blank">moving beyond the browser to cloud</a> and blockchain. Now, zkWASM is bringing a new paradigm of zkVM + WASM to the blockchain context, solving crypto-native security, trust, and privacy issues.</p><p class="ql-align-center"><img src="https://miro.medium.com/max/1100/1*jvLeUhrTHjHBjoiCho-tug.webp"></p><h2>2. zkWASM Advantages</h2><h2>a) zkWASM is Adoption</h2><p>The reason why zkEVM will gain a massive advantage in the ZK war because <a href="https://twitter.com/toghrulmaharram/status/1595503593192362007" rel="noopener noreferrer" target="_blank">EVM is the most commonly used distributed runtime environment for smart contracts</a>.</p><p>zkEVM之所以会在ZK战争中获得巨大优势,是因为EVM是智能合约最常用的分布式运行环境。</p><p>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.</p><p>I mentioned in <a href="https://mirror.xyz/msfew.eth/JJudP_Kf-IS6VhbF-qU0BUor1Ap6SFEb0TzYOHZ34Rc" rel="noopener noreferrer" target="_blank">a previous post</a> that Polygon zkEVM is the zkEVM solution I’m most excited about. It’s also due to adoption.</p><p>Polygon zkEVM may not be the most “<a href="https://vitalik.ca/general/2022/08/04/zkevm.html" rel="noopener noreferrer" target="_blank">Type-1</a>” 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.</p><p>Well, the potential adoption that zkWASM has will be unprecedented.</p><p>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.</p><p class="ql-align-center"><img src="https://miro.medium.com/max/1400/1*CrDsLaEEn-eKwwXDUrPACQ.webp"></p><h2>b) zkWASM is Composability</h2><p>In the Web3 world, composability pairs with open source, allowing for exponential increases in productivity and innovation. <a href="https://twitter.com/cdixon/status/1448528513745760261" rel="noopener noreferrer" target="_blank">Composability is to software as compounding interest is to finance</a>.</p><p>In the Cairo VM environment, we see the <a href="https://github.com/sayajin-labs/kakarot" rel="noopener noreferrer" target="_blank">Kakarot zkEVM</a> being built; in the RISC0 RISC-V zkVM, we see <a href="https://github.com/Sovereign-Labs" rel="noopener noreferrer" target="_blank">Sovereign Labs</a> 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 <a href="https://github.com/hananbeer/evm2" rel="noopener noreferrer" target="_blank">evm2</a> and <a href="https://github.com/oguimbal/HyVM" rel="noopener noreferrer" target="_blank">HyVM</a>, even <a href="https://twitter.com/high_byte/status/1576576874012348421" rel="noopener noreferrer" target="_blank">Python Interpreter in EVM</a>.</p><p>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.</p><p>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.</p><p>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.</p><p><br></p><h2>c) zkWASM is All-around</h2><p>Remember zk is about four usages of security, scalability, interoperability, and privacy.</p><p><br></p><ul><li>zkWASM can take advantage of all those aspects.</li></ul><p>Remember <a href="https://mirror.xyz/msfew.eth/nA0_f-ef_dN1tE0DACDi6TLN9EM4hJn27H7SHYKX0qU" rel="noopener noreferrer" target="_blank">Crypto-Native DApp Architecture</a>.</p><p><br></p><ul><li>zkWASM is the only optimal solution for the off-chain centralization and security issues of dApps (RPC, Indexing, Oracle, Automation).</li></ul><p>Remember how zkWASM’s WASM runtime is a huge part of Web.</p><p><br></p><ul><li>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.</li></ul><h2>d) zkWASM is Decentralization</h2><p>Hyper Oracle’s priority is to enable end-to-end decentralization for all DApps. We will also make our protocols maximally decentralized.</p><p>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 <a href="https://github.com/ChainSafe/mina-rs" rel="noopener noreferrer" target="_blank">mina-rs</a>, you can click on a link and become a node to participate in the network and mining.</p><p>Why is this important?</p><p><br></p><ul><li>Permissionless: Anyone can be a node. There’s no centralized sequencer or beefy server requirement for the node.</li><li>Sovereignty: Anyone can run their own node. It helps privacy and prevents censorship.</li><li>Diversity: Anyone can contribute to the client and geography diversity of the network. This is a problem that even Ethereum is trying to fix.</li><li>Performance: Anyone can boost the performance of the network.</li></ul><p>Also, maybe <a href="https://github.com/piranna/wasmachine" rel="noopener noreferrer" target="_blank">run zkWASM in your washing machine</a>?</p><p><br></p><h2>e) zkWASM is Performance</h2><p>There have been voices suggesting that general zkVMs may have worse performance than purpose-built zkVMs. But this is not true.</p><p>The <a href="https://kelvinfichter.com/pages/thoughts/hybrid-rollups/" rel="noopener noreferrer" target="_blank">better practice</a> is to build a generic solution like zkWASM first and then optimize it. We should not use tactical diligence to cover up strategic compromises.</p><p>It’s a simple choice between giving up the enormous benefits of WASM, or saving the additional performance optimization.</p><p>For optimization, there are very many angles to cut through, and each point can lead to huge levels of optimization mentioned by <a href="https://mirror.xyz/labs.taiko.eth/w7NSKDeKfJoEy0p89I9feixKfdK-20JgWF9HZzxfeBo" rel="noopener noreferrer" target="_blank">Taiko</a> and <a href="https://www.youtube.com/watch?v=r-tlqdO1bRs&t=573s" rel="noopener noreferrer" target="_blank">ZKonduit</a>:</p><p><br></p><ul><li>Prover-level optimizations like Hyperplonk and Caulk</li><li>ZKP-specific hardware (FPGA/ASIC)</li><li>Composition of proof systems</li><li><a href="https://docs.google.com/presentation/d/1eHVzLPRIEziCJ_oDuJG0yZ-5klNj_daqioC0UaGDaiw/edit?usp=sharing" rel="noopener noreferrer" target="_blank">General optimizations & tricks</a></li><li>Programming-wise tuning</li><li>Aggregation and recursion</li><li>Fusion and abstraction</li></ul><h2>3. Who is Using zkWASM</h2><p>Hyper Oracle is partnering with <a href="https://delphinuslab.com/" rel="noopener noreferrer" target="_blank">Delphinus Lab</a> to explore the cutting edge of zkWASM in indexing and automation middleware protocols.</p><p>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.</p><p>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.</p><p><br></p><h2>4. What is zkWASM</h2><p>Finally, let’s summarize what zkWASM is.</p><p>Architecture-wise, zkWASM is:</p><p><br></p><ul><li>zk virtual machine</li><li>WASM emulator</li></ul><p>Feature-wise, zkWASM means:</p><p><br></p><ul><li>Adoption</li><li>Composability</li><li>All-around</li><li>Decentralization</li><li>Performance</li></ul><p>Vision-wise, zkWASM is The Next Chapter of ZK and zkVM.</p>