# Embedding ZK Proofs in Lens with ZK3| Ya7ya | ETHDam 2023

- Channel: [CryptoCanal](https://streameth.org/cryptocanal)
- Date: 2023-10-07
- Duration: 13:49
- Watch: https://streameth.org/watch/yt-Y6HuyV9O1PE
- YouTube: https://www.youtube.com/watch?v=Y6HuyV9O1PE

## Description

Yahya Ibrahim Senior Backend Engineer LensProtocol & ZK3.
https://twitter.com/ya7ya?s=11&t=3zlJQECNQOGVgRU84E-vDA

ETHDam is a Hackathon & Conference that gathered over 500 DeFi and Privacy builders on the 20th and 21st of May 2023 in Amsterdam. 

Privacy is normal. Following the arrest of Alex Pertsev, a Tornado Cash developer in the Netherlands, ETHDam 2023 is determined to counter the chilling effects of the lawsuit and bridge worlds to discuss the future of privacy and encourage to build on the shoulders of cypherpunk giants.

ETHDam is powered by CryptoCanal, - a blockchain education and events platform growing in Amsterdam, spreading its roots to Rotterdam and Zurich. ETHDam 2024 is on the map already! Keep up with us to see updates: 

CryptoCanal https://www.cryptocanal.org/
CryptoCanal Twitter https://twitter.com/CryptoCanal
Join CryptoCanal Community https://t.me/CryptoCanalCommunity 

We would like to thank our partners and sponsors that made this event possible. 🌷
Our BFF 1inch https://1inch.io/

Our Frens: 
Sismo https://www.sismo.io/
Aleph Zero https://alephzero.org/
Scroll https://scroll.io/
RAILGUN https://railgun.org/#/

And our Sisters:
oasis.app https://oasis.app/#earn
Maven11 https://www.maven11.com/
bitvavo https://bitvavo.com/en
Lido https://lido.fi/
Spankchain https://spankchain.com/
API3 https://api3.org/
Gelato https://www.gelato.network/
VanEck https://www.vaneck.com/nl/en/crypto-etn
Marlin Protocol https://www.marlin.org/
Silent Protocol https://www.silentprotocol.org/
Cyber Capital https://cyber.capital/
… and Proto https://twitter.com/protolambda 🍍

## Transcript

foreign [Music] cool all right so uh yeah zero knowledge proofs and lens protocol uh how many people from area with lens protocol anybody used it awesome yeah we got some users uh so uh for the people in the room who haven't used it it's basically a social network on chain all your posts go on chain not the entire post but a Content addressable hash you get to index that but the social graph itself who you follow your profile is an nft who you follow can be like mapped out on chain and that allows anybody to build an app on top of lens use the social graph the existing social graph imagine if you're building like a social app you don't want to like start from scratch and get people to like follow their friends again so you build an app here you get that out of the box um so yeah with zero knowledge what are we trying to solve here like exactly the problem the issue is is to prove like an asset to prove that you hold my lady nft for example you do have to like share some information like where is the address you're holding that on and maybe sign a challenge to show that you hold ownership right uh doing that and holding an asset on the same keyword you hold the social profile it's public it gets everybody to like leak that information everybody knows that that information would be uh like public and people can track other assets that you have right uh yeah one wrong signature and you could get drug we know nfts this happens all the time and of course uh Web 2.0 that uh isn't bridged there are a few Solutions I think reclaim protocols a few other Solutions I think gelato as well uh they would bridge that data to uh on chain but we don't have like a native sort of integration uh so yeah what does zk3 allow you to do it allows you to Signal membership of a group without exposing any more information than that so uh holder of an nft um having access to an account with 10 East 100 East having access to a rather a ticket on Eventbrite and a Web 2.0 fashion all of that can be signaled you can generate ZK proofs of debt on chain and off chain and you can use these proofs in lens since all the boasts go on chain you can use the verify proof as a mechanism that will allow you to moderate a conversation so let's say you have um you want to collect reviews on a party you through for like let's say developer Dao you could say only holders of developer nft can comment on this post and when their comment is going on chain it basically goes through and the ZK proof is verified if it's valid it will go on chain and get minted if not it will be reverted and that post will never show up and that way you can reduce spam and allow to token gated basically using ZK proofs obviously it's open source it's natively integrated with lens I will go through like a bit of detail on that so the components um it's based on semaphores which is a ZK snork setup by the private see and scaling ethereum there's ethereum Foundation they're one of the projects supported by them it we basically like our entire setup is an extension of their system they built the ZK circuit they built uh the generic like Merkel tree that we use and we use that as a way to verify use their verifier and their trusted setup to do our ZK proofs there is a lens reference module lens has this plug-in idea where in order to reference a piece of content there is you can like add an arbitrary contract and that contract in our case will verify the proof and all the other all the content based on top of that like the commands or the retweets or mirrors as we call it will be will have to reference the same module which enforces the ZK validity obviously there is also a ZK witness and that's the coordinator and this is like a trusted part of the setup currently uh this could be later split up into like a decentralized setup the same way you do like um uh staking basically and these different players will be able to validate your eligibility to get on chain in some group if the data is not on chain already and keep that information off chain so it keep it keeps you uh safe okay so uh semaphore circuit this is basically the circuit I don't want to like bore you guys with the details but it basically allows you to generate deterministic identities to parts of that identity is private and one part that is the commitment that goes on chain that is the public part so you don't you don't really expose anything more than that um and these are deterministically deterministically created by using your eoa so if you have a key if you basically have a new laptop you add your key you get back your ZK identity uh immediately um obviously there is like you see the external nullifier that allows us to prevent double spends if you want to make sure people comment only once or if it's a voting setup if you're creating like a poll you want to make sure it's one vote only or one comment only and this is also allowed uh lens have already went through that um as I said it's a composable social graph we already have a bunch of Partners uh we have more than 50 apps uh running all of these apps control their own users but they still share the user so if you have orb and Leinster in the same time for example you would have the same followers but you would have a different experience right because you shared the same graph um okay so we have this concept is called circles which is the ZK groups on chain think of it as a miracle nothing it is actually a miracle tree of a bunch of ZK identities as you can see on the side here uh this is a Basics content of that Circle it tells you a bit of like that's the only thing about the members that is shown so these are the ZK commitment the public part of their ZK identity as you can see there is no other information that is really useful beside uh yeah you gotta have at least two Matic to enter that group and that's also you can see the coordinator here and this is the trusted member in the in in this group or the group coordinator basically who's allowed to revoke people if the group coordinator can generate a proof that you no longer meet the let's say the quota of 2matic right on your private account they can submit that and basically revoke your access from the group later we will have like some kind of staking system people would be slashed people get rewarded um Perpetual Bruce so the moment you meant the proof it's not like it's not checked after that we came up with the idea of Perpetual proofs which basically allows the ZK witness as I said to keep checking that proof and if it's invalid at some point they can submit a proof that invalids another one so basically they will take you out of that group and you can no longer generate new proofs so let's say you go into the 10 youth club from a cold storage and you copy like you use that proof on your Social account nobody knows where you hold the AUA except the coordinator if you drop more than 10 eats if you start spending money and now you're in the nine East Club guess what you can no longer use that on new posts and it could show that and that would allow you to have um we call it Perpetual obviously it's counter factual Perpetual it's it's opinions but it gets the job done where we're still experimenting with this obviously it's not fully decentralized here's the caveat right the coordinator sees everything um you could split the coordinator to a checker and a verify and a witness and that would make it a bit easier but right now to be honest just one piece um basic flow so uh a web 3.0 flow of generating a proof would be you want to create a balance of proof for example the witness checks on chain make sure it's good it attests that information adds you to an on-chain Circle and you get back a transaction hash of that proof of that membership and after that you can generate your booths with the signal that you are a member of the two east club for example um okay Web 2.0 proofs as I said you can use this with apis or like any basically TLS protocol that you can access open authentication the witness will connect and verifies whatever you were trying to attest it will double sign it so you would have your signature and the um the witness who verified you if another witness can verify that this is not true everybody will be slashed but again this is still a work in progress web to window flow same as web 3.0 but there is an API because data is not on chain um structs yeah so this is basically all the information that goes on chain all these circles just have a coordinator that is allowed to revoke people or submit revoke revokes the content URI if it's double spendable and nullifier hash um and as you can see on the right uh right here uh you can see that you could allow people to comment on your stuff even if they don't have proof if you want to like Farm engagement which is really good in the lens do farm engagement uh yeah how to join circles basically you would choose the kind of circle you want you would set up the amount let's say I have 10 Matic I want to show like a proof of five uh it will tell you the requirement one click basically it will go through uh if it's on chain again you're already connected via that account we will see that we have a proofs explorer that can look at all the groups and we'll show you like your identity the stuff you're connected to and it looks nft ish for again farming engagement and this is how the proof would look later but let me show you uh this is our current integration so you can do these proofs this default is just for testing but still we do cool with that we don't know anybody with this yet so if you are uh yeah do let us know we we are looking for money but yeah uh demo I think we can play the video I didn't know if I'm gonna have a connection so I can just so you connect as you can see this is a demo of generating a brew from an existing Circle so if you can see here I will generate the identity you sign a message it's already picked up that um I have already created proofs so this is the two Matic Circle will clean up the metadata obviously so you can signal this um Twitter account what did I write okay I should have shown the the console log there's like a million things happening on the background it generates the Merkle tree it puts that Merkle tree but it will show you on chain later it gets that on chain yeah I just want to show the post as you can see here the post doesn't show like any differently from a normal lens post right here just hello lens from whatever but we have an addition where it's looking for the ZK proofs that are embedded and if we look for that post if I can parse this as you can see here it shows the circle ID and it shows like this user actually connected their their Twitter account and they show proof of Twitter um yeah okay yeah that's uh yeah that's it for me I just wanted to if you guys are interested you can actually try it out it's live on Mumbai and scan this one go to the app uh if you want to follow me on Twitter you go same thing on lens very happy to answer your questions if I also work for lens so I do both if you are integrating anything on top of lens you need help let me know and I'm happy to answer all your questions after this thank you [Applause]
