Efficiency and Innovations: The Journey of zkVMs From Today to Tomorrow | Daniel Tan - Ora
Ethereum Denver·Wed, Oct 9, 2024, 12:00 AM
The presentation is designed to guide the audience through the advanced domain of Zero-Knowledge Virtual Machines (zkVMs), focusing on their current development and potential future advancements. The aim is to dissect and clarify the complexities of zkVMs, thoroughly examining their design choices, various implementations, the necessary trade-offs, and performance benchmarks. This detailed analysis is intended to engage not only professionals in the field but also enthusiasts and learners eager to deepen their understanding of blockchain technology. The talk will touch on a comparative analysis of existing technologies like the Ethereum Virtual Machine (EVM) and zkEVM. This comparison will underscore how zkVMs might offer enhanced flexibility, simpler optimization processes, and a wider range of applications. The discussion will emphasize the transformative potential of zkVMs in reshaping the blockchain landscape, making it more accessible and potent for developers globally. Additionally, the presentation will delve into a thorough analysis of the advantages and drawbacks of zkVMs. It will explore the underlying design principles of these systems, their diverse implementations, the compromises they entail, and their performance metrics. The talk will also highlight recent developments in this field and discuss innovative methods to further augment the efficiency of zkVMs. APPLICATIONS FOR ETHDenver 2024: #YearOfTheSpork ARE OPEN APPLY NOW https://ethdenver.com/apply
Transcript
[Music] good morning everyone my name is Daniel 10 from Aura protocol uh it's the AA protocol that got mentioned uh in the last session um today I'm going to present uh a topic on ZK VM from today to tomorrow so first I will provide a op oversimplified mental model for you to con con struct zero knowledge proof so in essence build a z knowledge uh proof system just need two step first you need to build a snark or a stark system and the second step is to add ZK to enable the Privacy features and uh let's see how to build a modern ZK snark so a typical modern uh snark has four pillars arisma uh C uh circuit Aris matiz polinomial R polinomial commitment scheme and the optional folding scheme so you can see the uh zik proof system itself is quite modular and U uh under each pillar there's several option that for us to choose from so for example we can choose plish with the uh cion testing polinomial ROP and kzg to build a ZK snark and you can also try different uh composition to build a a different snark or a stark system we also need to build a virtual machine a virtual machine is just a a program that emulates a physical computer that runs another program so now we have a ZK proof system and we have a virtual machine we we have a ZK virtual machine so in Z so in simple ter term a ZK virtual machine is just a virtual machine that implemented as a circuit for a ZK proof system so to build a virtual machine you can also choose from uh several like instruction set so there uh we in this talk we are going to focus on the mainstream instruction set which can be considered as a general purpose ZK VM so uh inside of the main instruction set we have wome risk 5 and meeps so every one uh every one of them has a richer ecosystem than the web3 ecosystem as as a whole uh so so by building a uh zvm with the mainstream instruction set we have we can enjoy their richer ecosystem and uh the purpose of uh uh General general purpose uh ZK VN is to be able to generate proof for any program in any language by uh by any program I also mean uh another ZK VM so we can so it's very interesting that we can build another zvm inside of ZK VM and also it's like it's also relative simple in uh in a sense that we can use uh a relative small set of constraint to describe the whole VM and uh in this era with Sor and incoming AGI uh zvm can definitely help us to ensure the accountability for AI generated content so with so many uh benefit that zvm brings to us the only cons is the performance issue but luckily we have three major way to tackle this problem so the first is we can uh try to apply appy some optimization tricks uh under the current architecture the second is uh we can continue to um research on novel techniques and better Frameworks to build zvm to make it faster or the third one is Hardware acceleration so if we can solve all this performance issue a perfect zvm will be the adoption for the web 3 so according to this uh report by developer Nation the the number of web three developers among all the developers in the world is actually less than 0.1% uh in a word with a perfect uh zero knowledge uh Zer VM we can Target all all the developers in any language and supercharge their uh program with the power of the uh ZK let's also talk about a little bit about the current landscape we start to see the commercial DK VMS coming out after 2021 uh in the last in the last uh Market cycle we can see a lot of ZK VMS coming out tailored towards um proving the execution of evm AKA zkm race and Al we can see uh def lab and uh risk zero is leading the development of general purpose ZK VM for wasam and the risk five instruction set in this current uh Market cycle we can see uh on the on the right hand side there's a burst of ZK uh ZK VM projects coming out some of them use uh novel techniques from the research to try to build a better Z zvm and some of them are PV from the other other track and some of them are trying just trying different uh combination of the current stack but there is definitely more projects coming out and this is just the start of the zvm zvm race so let's dive in and see um how does the zvm work so similar to how does ZK evm work so where you can only uh write programs since solidity and get it compiled uh to VM by code and uh send it to uh ZK VM and get a proof for the execution so for ZK VM you can actually write any program in any language um and get a proof for the uh the for the execution this sounds a little bit too too good right so you you H you must to have a cost for this generality so the cost is uh proving inside of zvm is generally 10 times to 100 times slower than a specific purpose uh VM so under current uh architecture the optimization strategy is Main in two folds first we can do we can apply some general optimization tricks on a language level and second is we can adopt a hybrid approach so I will use uh uh event proof flow to illustrate the op optimization strategy I just mentioned so to prove uh the target event is actually include in the in the block first you need to do is to initiate a RPC call from your note provider to get the decoded uh R RP receipts so uh next you need to do is to apply RP decoding on every uh encoded reist you have and then get a ro receipt so for R receipts you you can apply some filters and U and to process it to find your target event but in order to Pro to prove that uh your event uh your target event is actually included in this block you also need to construct uh entire High m PT tree and if the constructed uh receip route is actually match with the receip route in the block then you can you can be confident that the uh the event is inside of the event uh inside of the block this is a example of a provable program that you can just throw into ZK wome and get appr proof but this uh this will work for historical access uh but this will not probably not work for uh if you want to access the recent blocks because it's going to be pretty slow so we have we need to apply some optimization strategy on this so the first strategy is the general approach this is a utility function that uh we encountered during uh the event proof flow uh the uh the function is called Hax to uh B to hacks and uh basically we just replace some of the plain string joint with this stream method called charod at and to remove some IM unnecessary immediate um process here is the result we can see there's a very significant uh Improvement on the performance uh particular on if the bite draining is very long so next is the hybrid approach zik wome is uh providing this host VM architecture so basically host VM is another VM inside of ZK wsom and I believe there's some similar architecture uh for other ZK VM as well so the the basic idea is if some operation is considered as a bottleneck we can replace uh the operation with a host circuit so in event proof what can be consider what what uh kind of operation can be considered as a bottleneck so we have a lot of we need to De um decode every uh encoded receipt so we have a lot of RP decoding operation and in inside of RP decoding we also need to do a lot of C P cashing algorithm so those are crypto Primitives that are considered uh very hard for a generous purpose ZK VM to do so we can write some host circuits for for um and also zik wome is providing this uh continuation Batcher so we can we can batch all the host proofs and the gas proof together to generate the final proof and I'm also preparing uh like a sequence of tutorial to teach the developers on how to write the host circuit so next I'm going to present some Novo use case that zvm brings so the first use case is a programmable ZK Oracle so similar to the event proof I just described our protocol is able to to prove the access to all the historical data uh on ethereum and with the power of zvm uh R protocols computational logical entity is able to uh to perform complex and arbitr arbitrary computation uh and get the proof uh with zkv Z KVM the next use case is a provable game so play games is building approv game framework with unity and ZK wome with their uh game engine native and ZK server approach so under this framework game developers can continue to work um work on their favorite environment like C uh C shop and uh continue to develop their games there uh the game code Inc sharp will be coupled into two parts the first part is is core game logic and the second part is the rest of code both of the parts will be uh compiled into wsom by code and uh only the uh core game logic will run in ziki wassom wrong time and zik wassom will generate proof for the execution trace and uh but the rest of logic will run run in your local c c shop wrong time so you don't have latency uh for the rendering and stuff so this is a very a very simple PVE uh tower defense game where the enemy comes in waves so first you need to do is so in this setup the map map setup is considered as a call logic what you will need to do is to confirm uh your uh map setup and commit the map setup Z chain and for the rest of the the waves you don't you don't need to um do any thing in Z wasm and you can just run in in a local run time uh before the next wave if you want to change this the current setup let's say if you want to change the coordinate or upgrade the turret then you need to commit again otherwise you don't need to uh to commit so in this approach uh you can enjoy like near native near web web to game uh gaming experience next is ZK compiler so ZK Go is is a ZK compiler for the go language go language is considered as like uh particular important in the crypto space because the most popular Isam client uh is implemented in the go language and uh as well as the layer 2 op client so there is a very interesting use case that you can actually compile the uh layer 2 op clients into wassom by code and get it approved in ZK wassom so this is act as a ZK processor Co processor for the uh op stack so by by creating this ZK for proof which is a validity proof with immediate finality you can actually shorten the waiting period of um of optimistic tax stack and also you can use it to replace the multi interaction dispute game which can be sometimes very expensive also we've encountered some challenges for the ZK VM particular with the increasing popularity of AI cross crypto due to the incompatible number system so as we all know um AI use a floating Point uh number system that's why uh the AI model can be very powerful because he they can learn from the very little amount of the the gradient and the ZK system use a uh finite uh you work with a finite field which is essentially a fix Point uh number system very naive way is to present the floating Point number inside of thek circuit but this introduce uh like a a lot of extra variable and increase the comp complexity of this of the proving system and the the current approach is called quantization so quantization is basically means to map a continuous number into discrete number there's uh two approach for that so some some project is using U using a soft float which is essentially use software to emulate the floating Point inside of ZK system and another is called circuit conization this is just to scale up the floating number and apply a floor function so and so you will discard all the fraction fraction uh part of the floating point and uh this will in this this will cause the decrease of the accuracies uh for sure so we definitely we definitely need more research on this area uh to make uh to make it better so let's go back to the performance issue here is a novel approach that uh uh proposed by some uh ZK researchers at Z Z16 Z uh this is uh no uh this approach is called Joint and lasso and sometimes it also refers to look up Singularity approach the basic idea behind this is just to uh prove every instructions um user table lookups so this will uh increase a lot of efficiency in the in the system so all aspect of zvm is proving so quickly uh just there's just uh so just several days ago there uh there are two projects that announce that they can able to prove prove the game of Dome the Dome is a firsters shooting game and uh it's very uh it's considered as a very hard problems to prove in ZK VM system so this Mark as a very uh important milestone for the ZK VM to be able to um use in the industrial setting at a at a scale zvm is converging to a point uh that uh the uh the real use case will happen and uh is surely leading the wave of the next wave of uh massive adoption for web 3 uh thanks for listening this is this is all about my presentation and we are hosting a event on uh on 27th uh that's about the AI cross crypto uh you can scan the QR code if you are interested thank
Automatic transcript — names and jargon may be misspelled.