Marek of vlayer @ ZK Hack Meetup in Lisbon, 10 Oct 2024

ZK Hack Video Archive · 10 Oct 2024 · 22:28

Marek Kirejczyk presents an update on vlayer at the ZK Hack Meetup in Lisbon on 10 October 2024, covering what the team has been building over the previous few months. He also introduces the vlayer closed alpha program. The meetup was organized in partnership with vlayer and RISC Zero, and this is the first of its two talks.

Speakers

Topics

From ZK Hack Video Archive, hosted by ZK Hack.

Transcript

[Music] all right welcome it's so great to be here very excited um there's a few interesting pinks I would like to tell you about today uh who heard the name vayer before by the way right nice for the video reference half of the half of the people so so yeah to today is a very special day and for me because I'm going to lift a little bit of veil of secrecy what we're doing at vayer we've been talking a little bit about General thing that we're building but we never show publicly kind of the code Snippets or how that's all going to work so it's

going to be for the first time and because today we're going to announce our close Alpha program so if you like what I'm going to see what I'm going to show you today you're going to be able to get out access and play with it all right so yeah and it feels perfect like the last event of the week the energy is a little bit lower but it kind of you know lets you digest a little bit and kind of prepare mentally for the next intense event that is coming soon good so what we've been talking a lot is we are verifiable data infrastructure so what does it mean we want to bring

data on chain from various sources and the various sources the main fre sources we would like to start with are web proofs onchain proofs and email proofs you might heard different names for them there is quite a mess with the naming TLS noty ZK TLS it's what web proofs are often called onchain proof also storage proofs uh email proof ZK email so you're probably familiar with at least some subset of those names um but we would like to bring them in a different way that anyone ever tried before uh and that starts with a new execution model new and old so the new execution model Works in a following

way we're bringing all the data straight to solidity smart contracts but to ensure reasonable computational capability and to ensure uh reasonable privacy we're going to introduce two new types of smart contracts one we're going to called prer smart contract and one we're going to call verifier smart contract so you probably most of you is is probably already uh thinking that might look kind of familiar to other things in the ZK space and um if you looked at blockchains like Mina or AO that might look even more familiar

who thinks it looks familiar all right so again roughly a half of the room so oh yeah one more one more question for reference how many people write something in solidity or at least kind of no solidity good enough to read okay that's even more than half of the room all right so that's approv of smart contract so for V majority of you already know this is solidity it's a normal smart contract you can compile with your fa tooling whether it's Foundry hard Hut or whatever else you is your favorite one and the only big difference well okay there are two big differences versus any

other smart contract first it's going to inherit from the prover and second the first thing that it's going to return is going to be a proof we don't need to think much about what approve is now just yet but it's the only two requirements for the smart contract to be aoer smart contract and in fact it doesn't really need to even to be aover because that's only for getting some extra functionalities in F we could even skip on that part and everything else is pretty much like in the smart contract well there is one more little detail here we have this set block over there so that's going to actually make that that little feature

makes it so when we require in the next in the next line when we're going to ask who the owner of the specific uh board ape is it's going to this specific query going to not be related to the current block being mined on the blockchain but to a historical block 12292 922 so yeah let approv our contract and um inherit yeah and the most important thing the Pro Smart contract is intended to be executed off off chain so it's not being executed on L1 or L2 but it executed offchain on vayer

Noe uh by default all the inputs are private not intended to be published on the blockchain and all the everything it returns is intended to be public on the blockchain uh and no usual gas fee supplies as expected it's going to also have some new superpowers that I'm going to talk about a little bit later here is a verifi smart contract kind of is like any other smart contract there are a few differences though it inherits from verifier and the reason it it inherits from verifier it has this only verified modifier and only verified modifier you might be already guessing what it does it makes sure that the data passed to

the smart contract was verified which was the result of execution of the pr is verified right so the first argument on the only verified is a smart contract the Pro Smart contract so we deploy the Pro Smart contract on chain even though we don't intend to execute it on chain but we need some s single source source of Truth and it happens that blockchain is pretty nice single source of Truth now so the first argument is the address of the contract and the second is just a function or what we use in the solidity which is function selector and that's it we also need to pass the first

argument it always needs to be approv so only verified doesn't really we don't we don't pass proof to only verified because only verified can get it from message data but what only verified does is look at the all the arguments of the claim and making sure the are result of the execution of the prover right so just for the reference we have two arguments proof and address and if we go back you see the return the two things that were returned by the contract will prove an address right so the requirement is prover needs to return exactly what verify takes on the argument is it all obvious now I'm

not going too slow some people are like yeah yeah yeah no Okay good does that make sense is that easy I think it's easy hope it's easy yeah so verifier inherits from verifier contract validate computation by prover with only verified and executes on easy peasy So today we're going to talk about two out of three data sources specifically about web proofs and email proofs we're going to leave the onchain proofs which are the most interesting a little bit later this month we're going to reveal more details about that so web

proofs um I think there was there was a lot of uh noise about web proofs in recent weeks uh around Twitter and in few other places but I think it's really good to when we're talking about something to make those tangible use cases so IE I prepared two use cases for you today one is real world assets so how can we improve real world assets with storage proofs imagine you have a token that you would like to issue that represents a real asset in the real world whether it's a stable token gold some kind of security us bonds you name it imagine you want to

issue such a token well first an application can require to generate a proof and when you click generate proof you jump into the other application the other application could be like your revolute account your bank account whatever else and here's a special plugin the plugin kind of um gives you an interface that all that make sure you follow the steps to get to the right page and when you get there you can click generate proof and when that happens you can go back to this application the proof is Generation generated and you can issue real word asset obviously that only solves House of the problem because it only makes sure you have money on the account when

you issue asset and then the question is what happens the next day so of course some routine check is required and we never going to have fully permissionless real assets but we might make it trust minimized which is the goal and a second example that probably a lot of you already heard about is web to web free market so that was originally uh well innovated on by great ZK P2P team and in this example we're going to try to yeah web to web free markets by the way that can be a lot of things ZK P2P specifically work on on ramping so exchanging Fiat money for uh for tokens and more Rec more recently on domains

but it could be any Financial instrument you could buy shirts in the companies you could trade virtual uh items in the games so I I think that's one of the huge Industries that's going to happen in the upcoming years there's a lot of annoying details that needs to be figured out along the way but it's definitely doable so in this case let's say you want to swap you want to buy uh you want to buy 200 usdc for 200 boom you go to your revolute account you do the transfer you go to the right page you generate approve and someone on the other side uh sends you tokens back good so there there were two examples

I'm going to I'm going to kind of show how that would look as in the prover uh that's going to be a simpler example than the two I talk before so that's going to be just trying to obtain your Twitter name from the from the web proof so with v layer you can basically do it like this just create a function that takes a web proof web proof can be obtained by the plugin and you can verify it against specific address so you know it came from this specific address and nothing else and then you can use a special pre-compile that we get that we're adding to provs which can parse Jason boom three lines of code and you're done yeah this is how it looks into so I

skip a lot of little details here like there's a lot the solidity is full of those little modifier Fields but this is the real example that is working that you can download from our repository yeah and you we have the proof here right that was missing on the other slide yeah so and web proofs that gives you private attestations of the private web data Json precompile and web browser extension everything working out of the box in layer okay and how do we obtain a web proof well we created a JavaScript API n SDK

where you say you want to create a web proof you give a logo of your application and all the steps like you need to go to this page first then make sure that that the user navigates to a specific specific place and then there is like an authorized steps you know might be a few steps might be a lot of steps might be one authorization might be multiple so this is actually copy paste from the same working example uh so that's not even like simplified or anything for presentation and this is how it look like uh the uh in real life plugin and all the different stages is

kind of go go good so that was web proofs now let's move to email proofs uh yeah so I guess that again I will try to make it as tangible as possible so one one common example when it comes to ZK email is wallet email recovery especially now that account abstraction is getting a lot of traction that becomes more and more attractive way to interact with wallet so here's the flow it's quite simple but it's tricky to get it right on the first try but you need to start on the website when you

say hey I want to recover my wallet let's say I'm Elon Musk this is my new address that I would like to that I would like to control my wallet this specific application is sending me an email and I hit reply so usually when I in the web to I would hit on the link but it's email so I hit reply add yes or confirm or whatever click Send it goes to the server and the rest happens magically right and you know email has a very strong security guarantees meaning that we can verify its digital signature of mail providers and that's something we tend to trust a

lot uh and I would also like to touch on the real Weare asset example because looking at real weather assets from the web proofs and email proofs really help us emphasize on both differences and similarities of two approaches so in realware asset example we would need to start an admin panel on some kind of application and that would in our let's say real assets admin panel and we would need to go to uh our mail client find the right mail and using the using the plugin we we could generate the proof right so those two cases are

very asymmetrical because one I just sending an email and that's really easy the other one is installing plugin but by the way in web fre we're really good in installing plugins on on um user browser so yeah boom We generate a proof and we can submit proof and go with the flow um yeah so this is this is an example code for Z email we start with a main function on the prover it has a we we can pass the whole unverified email we can verify email with a single solidity call and then we can start we can start um querying the email and I don't think it's on the slide but there

is a regx pre-compile so you can parse regular Expressions yeah and that's uh so that's a simplified version that's a real version in our example yeah so a few a few things perhaps worth mentioning is we probably want to pass the Target wallet and return it as a public output because otherwise someone can front run our transaction and take our proof and assign it to himself we of course need to return proof and we can get a little bit of privacy by submitting a hash of the email instead of the email itself

yeah yeah so how do you how do you work with uh how do you work with v layer well it's really simple you download V layer you do V layer app install V layer application and you do V layer in it and you can add a template and start with any of those examples we discuss and few others and that's going to install that's going to do a standard Foundry project where you can compile your smart contracts with with Forge and you can do all the things you do with Forge but additionally it's going to install this vayer client that allows you to run execution of prover and we prepared a book so there is everything all the examples all the

little details are explained so this is available uh this is available now yeah and I talk about few things we're doing and a few things you can you you will be able to use with vayer I thought it's worth mentioning all the things you don't need to think about or even know about when you're using V layer so you don't need to know anything about math and ZK you don't need to know what prime fields are or what elliptic curves are or what the circuits are that's one thing you don't need to know about you don't need to learn any new language if you're already a web free project you probably have someone who

already knows solidity you probably have an auditor that is already auditing your solidity and you already have a continuous integration setup compilation process you know how to write tests and all that stuff uh when it comes to verifiable computations you don't need to know what the dkim records are on email or you don't need to know who is the notary or what are multi party computations uh I didn't talk much today about storage proofs but if you were to use storage proof stuff it's all in the book so if you get a if you want to get a nice Early Access you will be able to see how we do it you

don't need to know what the storage proofs are you don't need to know what are the different fields in the headers what are slots on solidity smart contract and you don't even need to know what the ABI encoding is because everything just works out of the box um yeah and when you look at a lot lot of those ZK projects you're going to see those architecture diagrams here are some examples of architecture diagrams you get to read in the introduction to a various different projects so that's our architecture diagram um yeah and it's exclusive offer for the people here today with us up

until the video going to go online which I just discussed with Gaylord going to take a week or two at least I said don't me maybe maybe a little bit longer so yeah this is small uh but important announcement there's an alpha program so if you like to be the first to play with it give us feedback see if it works or if it's a sham just scan the QR code or type the link fill in the form and we'll be sending invitation tomorrow and uh at the beginning of the next week um yeah I just going to mention there are other goodies we've been working on

very hard uh so we've been working on the web proofs report that is now public it explains very if if you don't know yet what the web proofs are or have a general idea but or you you're you have friends that have general idea but would like to understand a little bit more maybe in the product or you know maybe not so deep in the ZK then there is a great report that explains it in very detail but skipping a lot of cryptography jargon there is an email proofs rep report coming in a week or two and onchain proof or storage proof uh just two weeks after that and so feel free to yeah feel free to scan

this one as well if you would like to get access to that I also going to mention we have a blog post so machic is here with me here uh we have a block we have a a few white Papers written that explains deep cryptography or security assumptions of different approaches to different web proofs so that's an in-depth analysis that are that were not done by anyone before us so we really get deep into all this stuff and we want to make sure that anyone who wants to be convinced that this stuff is working have all the knowledge required to understand how it all works under the hood yeah

and feel free to follow us on Twitter as well and see uh to get updates on all the things we're going to publish in upcoming weeks thank you [Music]