PSE - Ethereum Foundation 🛠️ Anon Aadhaar Workshop
ETHGlobal·Wed, Oct 9, 2024, 12:00 AM
Join us for a workshop titled, "Anon Aadhaar Workshop”. Anon Aadhaar lets your user generates prove their identity with full privacy using ZK Snarks. With a week of open learning, hacking, and workshops on all things Zero Knowledge technology, as well as $50,000+ USD in prizes, Circuit Breaker is a great way to connect with the community from around the world, and help shape the future of Ethereum! ----------------- Find more about Circuit Breaker: https://ethglobal.com/events/circuitbreaker Follow us: https://x.com/ETHGlobal?s=20 Check us out: https://ethglobal.com/ Email us at: hello@ethglobal.com
Transcript
[Music] everyone and welcome to the circuit breaker psse ethereum Foundation Workshop Anan atar uh joining us today is jannis who will be taking us through this session and without I'll pass over honest to get the session started hey uh thanks uh hi everybody um super thrilled um to uh un board you on anadar today uh and uh can't wait to see uh what are you building dur during this acan with u with our protocol um so let's uh let's dive into it uh so here is a summary about the presentation that I will do today um so with an intro P statement and then I will go through like all the details about how exactly the protocol works and how you can use it inside inside your apps so uh let's get started so what is um to introduce what is anadar so anadar is is a z protocol that let ad citizens uh prove their identity without revealing any information about thems um so Adar is the uh is a proof of residency for Indian citizens uh so our protocol is only focused on now like on the addar uh identity uh and I will I will show you what can do what you can do with the protocol but first like let's uh let's uh just uh give a quick like problem statement like what are we solving like with our protocol so um our protocol is achieving like um Anonymous Pro proof of identity so in the current system so you have like governments uh they are basically the the owner of your identity they have like a big reg registry with all your identities and they give you like your identity in the form for yourself in the form of a of an ID ID card uh so the governments Here sign and issue your identity uh and they can give you for example a number uh and this number is attached to all your information about your identity and so the goal here that what we're trying to achieve is that uh how we can build a prover such that uh he can the prover can uh constrict a proof from your identity that attest that you're human and that you you have an identity and convin a verifier without tring any information about this identity um achieving that is like a big step because like of course it's hiding a lot of personal information and it's um very useful in the case of blockchain when you want to uh Bridge uh your data on chain or that you just want to prove that you a human um on chain so so uh what is what is anadar so um anadar is um basically doing what um others can do with digital identities that are assed uh so in the case of Adar um so we are the protocol is based on on some documents that are signed with RSA which is a signature algorithm uh and CH to 56 so uh in the protocol we are basically verifying both both the ash of the signed data and the signature but we are doing it inside of of a of a snark and we are using come gross 16 to to achieve that um and also the protocol right now is achieving like um uniqueness of the proof so we can attest that we can uh for one for one identity the proof uh we can we can output some identifiers that will remain the same without a um causing any trouble for your for the the end user privacy um anada is served through a typescript SDK a solidity library and a react Library uh but I will get I will get deeper into that like um after uh so how does it work so as I said so um right now the protocol is using what um the UA the uad which is like the basically the government agency that uh is issuing doing identities and signing identities um so they are using this thing that they call secure QR code and so this QR code like contains like all the all the fields that are like listed here so you have like a reference ID which is the last four digits of your add addar number of the addar number and a time stamp the time stamp is representing when the data was signed um and and also like the name the gender the date of birth the ash of the mobile number the ash of the email uh the address uh your the photograph um in bite in bites and uh a signature so um we are just scanning this uh this QR code that you can easily find on the Madar mobile app or uh on the printed e add letter uh so we can we can disc code we have like all this row data uh that we can then like separate between the signed data and the and the the signature uh and then we can process um that into our circuit so what exactly our secet is doing so here is a scheme that explain all the steps um that uh that we are achieving inside inside inside of our circuit resulting into into a snar proof um so first um let's go through the inputs so as I said we have like the signature we have the signed data we need the RSA public key so in the case of of add identity it's some it's it's something that is publicly published by the uidai you will find in the documentation uh the website the registry where you can find like all the all the production and test uh public Keys um you have like um uh also the signal the signal Ash um which is I will explain this feature on in the slide in the slide after um oh sorry there is a typo here so there is two times so there is the RSA public key and here instead of public key should be um the data length the length of the uh the size of the of the data um so first we apply shat 56 on the on the signed data because in the case of the RSA Alor say algorithm it's not exactly the data that is signed is the ash of the data so in the process you have like a basically the row data and then you Ash it and then uh you sign the Ash with RSA so inside of the CIT we need to recompute shat 56 inside of the circuit to ensure that the data we will um we will compute inside uh is actually authentic and is the data that was was signed then we verify the signature with the public key and the sign and the ash uh and the shat 56 Ash of the sign data uh and then once we we we are sure sure that both uh the ash uh is verified and then that the signature is verified now we can start to compute compute data and then we are extracting uh so the last four digits of the down number the time step the name the date of birth the gender the PIN code and the photo so we need we need this this data to compute two kind of new ifers there is the user nudifier which is the ash of the last four digits and the photo the identify identity nudifier which is a uh the ash of the last four the name the gender the datea person and the PIN code um then we convert the time stamp uh so remember the time stamp is the time stamp of when the QR data was signed so it's uh it's basically like every time you will you will request on on the Madar app or every time you will want to generate like a e rpdf uh so the time stamp is the time is the is the the time step of when this document is signed um and then we sign the signal Ash uh again I will explain the this mechanism on the in the slide right after that and so the in the the output you have like this outputs the user unifier the identifier entity identity unifier the time stamp the public key Ash and the signal Ash so now that we know that okay so what what can we what can we do what can we leverage with with all of that so um the user nudifier um it's it needs to be used um as uh to prevent double double spending uh proof double spending so um it's used to um um to prevent user for foring uh two different proofs with the same identity um so this is the ash of the last four digits that will remain the same uh no matter what you change in your identity your your other number is supposed to be to remain the same uh during all your life and then you have like the photo bites and so this photo uh it's it's something that uh will last for at least 15 years uh so sorry maximum 15 15 years uh so your this user unifier should remain uh the same for for quite a long period of time but it can happen that for example you change photo and in this case your user unifier would change so that's why we also compute an identity nudifier which is here more like that you can use as a recovery method so let's say that I I change I change my I change my photo so my user nudifier change uh you can easily ask to the to the user to input so all the the fields that need that we need to compute the identity identity unifier so the name the date of birth the gender and the PIN code and the last four digits of of his add number and then you can easily like verify oh okay so he's able to recompute like the identity unifier and then you can like um um link this identity unifier to the to the previous identity unifier and user unifier you you recorded into your database like um long long time ago uh for example then then you have the time stamp so we are processing the time stamp to to Output it like as a Unix UTC time stamp um so which is very helpful like for example for onchain verification you can check it over the block time stamp for example and so we are outputting the time stamp as a as a security so it can be it can be used as the as a one time one time password system uh because as I said so this time time stamp is the time stamp of what the data was signed and generated so meaning that uh you can really use it as a onetime password let's say that you want to uh have more security against the thief because like as it's a c code anybody can find um a PDF or um even I don't know like have like an application open um with the the Q the QR code displayed uh and then scan the QR code and generate to proof so to prevent that we uh we are um uh we are checking the time stamp such as the you can uh so you can you can sorry so you can um in your into your apps um uh choose the level of security that you want so it can be an hour it can be like okay I want I want you to to show me uh a proof with a a data that was generated like I don't know like three in the last three days uh so you it's something that you can choose um and it can be done this check can be done either like onchain or offchain uh we are also outputting the public key Ash so that's more something that we we we use to optimize to optimize gas fees uh because like in the case of RSA the public key can be like quite quite quite huge uh so just having to check against the public Ash is um is um is easier and it's also something that we store into our smart contract um to be sure that uh the the public key that was used is the uid public key because in the case of in the case of our secet so um so if the data is different from Q code of course it will not work but if you go to the basics and just think about shat 56 ands say you can present to the secet whatever like Shadow 56 and RSA signature and it will generate a proof um but uh so you really need like to just to to ensure that the public key uh that uh that was used while verifying the RSA signature is the one from the UA um and also so you have the signal Ash so the signal is is a mechanism it's really like a it's it can be seen as just sending sending a message um so we mainly implemented this feature for uh first um prevent front running on chain so let's say that you have like a vote smart contract and you ask the user to vote like to send to send the valid Anon another proof um it's quite easy like to just uh take the proof from the meem pool and and uh and replay replay replay the vote before uh before the other the others um did with the with the same proof so by using the signal Ash as a front rning mechanism you can like so to use it as a as a front rning to prevent front rning sorry so what you can do is that for example you can um ask the user like when he's generating his Anon another proof to set his uh address uh ethereum address um as a signal so when you will generate when you will generate the proof it's GNA it's going to like basically apply a constraint on this on this signal so when when he will send his proof on chain you can do in your smart contract a logic such that such that such as um uh the signal is equal the the sender the sender address um and also it can be used for example um if you plan to I don't know like build a a near SE 33 37 wallet uh for this haon it's now completely possible uh and you can use the signal Ash um as a as a signature mechanism so for example you can like just basically like have like the the representation of the transaction hash it and input the ash of this of this transaction as a as a signal and then generate a proof uh and so it you can use the identity to to you to sign to sign your transaction on chain with your ACC abstraction wallet which is a kind kind of cool if you think about it uh okay so now let's get more practical um so um we implemented the SDK so it's uh it's such that it's going to be like really easy for you like to integrate it into your apps uh sorry we are switching from the from the a bit more um um complex complex part to the more easy part so uh you have like this react Library uh that is it's really similar to integrate it takes under under five minutes so you just install the install the react Library uh then you just uh need to initialize the the provider um at the root of your app and then you can like use a simple simple hook that will give you the the status uh so this the way the way you can use the react library is mostly for example for authentication but you can use it also like to just ask the user to to sign to sign data um and so yeah and you have this component uh login with anada which will display these two components and so here is the the components when the where the user is asked to login or at least to generate a proof and so what you will need need to input his uh add QR code as a p as a PNG uh so it can be it can be quite easily downloaded on on the Madar app uh as I said uh you can D directly download the the PNG the or you can um you can also um have it like on the on the PDF print print letter uh but in this case you will need like to screenshot it like a we did some test uh if it's like a a quarter of the PDF it's it works if it's if if the screenshot is a bit wider wider it's it's it can be a bit messy but as I said on the Mad app you can easily like just uh download directly the the QR code as a as a PNG uh so yeah as I said so in the case you want to you want to the user to sign to sign some data uh you can just like pass the signal you you want the user to sign um and uh he going to be it's going to be displayed um inside inside the component so verifying a proof of chain uh so then you will need to use like um uh the verify method that you can import from the an another core Library so you will need to install uh this one too and just want to highlight here that um at this moment is where like you can have like custom methods uh to check against the signal or the time stamp so as I said you can use the signal like to uh to ask the user to have whatever uh commitment that you you wanna you wanna you wanna you want him to have or and then you can also check check against the time stamp um to set uh the the rules in terms of security that you want to have um do you want do you need like a um something that is really secure and like you will have you will ask like really for a proof generated like less than 15 minutes ago uh or you don't you don't care and then you you you don't have to don't have to check against against the time stamp um yes so just wanted to highlight here that if you're using like the the react library and you use the login with an another component uh the verification of the proof is is done like a um at the login moment so in how it works how does it work is that um you as the the user to generate the proof then um it's going to it's going to start generating a proof and once the the proof is generated um and the the proof is verified and if the proof is verified then the user is logged in uh verifying a proof on chain so as I said we have a solidity library that you can also install into your hard that project uh some uh really um important stuff here so as I said so if you want to nullify an action into your smart contract let's say a vote or an airdrop um you really need to use the user unifier um and to map it like a with a a Boolean um and not use the message sender address because um in this case anybody will be able like to just with the same proof uh to send the approve that will pass the check with different addresses um you can use the signal as a as a way to prevent for training so that's a that's a mechanism I I explained I I explained before and you can see um here uh so the check so we are just converting um the the message the message the sender the sender address uh and we are checking that it's it's equal to the signal and then the signal is passed uh to the and another verifier uh and then also in this so This example this example smart contract is available like on our boiler plate that you can find here um and I will also post post the slide post the slides on the Discord channel so no worries and so yeah you you can have like a basic method that will check like oh okay so is the data that is that has been used to generate the proof is was produced was signed sorry more less three hours ago and then you have like you can so easily import like the um the the addar verifier uh we have some addar verifier deployed on seoa in SC seoa you can find the addresses in our monor repo uh and then when you will deploy your contract you you will just need to to uh to constrict your contract with the with the verifier address and then you will be able to import the interface and use it um use it that way to verify proofs so uh what actually you can build with with anadar so there is quite some some fun stuff to build um CTIC funding voting applications based on on Cil resistance mechanism uh you can build a gon passport based on an another uh a checkin check-in app um some more defi with a um so for example a microne application um you can build a replicate of of Twitter or foraster but just for Indian citizens uh you can build a SSO server that is based on the same mechanism but without having to um just by sending the proof and then the user can have like one one place where he can he can um manage his proofs and of course of chain onchain voting polling uh can be also quite fun to build it can be also of chain I just want yeah to highlight here so that um Z proof is not meant to be live only on chain can also you can also build the use cases um part of your use cases or where you need like the proof to not be committed on chain and and then have like other mechanisms that happens on chain uh you can you can you can choose just just want to highlight yeah so don't be afraid like if you verify your proof like of chain it's also like really useful uh in terms of of price we have like a $1,000 price for this hacken um rewarding the best integration project using anadar so we don't have like any specific criteria here we just want we just want like to judge in terms of of technique technical in ation um the use case the ux um is it really solving solving solving a problem um and is it something that is yeah something for more a bit more for the real world uh yeah and uh yes and the good news is that you will be the the we just launch launched uh this uh new version uh today uh we are very happy we it's been a month of hard work so yeah can't wait can't wait to see to see what uh what the hackers are going to to build to build during this um this uh hack and here is the is a link to our um um monor repo where you can check all the the codes integration you have links to our documentation website uh you have some uh you have a quick setup quick setup app that you can for and uh you can start working with it and you have have like a boil boiler plate app uh which is more like a it's it's very small voting voting app just to Showcase what you can do with with Anon awesome cheers thanks Yiannis if anybody has any questions please feel free to type them in the chat or take yourself off mute uh as well you can ask directly and if there are none um then of course you can always reach the PSC team at the partner Discord channel uh as well just make sure your hacker dashboard is connected to Discord um but uh yeah they will be there to help answer any questions around this so uh thanks again jiannis for the great Workshop presentation and thank you everybody else for attending this was our last Workshop of the today we just have team formation session in about 30 minutes which will be the final one um but yeah hopefully I don't see anybody there because everybody's already found a team Soh awesome well cheers thank you all thanks yianis again have a great uh rest of your day and have a great weekend and happy hacking thank you all bye have a good one [Music]
Automatic transcript — names and jargon may be misspelled.