# Build Your Own ZK Email Proofs, ZK Email Login, or ZK Account Recovery Module in 1.5... | Devcon SEA

- Channel: [Devcon](https://streameth.org/devcon)
- Date: 2025-10-07
- Duration: 1:22:26
- Watch: https://streameth.org/watch/yt-UsH8zwjcCD4
- YouTube: https://www.youtube.com/watch?v=UsH8zwjcCD4

## Description

We explain how to use a variety of zk email related SDKs, creating new proofs only using Typescript or Solidity, whichever the developer is most familiar with. We will define new proofs in 5 minutes via sdk.prove.email, complete solidity zk email verifications via our generic relayer, and ideate your own projects!

Speaker(s): Aayush Gupta
Skill level: Beginner
Track: Developer Experience
Keywords: Developer Infrastructure, Anonymity, ZKP, 2FA, Account Abstraction, Social Recovery, zkemail

Follow us: https://twitter.com/efdevcon, https://twitter.com/ethereum, https://warpcast.com/devcon
Learn more about devcon: https://www.devcon.org/
Learn more about ethereum: https://ethereum.org/ 

Visit the https://archive.devcon.org/ to gain access to the entire library of Devcon talks with the ease of filtering, playlists, personalized suggestions, decentralized access on Swarm, IPFS and more.

Devcon is the Ethereum conference for developers, researchers, thinkers, and makers. 
Devcon SEA was held in Bangkok, Thailand on Nov 12 - Nov 15, 2024.
Devcon is organized and presented by the Ethereum Foundation. To find out more, please visit https://ethereum.foundation/

## Transcript

[Music] l [Music] [Music] hello hello sorry for the delay uh we had a different plan to start but we we will show a few things which are one is account recovery uh we have a generic relayer to send transactions on chain and one other thing is we have a registry which we will start with so I was plan to do it later but yeah um so let me show you wait one okay I'm sorry red so anyway hi I'm Dimitri from ZK email and I would want to show you first the registry we built uh can you see that I'll make it bigger right sorry so what you can do with this registry is basically you can create a blueprint which will be uh like a blueprint for what you want to prove about an email what you want to show and we will in the background create a ZK circuit and with this you can then create proofs about emails with an ZK so uh if you go to registry. zk. email you can check out the site um and we show code in a bit but basically what you will do here is uh yeah log in first if you want to create you don't have to log in but if you want to create the blueprint you'll have to log in with GitHub uh let's try this out or actually I'll show one existing one to make it this part easier so obviously you can create uh any proof about any email but I will show you a simple example which is just proving that I'm part of a residency so basically you would come here put some inputs can upload the email to test which I will do a residency email and you will fill in some information so Center domain the thing is we we have this chatbot so hopefully it works because what you actually have to do is create a Rex uh which would look like this in the very end you would add some values and what you can see is now if I want to prove something about the header of the email I would select like the header um to the max length and write this reic um definition so this is the part where our chatboard will hopefully help it's quite new so please give us feedback if things are not working but in this case what I want to do is I will look for a welcome text in the header and say I don't want to reveal this and the next part is I want to reveal this so I want to reveal I'm part of this residency with this text so you can do all kinds of proofs let's imagine like for example you want to um create like a reimburse platform which someone's building and you want to create proofs about uh Uber receipt so what you would do is you would prove uh you would prove the sender is Uber and you would find the the like the amount of the receipt from Uber and then you can prove automatically hey this is the amount of what I uh the receipt I got from from Uber and then you can like do automatic reimbursement from that for example and yeah I will skip this cuz right now this uh like creating this circuit will take a few hours so if you want to try it out try one existing one for now um yeah after you create it it will appear in the homepage sync so two things you can do you can first of course just create proofs on the website with this so I can upload my email or use a directed Gmail to connect and create like a proof locally um we'll take a few seconds but what's more interesting is you can now also use this in a SDK version [Music] so uh let me see yeah so there is a sorry can you actually can you see this so if you go to GitHub SL ZK email/ SDK typescript demo so sorry for the naming so basically this um I added a demo how you would use this in typescript so let's see if this finishes I don't know if it's the internet but I don't know if you experienced the kind of slow internet here as well oh yeah anyway so now we generated a proof uh you can look at the proof it will show you generate some output and so the email you can only see in local so we don't save any emails and if you want you can also we always deploy a verifier contract on chain so you can actually verify this proof how would you use this in a SDK I guess I have to make this bigger so if you if you clone this repo you will you will get this code so basically I just added a few examples here um like for like long running proofs and how to validate inputs before you use them but in this I'll just give you the short example so basically what we have here first what you need is like the blueprint you created the ID for this you can basically if you go to our website uh like all of these have like this um Slug and you can like just copy it and put it here so that's one already added oh sorry for these inlay hands that's a bit yeah uh anyway you would you just um first thing you do you import the SDK you initialize it so sorry for this but you can you will in future pass other options like if you want to actually create blueprints you have to pass an authentication this is where you actually get the blueprint you created by the ID so the one we have in the front end uh and from this you can create aover so we did this uh separately because in future we want to add client side proving so let's say if you build something like a whistleblowing platform you would you wouldn't want to do this server side so we're working on a Noir implementation so it will work front end anyway and all you have to do is then in the end pass in an email which I read here from a file and you will get the proof output let's actually see if this works uh so you have to I think I added the commands in the read me so I can uh short example so yeah it will proof it will wait for the proof and then it will give you the proof output the proof data so yeah that's basically it what you need to use a proving system of emails in your front end this currently only works in the browser no JS but still not for nextjs server side so you you can use it in like next ja front end but not yet in service side there's some weird issues we're working on with bundlers but yeah all right that's for the first demo um a will tell you a bit more General things about ZK email and then we will show you other demos thanks a lot cool um okay um okay so I think the way we're probably going to structure this now that you guys have a sense of like what is the registry and how does that work is trying to get people to sort of generate their own proofs and so um it's pretty big crowd but I think maybe what we'll do is like kind of um people will try to submit like choose an email from their inbox and we'll try to get everybody submit a blueprint to that registry so that you can Define new kind of approve and then we'll uh send you guys so the the repo he just showed of the SDK quick start to actually putting it into an app then we'll put up a QR code where you can like clone that repo and then start working on actually getting an appli around that um maybe just so so I can get like a sense of like where people are at their level like maybe raise your hand if you've like heard of zkl or like are familiar with zkl and like know roughly what like the the proof that we're actually making is okay something like half okay maybe we should also briefly reintro that and then um other thing is maybe uh raise your hand if after seeing that you feel kind of confident you go to the registry and make a proof of yourself um and if not we'll kind of come around and help okay so raise your hand if you feel confident with a registry demo um okay a handful of people Okay cool so maybe what I'm going to do then is I'm just going to briefly go over like what is actually the proof that we're making for the people who didn't uh manage to make it to our talk yesterday and then we'll uh we'll put like a guide up for how to use a registry and then go around and help people put up the registry proof okay does that sound good to folks sweet um okay so maybe just the very basics of like what it what even are we doing here um so the point is that all of your emails are signed according to this like Deon protocol so RSA signature of a hash of all the data in the email and what we want to do is prove some subset of this data on chain maybe you want to prove oh the subject of an email or the fact that you took an Uber ride for $10 or the fact that you got into some residency or something um so the point is uh zkl will let you prove this whole signature and then extract the information you want to extract so maybe you can extract just a two field or apply some reject to the body and extract some other selectively disclosed thing um and the point is is all these tools we've put together the registry SDK Etc make it very easy for you so you don't have to think about which ZK proof is happening in the background um the point is we can keep everything you don't decide to reveal private uh it's directly verifying the web to mail service and not some third party and you're verifying these on chain so we'll deploy we'll help you deploy like solidity contracts as well if you want to do that um for some examples I guess Dimitri already showed you the um the proof of residency one you can imagine something like you can build like a very Simple app where you can redact stuff from email and reveal it um The Hope is that all of you can build something kind of similar to ZK PTP with the knowledge you get here um one example of how zkp works is they take exactly this proof that we're going to help you guys Define of here's an email from my inbox they do specifically they do it for name cheep transfer emails and they extract the domain name that was transferred on name cheep and the fact that it came from name cheep and then they build a Marketplace on top of that right so now this lets you buy and sell name CH domains directly on train and so the hope is that we can kind of get you guys to the point where you've you've defined this kind of proof um and you have a say a solidity contract and now you can start building on top of that okay cool um yeah so maybe what I'll do is I'll I'll put up two QR codes uh for for the registry basically and we can kind of we can we can get folks going through this whole this whole sequence um and as people have questions like our team will kind of come around and also ask the neighbors next too like how you do this thing um but I'll put up okay so this is a specific QR code for the registry that you should go to um if you're going to do this on your laptop you should probably just type in registry. zk. um and then what I'm going to do is I'm actually also going to put a QR code to the uh the docs on the right side so that if you get lost you can just follow the docs and then you should be hopefully good um okay I'll give people a second to to scan this and go to the site and and then we'll we'll kind of try to walk people through now that you've seen like a demo of what it might look like we'll try to walk people through so everyone can do their own proof um okay so let me do uh um see so do you have doc then new registry H doc then reg no we don't have any we to anyway all right the same cool um okay so the first thing we want I'll put this QR code back up um okay cool yeah this looks pretty good okay so the first thing we want folks to do is find an email from your inbox you want to make a proof of it can kind of be uh you know any email but it should have some data you want to parse out of the subject or body so I'll give people like I don't know a few seconds to to go to their inbox and find some some interesting email that you want to make a proof of and then we're kind of going to go through actually like everyone should be following through on their own computer like trying to make this proof themselves um cool maybe in this case I'll I'll try to use this email as an example okay and then do folks kind of want to walk around and then make sure people are like finding emails from their inbox um sweet okay I'll give people like 30 seconds to search to their inbox finding email um okay maybe raise your hand if you found an interesting email you want to make a proof of okay about half maybe raise our hand if you want another like minute okay handful of people okay we'll give people like 30 seconds or so um I'm exp cool yeah so once you found this email um if you're in Gmail you're going to hit these like three dots and then you'll see a little thing which is show original um and you're going to hit that and if you're in Outlook you'll see one which is like download original message uh similar thing you're going to hit that okay so I'm going to hit this okay and now you see this like big document uh of all of all the raw data this is where we're actually going to extract information from um okay cool um let me try to format this QR code so it shows up a little better okay perfect um sweet okay and then what I'm going to do is I'm going to log in into the registry I'm going to start making a proof of that email so I hope people have have kind of uh found an email they want to make a proof of open the original message and open the registry and logged in and gone to the create blueprint page um okay so if you you know emails on the top right uh the top left of your screen the QR code is on the top right this is how you get to the registry um okay and here I'm going to to name the p patter let's say you know alert uh Google just say Google Alerts is the one I'm going to do um okay maybe okay maybe raise your hand if folks have like opened the registry and have an email they want to make a proof of okay okay it's like about half um okay um cool and then you notice this field which is upload test EML once you've named your pattern you're going to go to this kind of raw email and you're going to download original uh in Gmail's download original an Outlook you'll have one which is like um download original message and you'll get like aeml file and you'll see there's now this EML file um that just got downloaded and you're going to upload this into that little box so I'm going to click to upload okay um be um can you you ever whatever that's fine give me give me the send me um send send me a link to the um actually we have the chat GPT we're just going to use the chat GPT okay that's fine we yeah what's up um cool okay maybe raise your hand if you've uploaded the example EML um sweet okay and then we can start filling out the fields um you know tags this is like Google alert um prove you got a Google alert for some keyword okay um email query I mean Demitri explained this earlier but we're going to fill out like when I actually search to my inbox to get this value you know maybe it'll be like this um this is going to be the string we literally put into your email search bar to fetch that email out automatically so in this case I'm going to put in you know Google Alerts um but you should put in your own query for what would result when you search your inbox to get that email um cool um okay and then skip body hash check uh this is will depend whether you want to extract information out of the email subject or body in this case I only want to extract information out of the email subject like I want to extract this word and so I'm going to skip the body hash check if you want to exract value out of the body leave the body hash check okay um Center domain in this case I can look at the Domain um you know we'll see this was sent from google.com and so I'm just going to take this Google.com I'm stick it into the center domain cool okay um and actually one thing I'm going to do as well is pull up um let me see if I can okay and then um this AI I think there's too many people who are going to trigger the uh AI Auto extraction right now so we're likely going to get rate limited but if you use a chat gbt bot on the top right then you will not get rate limited um and then this will let you automatically extract these fields I can say something like you know extract the uh actual value of the being alerted for from the subject and it should automatically fill that um but because we might get very limited you might have to scan this QR code for the chat gbt bot and then paste in the email and and ask you know I want to extract this what Rex should I use or you can kind of just man ually put in your Rex um although that might be a little bit harder um cool and then uh once you're ready uh you know you can hit save as draft if you want to come back to this later or compile blueprint so if you submit the blueprint then that will basically hit like our server will start generating ZK like a ZK circuit for it and actually generating a unique circuit takes like a few hours the first time you do it and so the hope is by the end of you know this few minute process everybody's at least submitted a blueprint and if you come back tonight or tomorrow or something hopefully it's been generated and then you can start making proofs of it but we'll do the rest of the workshop with like our existing compiled blueprints um cool do people like have questions because I know only half the people yeah okay people want to you theem and for a while um there might be like a r liting right now um yeah maybe I would suggest either try a different patter or try um so if I go up here this email search query is literally going to be the thing in this search bar up here so it's like if I were to search my inbox to try to extract that value what would I literally be searching for and that will filter my inbox and say these are the possible emails that might be used as a valid proof in this proof so the point is when people actually try this out they're going to you know go to to the registry um and then maybe they're going to use let me find one of these patterns um you I don't know what is a pattern I can make a proof of um maybe like Google alerts or something and then I am going to like uh hit connect like most people hit connect Gmail account and then automatically want to choose which email to make a proof of and the point is once you connect it'll filter your email by that email query yep cool good question um okay uh yeah question the BL blueprint the submit blueprint button is what disabled so that means you've missed some field so try going through all the fields and seeing did I fill a field in like did I feel something in the Rex did I feel like there's probably some validation that's failing or you didn't run the tests yeah you're getting a yellow um yeah so so it took you back to the main page now or wait so so sorry what exactly did you click uh which button one one of these generate oh yes yeah sorry so so I think the AI is probably getting rate limited right now because everybody's quaring it so I'd recommend using the chat gbt bot in the top right instead yeah yeah failed test what what did it say um yeah probably the Rex format wasn't exactly correct let me pull up for you guys what exactly the Rex format should look like um yeah um let me just pull up an example kind of Parts there um um right maybe one thing we can do is provide what exactly those Rexes look like to help people make the definitions um okay let me let me pull up an example pattern that I know should compile um probably this one okay um it's like a bit hard to parse I guess let me [Music] um try to put this in like a paste bin um okay uh we'll probably switch in like 20 30 minutes 20 minutes or so um are the dots updated the dot Source okay okay right so this is kind of what you might imagine I think some folks were having trouble with the Rex this is kind of how you need to structure what goes into to this like Parts Json field is you need to have like this kind of thing where you have is public and then a Rex definition is public re definition in this case I'm extracting some value out of the subject um maybe to make it concrete for the Google Alerts email um we can try to do this as well where we take okay we're going to see Google alert um so I'm going to say you know in the subject so before the field you're extracting you'll have this little like um thing you have to put of the delimer before the actual value so here I'm something from the subject you might imagine if you're extracting something from two or from this would say two or from um and then you're going to put you know I'm going to see this in the subject and then I'm going to see any value except the the SLR and then um the end of it and so mostly what you'll be doing is editing this value in the middle and editing this value whether it says subject to or from um and your casing has to be correct like it has to be subject to from lowercase and then here you put in like what exactly you want to parse and then probably anything thing until the end and then the end limiter um okay I think maybe we'll we'll keep going around and and seeing what people's questions are uh yeah uh so so uh you mean like in this Parts Json or you could yeah right yeah so exactly so youd add Valu to extract and you'd put a second Rex and they'd both be constrained body it's all in the body you could just put one um it's more about like Clarity of thought to make sure that that that kind of uh like you feel like you're not making it too complicated in the body um if you're going to parse in the body by the way you don't need something that this is for uh things in the header or subject if you're going to par something in the body maybe let's add one to the body um alert name body um if you're going to parse in the body you can probably just directly parse what exactly it is you want to show so in this case [Music] um okay so in this case maybe I want to parse out I see this in the body um what I'm going to do is I'm going to uh Define okay is public equals false uh okay so I'm going to put up here like subject Parts Json I'm going to hit here body parts Json Okay cool so um um so if you're going to do body parsing you can just say this is the concrete thing that I'm going to see in the body and then I'm going to extract out everything in this case except a quote after that and this is what's going to be revealed and so you know hopefully these subject and body parts Json help you understand like if I want to par that specific value from my subject or body how exactly I need to do it yeah [Music] Poss for [Music] [Music] [Music] yeah so okay yeah great question if you want to see like example attributes from from other patterns uh you can go into the registry you can say oh I'm kind of curious how they built uh um I don't know this Luma Devcon one you're going to click this little hyperlink button in the middle um and this will take you to the actual uh pattern and you're going to hit view all versions and then you'll see in the version history you can now edit the old patterns right if you see that um so I can go in and I can edit and I can view what exactly that pattern looked like and you can see oh this person defined an email body and put this stuff into the parser yeah um so you know maybe if you look at some especially the older ones that are compiled these are ones that we kind of looked at in made sure they look good and so you know clicking one of these and then seeing okay um view all versions and then edit uh will help you see what exactly should that pattern look like and you can kind of use this to help understand okay what should my like pattern in this Parts Json actually look like sweet okay yeah yeah yeah yeah yeah it's a great question so what is the developer experience of like actually making sure it's working in generated output you should see if you did it correctly like the actual output that will be generated and so if you see an error like this oh failed to test decompose reject on EML then you know you made some bug on one of these rexes and so you know I can go through and I can be like okay like let me try to try to fix this you know in this case this reject you know High Dot is probably not correct um but in this case you know um I've gotten like a all test pass ready to compile and so I know okay like it looks like this parser actually ran on my email and so I should be you know good to good to submit the blueprint um or at least at the very least save it as draft and come back to it later if I don't want to start the compilation process right now but hopefully the generative output lets you debug did it work or not sweet yeah yeah yeah so so the venmo one used like an older version of this where they manually kind of went through but the VMO one they defined exactly a similar kind of Rex definition and then built precisely uh this kind of thing but for them the dev tooling was much much worse like they did not have this ability to just put in the redx and everything happens for them in the background they had to kind of manually do everything so this will let you build the the venmo thing ideally in like one session like this yep yep um or at least get all that solidity verification kind of done for you once the blueprint is finished submitted and compiling um sweet yeah no so so what I'm showing right now so the the Gmail login stuff is included for convenience so if I go back to to here um but if you're using a non-gmail client uh two things so one is we we plan to add like non-gmail clients into this connect Gmail account so we'll add you know connect Outlook account connect all this other stuff and if you use something else you can always drag and drop and upload the raw EML and so this will let it work for all non-gmail accounts yeah um but we we'll add ideally connect Outlook pretty soon sweet Yeah question in the back yeah okay yeah um so when you see the error like fail to test decomposed reic on email that means this Rex you defined does not accurately parse your email so what I would recommend doing is like remove one section at a time like maybe cut you know the last two and be like okay do I still get the error okay like put it back do I still get the error and kind of try to surgically find out okay if I remove you know maybe these you know do I still get the error um and try to kind of figure out where exactly in your reject you made the mistake yep yeah the prom for chat GPT yeah so so maybe what I'll do is I'll I'll demo this chat GPT bot as well because that will really help folks um use it uh okay um um so so the point is you this will help create those rexes so maybe what I can do is I can I can take this uh this raw EML so let me let me pull up this EML um okay so I'm going to like copy paste this EML file I downloaded into the chat GPT bot and then I'm going to say help me extract via Rex the part after Google Alerts Alert in the body something like this so I'm going to paste in the email I'm going to ask like you know help me generate this Rex to to do this kind of parsing and if I send this out um you know it'll take a second to process then it'll show us okay what is the name where should I parse I should parse in the body um and then it'll give me the parts array and explain each part so so you know I'll do um let me pull this back up um so so it'll tell me in the first one make is public false and put you know Google alert Dash and in the second one make is public equals true and put you know anything except this end forward and so here you know I've changed anything but the quote because the quote comes afterwards but this is like somewhat accurate like I can take these little is public and Rex parts and and plug it into exactly this kind of a Json and then if I dump that in I should be good to go and in fact it'll give me this like Json parts section that I can just copy out the parts directly in this like piece of code it generates um so hopefully this chat GPT bot helps people generate the regexes um and can help you also debug you can say hey I use this as my parts Json it's not working why where might the parts thing be wrong and the hope is that this bot has enough prompts of example patterns from our registry that it can help you debug that cool um yeah maybe I'm going to go around and keep helping people oneon-one and we'll we'll see um we'll do this for about seven more minutes and then transition to the solidity part of the of the workshop so even if you got totally super duper lost here um we'll we'll transition to Something in about five minutes or so so yeah sweet I I'll keep going around answering questions yeah I fi e [Music] [Music] spe [Music] J [Music] let [Music] for [Music] e e for [Music] um [Music] [Music] yeah [Music] [Music] for [Music] [Music] for for [Music] [Music] that's [Music] [Music] e e [Music] [Music] [Music] [Music] this Okay cool so I'm going to just briefly uh explain the main issues that people have been having and then we're going to transition to the like other code sections um okay so some issues that people were having as I noticed um for some folks the submit blueprint button was not enabled um so you have to fill in all the fields so like you know 64 like the max length is one common one people missed um you have to put in a like description you have to put in a tag and then click enter so it becomes like a tag type and you have to upload an email for the the so you have to have like an uploaded email in this field for the submit blueprint button to be available um and at the bottom you have to see like test pass um if there's no email uploaded here it won't let you submit like submit the actual blueprint at the bottom um I noticed some folks saved as draft um and then tried the pattern on the on the front page and realized they couldn't hit create proof so the main thing there is that you can only do create proof on the main page page if you've submitted the blueprint and you've waited a few hours for the thing to actually compile and for us to make the circuit for you in the background so it'll it'll kind of take a a moment for that to work um yeah so uh and then one thing is if you if something's going wrong you can't submit the blueprint you don't know why I would just save as draft for now and then we will maybe send out like a note to folks in the workshop uh saying hey you know we fixed some bug where the thing didn't uh submit the blueprint uh try it again or something like that um and we'll we'll put a telegram URL up here for folks to join and ask questions about hey like is my blueprint compiled yet kind of what's going on and we can we can make sure we help out there um so I'll put up a the QR code let me see if we have the QR code somewhere um um yeah here okay okay so what I've done is I've stuck the telegram Link in a QR code over here um it's the left most one if you scan that QR code you can ask us questions in the telegram group hey did my patter compile my my blueprint still not working I tried to save draft tried to compile it's not working and we will try to give support after the workshop and over the next few weeks and months um my goal is to get everybody who started a blueprint here to compile it there are there might be some bugs on our side like maybe we we can make the the clarity of why the parsing is wrong more clear and things like that and we'll we'll try to make this better over the next few uh weeks and months um but at least it sound like some people were able to fill in all the fields and get that to work um yeah uh cool so yeah if you have more questions I would send to the telegram but we're going to Pivot uh a little bit um and maybe one thing I'm I'm curious about pivoting too is should we I'm wondering if people be more excited to build a front end in which they import this proof and then now do something on top of that or people will be more excited to do solidity uh calling zkl proofs on solidity with sent emails so concretely you know you do something like um um our email based account recovery um in which you know receiveing email saying do you want to recover the account to some some address you receive an email you reply to it and then that transaction Triggers on chain um so I'm just going to do a quick PLL maybe raise your hand if you prefer JavaScript to solidity and you want to go over like a JavaScript version of implementing these proofs okay like maybe six seven people okay um raise your hand if you prefer solidity and you want to go over a version of triggering transactions in solidity directly okay that's like 20 people okay so I think what we're going to do is we're going to S JavaScript people um I'll put a link to the JavaScript demo after we're done with this and the docs and you can try doing that yourself um but we'll probably focus on solidity this time around um cool um yeah and again if you have more questions like if you hit up our telegram you're like look I really wanted the JavaScript part of the workshop uh where's the link for the docs the SDK whatever we'll we'll send it to you so the telegram is is really a good one um okay we're going to we're going to Pivot a little bit switch gears if your pattern didn't compile save it as draft and we'll come back to it later um so just you know H hit hit save as draft down here um and we can help give support on the telegram and okay Switching gears a little bit um so so maybe briefly before we even like kind of dive into that I'll give a brief presentation of what exactly are we even doing with this solidity style transactions um so this will be maybe like a 2 three minute overview and then we'll dive into actually building this ourselves uh so so far what we've done in the workshop is proving emails you've received in your inbox um you know there's all sorts of weird emails but you would imagine maybe you want to trigger an onchain smart contract by sending an email so you have an email a smart contract controlled by an email address right so this allows you to do something like account recovery where you can add emails as Guardians to a Smart wallet and then use those email addresses to recover that account um you can have emails on Multi Sig or directly on a safe you add an email and then that email recovers the account you can have login with emails where now you can say you know someone's put an email in an interface and they've kind of imported that uh that login and you can have something like an email wallet where you receive tokens directly to email and these are the four examples we've shown of what happens when an email address controls a smart contract um but you know uh you can either use the SDK we've put out for these four and integrated into your app and I'll I'll put out the QR codes for those or you can build your own custom kind of email trigger transaction um what does this like concretely look like uh you'll receive an email saying you know do you want to say recover your account or sign on this multisig or you know log into this website and all you have to do is reply confirm and it lets you interact with the smart contract directly when you reply we make a ZK proof we receive that email we make a ZK proof of that signature and we prove it on chain um this email is like I've moved the data that's actually being proved into the subject so we can all read it but when you actually try our code this will all be embedded into the body um but you can see if you read this like the command you're actually signing by replying to this email is recover account eth address from Old owner eth address to new owner e address and this is concretely what we'll execute on chain um you know so so the the service we're going to provide is we're going to deploy a relayer for you and allow you the option to self host it when you want the relayer sends and receives emails and makes proofs so the user will say them like I want to recover my account the relayer will send them an email saying are you sure you want to recover the account if you do reply confirmed to this email the user replies confirm and then the relayer takes that reply makes a ZK proof of it sends it on chain and triggers that smart contract cool um you know you can accept Guardian requests um you can anonymize your email address on chain will automatically handle making sure the email is anonymous on chain um and the point is a relay decentralized so you can start with our hosted relayer just so you can get a prototype up and then run your own server when you feel ready to um sweet um so maybe what I'll do is I will put up uh I'll briefly go through what the interface actually looks like and then we can um we can look at the various sdks and things like that um so uh okay so I guess maybe the first thing I'll go over is if you actually want to add let's say you want to add a specific version of one of those four ideas like say account recovery to your application you probably wouldn't use a generic transaction Builder you'd automatically use use the recovery version that we deployed so in this case you know we've deployed a recovery module that you can just add to any smart account so how would you do that um you would take our solidity you know smart contract you'd install it on your wallet and then You' hit our API with these different acceptance request recovery request complete request again keeping in mind you can always self-host this API if you want but you can start with ours just for ease of convenience um when you actually want to add the smart account into you know a wallet on a front end you can use some code like this that we've already kind of configured for people deploying this account recovery to a wallet um the docs will be like your your friend here so if you look oh I want to do account recovery you search it in the docs you'll be able to pull up that page and like okay this is exactly what I need to do to integrate it um but maybe the thing we'll focus on this Workshop is getting generic solidity commands to work um so you know in this case you would maybe want to build your own version of this kind of email trigger transaction let's say you wanted to build account recovery you would Define something like recover account eth address to new owner eth address you define a solidity function looks exactly like this a recovery subject template that you know takes in string memory returns templates that just defines the pattern and you plug in you know in this case I've done you know um curly braces eth address or I want eth addresses you can also put strings numbers whatever and so let you automatically access those values from within solidity um and you would hit our API with a query like this our quick start will automatically do this end to end thing for you and you can kind of just fiddle with it oh what if I change the word account uh from account to wallet what if I change an eth address from an eth address to a string and this so let you experiment with this as a starting point um okay so what we're going to do is we're going to um maybe what I'll even do is I'll link to a more specific point in the docs um where we have this kind of uh this sort of generic relayer thing going on let me pull up where exactly we have this um quick start okay so I'm I'm going to link everyone to this quick start um this is concretely in email um cool so you can either go to docs email email transaction off this is our email transaction Builder and then the quick start or you can just scan this QR code um if you're on your laptop you play one to the bottom one if you're on your it's not really possible to run solidity on your mobile so I wouldn't recommend scanning from your your phone and then we'll we'll basically show once you've got uh okay so I'll I'll leave this QR code up for a little bit once you've got this uh this QR code scanned um um then I guess the did will take over what exactly should you do with this quick start running through actually cloning the repo going through these docs Etc so I'll give people like 30 seconds to make sure you've scan this QR code make sure you have this link on your computer you're at docs email email txo quick start and we'll we'll go from there um I'll make this uh bigger okay and we give you 10 seconds to take this and then we're going to we're going to move to what exactly do with the Quick Start okay everybody has scanned I hope so you have like three seconds um okay cool now we're going to swap to once you're on this quick start page um you know we're going to actually go through this git cloning CD in um setting your environment and then actually deploying cool you want to take over sure cool um so hey everyone um I'm a here and the entire point for this particular section of the workshop is to show that how easy we have sort of made to do an onchain transaction like specifically to a contract function purely by replying to an email so if you want to integrate um people just replying to emails and that triggering an onchain transaction this is like a really demo for that um cool so maybe justly one question can people read the screen like from the back it looks a little bit raise your hand if you can read the that's good good okay should be fine cool um yeah so if anyone hasn't been to the docs page yet it's docs. proof. email you come to the email transaction a section and in there you just click to Quick Start I'll give people half a minute to a minute to do this um yeah just do the first step you just need to clone um a get reppel and CD into the directory can I have a show off hands of um of people that have done this cool I can see five six hands seven eight nine cool um yeah so I'll continue I'll just so once you have sort of um cded into the directory um I would recommend you to run this one on this is um one package that you might need I'll just screen yeah so it's bre install JQ just do this if you don't have a few of Macs probably have this couple of don't so this is just like a stive installation um cool and once you have done the installation um just go back to the docks page uh um scroll down and you would see this one make Command um I would ask you to copy this command paste it into your terminal and then just enter your email address so this is my email address um and you can enter your email addresses as well once you submit this you should receive a response with the status success got it cool got it um the command is in the docs so if you just scroll a bit down it is make space Sumit space Capital email equals your email address and for people who have done this already what you would have received is that if you go to your email you would have received a very templated email um it would look something like this once this step is complete and um yeah I would recommend you to just reply to it it doesn't matter what you're typing in as long as you're replying to the email um it is good enough show off hands people who have done it cool five people anyone from there having any issues 5022 um just run again this is okay so why you would have been receiving 502 is that we are also making an Alchemy check for checking that is any transfer of data or approval of erc20 tokens are sort of being done um and to avoid that there's an Alchemy simulation check and that would have rate limited so just try again and um I will be giving the overview of this as well [Music] cool so for people sort of basically asking that what did we actually do okay we reped to an email and um if I was to show you the email um just give it some time yeah some few of the folks would have received an email like this where it would have said your request ID has been complete view on Explorer you can see this one transaction that has happened so what did you really do by by replying to an email um if you sort of go over the actual contract in the repository that you just cloned you would find yourself um a contract that is already been deployed you could have deployed this yourself and then made few changes but what essentially is being done in this particular contract is that we have created an email off contract for you and what it does essentially is that it allows you to create commands um and what do I mean by commands commands look something like this you can have multiple commands and the meaning of a command is that you can trigger things with it so every specific command does something if you could have like an approv erc20 command you could have that oh swap my erc20 token if this particular command is Rong or send money to this particular e address if that particular command is Rong um for the sake of this particular demonstration um all of these commands emit um an event and um they are different sort of uh templates or placeholders that you can use you can use a string you can use U eth address etc etc and you can have the complexity of the command as you want so if I if you were to go into docs um I have this example of commands that you could have used um where is it cool so the example of commands can be for example send decimals tokens to e address and this is a templated command and while filling the parameters you could have specified 2.5 tokens to this particular address and you create these commands and essentially you would be creating this contract um where you have the command templates and the actual function that we are hitting with the make Command is the emit email command function and what it essentially is doing is that you have something called as template ID you're Computing the template ID and if the email proof is being verified then at the end you're emitting an event so you can have your own custom logic at the end of the email proving um step and once the email has been proven and a particular command has been run then you can have your whatever logic you want at the end of the function and what is it it'll essentially do is that it'll verify your email proof and then at the end run that command and if I was to show you the API call that is getting made at the [Music] end the call looks like this I hope this is visible okay cool um the contract address is the contract address that you would have deployed in this particular case the contract address is for this particular contract that's the emit email command contract you have a dkim contract address um this DM address contract um can be found in The Ether email or rer so if you go to this particular repo you will find the deim contract so you mention that you can also use the existing dkim contract which you can file in the make file account code function ABI so this is basically the ABI of the function that you want to hit in our uh case it is the emit email command so the ABI that is getting used is for this particular command thank you you can specify which email address it is getting sent to you can specify the subject you want you can specify the body and the chain you want to do it also your function can have more parameters other than the struct that we are constructing so for example in this particular function you have the owner address and template index that is an address and a un type so you can add the remaining arguments at the end of it and what this essentially does is that you trigger a relayer which would send a email to the user once the user has replied to the email our IMAP server will pick up the email it will send it to our approver which will create a ZK proof of that particular email and then um it will hit on chain the transaction that you want to hit so the command SL function in the contract that you want to hit so all of this is actually abstracted for you and we are handling all these process so for you you only would be needing to deploy a contract and hit our API with the specifications that me uh that was mentioned cool um all this is taking time was this clear anyone having issues yes that sh I think stage think e for [Music] for for [Music] [Music] [Music] uh okay can you just tell them to minutes late and help can you can you [Music] help okay that's fine okay yeah see you for good Okay cool so as we're coming to the last seven minutes here maybe I'll just address some of the last few uh last few notes um some folks mentioned wanting to self host if you go to this repo on GitHub um you can basically clone it locally and you'll see all the packages and infrastructure that this relies on and you can self host the relayer if you want um and the API interface should be exactly the same um if you want to integrate any one of the specific things like account recovery on the left email signers oath login or email wall that's already been built built and audited for you um you can use one of these four QR codes um and if you want um these are the main QR codes questions on the left side on the telegram our website in the middle at zk. email and these slides on the right side so you can kind of go through yourself and be like oh what were all those other QR codes that I missed um so these are kind of the most important things to scan um and we'll kind of be around to keep taking questions but I'm I'm hoping that people came away from this um with a sense of like one how can I define proofs of emails in my inbox even if potentially you know we we didn't exactly get all of them compiling um hopefully that at least gave folks some insight and then also how can I get proofs of emails triggering onchain transactions I hope people got at least an idea of here's an MVP way to do it when I want to put into production I can use one of the audited versions up here or I can kind of uh you know read the docs and and build one myself um again please ask questions in our Telegram and we will be around the ZK email impact booth for the next two days um it's kind of on the opposite corner of the building on this floor um there's a bunch of impact boots and you can see us you can come to us you can be like hey I really wanted to get the proof from my workshop compiling can you help me and some of them will be at the booth and we will get the thing compiling um and so yeah definitely meet us at the impact Booth if you want more information um and if you like account atraction you want to debate it with us we'll be at the account exraction Community Hub um yeah definitely come see us at any of these um but I'll leave these up for for another like few minutes and hopefully folks can uh can grab these and yeah keep keep asking us questions me said the impact Bo if you didn't get it compiled um sweet thank you for coming um and I hope that people were able to learn at least something from this and we also have a talk that we gave yesterday that will be live stream that you um that was live stream that you can go and and listen on like okay how exactly does all this stuff even work like what is happening in the background and you can get a lot more insight from that and our docs okay thank you guys dish for to
