Encode Club x ETHSafari Hackathon: Worldcoin: Building with and Integrating with World ID

Encode Club x ETHSafari Hackathon 2022 · 8 Sept 2022 · 36:05

Flywall from Worldcoin introduces World ID, a privacy-preserving proof of personhood protocol, to Encode Club x ETHSafari hackers. The workshop explains Sybil attacks, how the Orb issues an identity, and how zero-knowledge proofs let someone prove they are a unique human without linking to a wallet or app. It closes with live coding of a proof of attendance claim, onchain and offchain verification, the simulator for testing, and questions on recovery and privacy.

Topics

From Encode Club x ETHSafari Hackathon 2022, hosted by Encode.

Transcript

hello everyone welcome to the world coin event with flywall and wangechi um I hope you're all well and we're all very excited to have you here um and they're very excited to present the world ID Workshop today if you have any questions throughout this Workshop please do post them in the chat box um flywheel will will be answering them as um he takes the workshop and as he goes along um and yeah I hope you all enjoy handing over to flower amazing uh thank you so much Alex uh great uh seeing everyone and we have a lot of people here really exciting

um um super pumped to be here uh chat to you about world ID World coin what we're building and uh yeah answer any questions that you may have as Alex said feel free to ask any questions throughout uh the the talk on on the chat I'll try to get to them as quickly as possible and uh maybe we'll have a few minutes towards the end to to answer any more questions that you may have uh but amazing let's just jump right in uh so World ID buy World coin what is World ID uh so World ID is a privacy preserving proof of personhood protocol

that we are we we're building as part of worldcoin uh if you haven't heard about world coin uh uh explain maybe in a sec uh but how how did this all start um we all believe crypto is awesome uh one of the big problems that it has is that uh it has very little users uh in terms of the world's population and we think crypto is going to enable a lot of interesting sociological and economical aspects um equality things like that so we we very much want to bring crypto to as

much people as possible so we have this premise of what if Bitcoin started by giving one coin to every person how would that look like today and obviously we can do this with Bitcoin anymore but why not do it with something else so that's why we created the welcome token the working token uh it has a limited Supply and we want to distribute it to as many persons as possible so every human in the world can get their share just for the fact of being humans and uh we run into this issue of you know

how do you make sure that a single person is only claiming their share wants and not claiming the share off a hundred people or a thousand people uh so it it turns into a quite an important problem because if someone claims two times their share you know it's not the end of the world but um as we all know there's a lot of thoughts and things out there and this can turn into more than one and uh so we ran into this issue called civil attacks so civil attacks basically means that you can replicate your concept of identity not one or two or ten times

about a thousand or ten thousand times and game the system which is awful because then if we we end up back at square one where where we started and potentially even worse so uh we wanted to create a solution for civil attacks but we wanted to create a solution that was Private inclusive and scalable so this introduced quite a bit of problems on how we solve this in a private inclusive and scalable way and all of these are very important to us because we want to reach as many people as possible without compromising their

privacy and if it's not scalable if it's not inclusive we're not reaching everyone on Earth who wants who wants to be a part of this so we explore a bunch of options and how to solve this a lot of um a lot of projects have these issues and it turns out none of these options that you see here on the right comply with being private inclusive and scalable so that's why we created this device called the orb and they are basically what it does is it takes a high resolution picture of your iris it uses it to make sure that you're a unique

person and obviously your first person then unique uh and then it issues to you something called A World ID so you go you go to this this device this device will in a privacy preserving way take the picture process it on device destroy the picture but doing in a way that you know if you come back sometime later will know that you've already gotten your share and this is great right because uh you don't need to do kyc you don't need to provide your name or your passport or things like that you don't need to

provide um any personal information there's no like database of images uh it's it it's a very privacy preserving solution um but we wanted to go even further in terms of privacy uh at least for the protocol so we introduced serial knowledge proofs so the whole protocol and everything works with zero knowledge proofs whenever you're using your your world ID it gets completely decoupled and unlinked to any wallet address to any application to um it's completely isolated

and this way we can make sure that we're always perceiving preserving the user's privacy so with with World ID what you can do is you can prove that you're a real person and that you have never done something before so you know I'm a real person and in our case I've never played World coin but of course as we build this protocol we realize there's a lot of projects out there and a lot of applications out there that suffer from civil attacks so it's not just about like I've never claimed World coin but about so many other things so you can think of it like

I've never voted on this or I've never minted this or or I've never created an account here uh you can think of social networks how um they're played with with bots so we wanted to extend this protocol and allow anyone to actually um benefit from from this civil resistance so with World ID you can anonymously verify that someone is a real human claiming something only once and then we decided to extend this a little bit further you know

uh because we're realized uh a lot of a lot of um Solutions out there for how we interact with users and identify users and interact with their information is uh done in a centralized and privacy compromising way so with something that humans can only have once we can enable a bunch of different use cases where you know you can only do something once the the world ID is completely open source open protocol lives on chain and a self-custodial so that means that your world IV

which is essentially a pair of keys lives in your phone and only your phone no one other than the person has access to their world ID only the person knows their their set of keys and whenever they're using it outside they just prove that they they have this set of keys anonymously so how does that look like so imagine you have a website like this where you just want to do an airdrop and you're you're giving away some tokens uh to to users but you want to make sure that Bots don't claim multiple times so

you would just add something that looks like this very captcha-like the user will verify with their world Coin App and prove they're doing something only once of course a developer can easily verify the proof both on and off chain and be sure that something a user is doing some something only once so how does it work actually so from a user standpoint first which is a lot simpler to understand is user go stone or with the roll Coin App uh shows that shows your QR code that contains the public key of the of their

world ID your verifies the the person is unique and issues the world ID by adding the public key to a a public record of verified keys so the user now has their world ID and they can use it to prove continuously that they're a unique person doing something only once in the background it's a little bit more complex because as we said it has this has to be private is one of the main characteristics of the entire protocol so the user has uh a set of keys um the public key is called semaphore

hash and this key is essentially what gets inserted into a miracle Trion chain that uh contains the list of all verified identities the public key is linked to the iris code the iris code is uh mathematical representation of the entropy of the iris that does not allow reversion towards like the the original image but the important thing here is even if you're semaphore hash is linked to your iris code the there is no way of ever knowing which

semaphore hash belongs to a person because every time you use it you use security knowledge proofs so whenever whenever you're using it let's say for claiming World coin then your wallet will generate a Serial knowledge proof that you you know the secret to a semaphore hash that is in the in the Merkel tree of verified identities I will say like please send me my world going to whatever address in in our case for instance in the world Coin App you you can claim World coin up to 10 times every time that you claim is technically possible to receive them in a different wallet address and it

wouldn't be a problem because you are issuing a journal which proof that you're only claiming each share once now um in terms of how it can be used outside the the world coin ecosystem so we have a very a very simple SDK that you integrate on the front end uh and then uh we have two ways of verifying the proofs both on chain and off chain with the developer portal this looks a lot more complicated than it actually is to use it uh but essentially what happens is you you sort of wrap whatever transaction it is that you're doing so

meeting an nft uh issuing a token whatever it is that you're doing and before doing that action you take the user through this zero knowledge flow and verify the proof uh so from this complexity we go to something uh a lot more simple so um let me hear this so you you know the the JavaScript widget on the front end a few lines of code you just tell uh that we did like hey uh insert this captcha box in my in my website and then the widget

will do all the process with the user and then give you the the serial knowledge proof that the user is indeed a unique human and you can simply call our API and verify it that way of course you can also easily verify it on Chain by instead of calling our API you can you can call the smart contract directly and be like this is a proof and the smart contract will uh automatically check whether the proof is valid or not um in terms of the experience the user sees something like this they get a QR code and they'll see a prompt like this in their walkway now where it tells you

like whatever app wants to verify that you're only doing this once so in this case like receiving an airdrop and you can verify or decline if you verify the the app will generate the serial knowledge proof in the background and let the let the app use it uh this has a ton of applications in multiple different uh Fields so it's really exciting there's a lot of stuff that has civil attacks problems everything from web3 to very traditional web to approaches uh of course things uh very basic things like Democratic voting one

person one boat to even more complicated things like person-bound nfts where you know you can always make sure that an nft always belong to the same human but it has ton of applications we have a lot more examples on our on our documentation uh which which you can check out uh here are our dogs great place to start uh developer portal is also super easy to walk you through the process uh and then uh I'm gonna I'm gonna show you just how easy it is by doing a live coding session of how to integrate World

ID so give me a sec to switch here all right so here we go so I'm I'm gonna show you this this application that we have uh in this case we're gonna issue a pull-up um but that you can only claim once as a human so in case you don't know a proof of attendance protocol is an basically an nft that you've interacted with someone met someone um either in person or online it's uh sort of like a batch of you know being be here done that uh it's really exciting uh but you know obviously one

of the premises of co-ops is making sure that like actual humans are claiming it and not bots so we have this example here where you could claim a bot but we want to make sure that users are only claiming it once so right here I have the the a very simple screen uh and then all I need to do to make it to make this work is I'm gonna I'm gonna add the the world coin widget right here uh so first of all Let's do an import ant the widget

foreign let's do foreign should be good what are we missing here should be fine

and then we're gonna load the widget very simply here clean block foreign so this should run the widget let me

just make sure uh things yeah this should work all right let's see oh widgets are unavailable let's fix that so if you're using the widget on next uh yes as it's my case you need to do a dynamic import here because uh the widget relies on uh um uh window to be defined so it won't work for server-side rendering so it's uh it's really important to make sure that you're not importing it remotely um

hmm what is this oh I know what the problem is should be fine now all right we have the widget here it's saying we did some available so we we're gonna easily fix that by setting and action ID so the action ID uh sets the scope for how you're verifying your um usage so you can simply get an action ID from the developer portal that's the easiest thing to do and you can see that the widget here is mounted I get I can get a QR code and verify that that someone's a unique person uh quite

easily here uh so now that now that I have this I could actually generate a Serial knowledge group with my application uh with my world Coin App and prove that I'm a unique human so if you're developing locally of course like you you may have not gone to an organ yet because you need to do this physically but we have we have a simulator that you can easily access in simulator.worldcoin.org that will generate uh test identities that you can use to to um to um go through the entire system so uh it's quite it's quite easy you just come

in here it'll generate an identity here it's inserting it on chain and now you have a verified identity that you can use to to generate this your knowledge proofs as if you have gone to an orb uh an important distinction is if you're doing this in production uh the the the the the world ID contracts currently live on polygon if you're doing this on staging with the simulator the contracts are on the Mumbai test net if you want to stay off of off uh on chain interactions you can simply use our developer portal and the developer portal will easily handle both

cases so as you can see here now I can copy this um this QR code which simulates the the world Coin App uh and it'll let me uh do the run the verification process as if uh as if I was scanning it with my app an alternative is let me see if I can you know it's not gonna work with the with the app uh alternatively you can do it with the app I don't have my phone connected to to zoom so I won't be able to show you that so let's just do with the simulator so that's that's for the front end as so so so as for the back end here comes the important part part you

absolutely need to verify the proof because here you get the proof um you get this you know an electric group that that a user is verified but you need to you need to check it on your end to make sure the proof is valid because here I I'm just getting the proof I don't know if if I'm getting something valid or not so the easiest way to do that would be with our API you can of course do it with um with a smart contract if you're I'm gonna show you in a site how to do it with it with a smart contract but if you're doing it with um with an API request it's just as simple as uh you know get getting call calling our API so

it would be something like this or we just call the verify endpoint and we'll we'll have to send five five attributes to verify approved so first of all is the signal the signal you said uh it's important to send the same signal uh both to the widget and the the API otherwise it won't check out the action idea so you you get this from developer portal um then you'll need to send the Merkle root the nullifier hash oops

and the proof these three parameters come from the widget so they're they're part of the proof the widget will automatically send you this uh this this params so you don't need to worry about those you need to do any special handling unless you're doing this uh on chain if you're doing this on chain uh the proof is packed so you need to unpack it there's instructions for that in our uh repo and then you'll simply get a response you know if if uh verification response is okay then you know uh issue Bob here uh if not well there's

already an error here so it can simply be something like a you know we we send a 200 and send the pull-up URL so uh this will automatically do the group verification for you if you want to do on chain what I what I recommend is uh checking out our starter kit which I'm gonna link here um and with with the starter kit uh you you will simply clone this and then the then

go here into contracts and then as you can see here what's happening is your color smart contract to verify that the proof that a user is registered in World ID and it's generating a ballot zero knowledge proof If the proof is valid the code will continue and then you can just execute your logic here so issue nft or uh an airdrop whatever it is that you're doing if the proof is not valid the contract will revert so you you have this protection here uh easiest way to get started with um and with smart contracts um and well looks like we have a few

questions uh so I'm gonna get to those can you delete your own world idea anytime or for any reason so the world ID is completely self-custodial so if you if you delete your old coin app without any backups your wall ID is gone there's nothing else every time that you use it uh you because you're using it with your knowledge screws like there's no really not no way of tying anything so it's um it for like for for apps to delete it I mean it's not really necessary what as a developer you get

as a sort of user identifier is this concept called nullifier hash so the nullifier hash is a unique hash from the user's identity and the action ID so you can treat that as a unique unique user ID you know that the same person will always have the same ID for yours for your same action and that's how you guarantee uniqueness but that ID is different for every act for every action out there so um there's really no link between actions there's really no link between a person a person's ID and um what's what's happening outside the

scope of world ID so um completely private in that way uh can I give my wallet to use like anybody or have it be used via such things as smart contracts so you gotta share your whole life even to hold principle uh one person one world ID uh so that's only for you however of course you can use it with any applications so any applications can integrate this uh can they they can even integrate directly on chain and it's completely open protocol uh any anyone could use it um

all right so that is let's go back to the to the uh presentation um so we have uh the widget simulator examples everything can be found in id.worldpoint.org uh you can also join our Discord uh we're in uh discord.gg worldcoin uh you can um ask us any questions about ideas that you have any technical difficulties that you're running into we're happy to help uh we do want to give a huge shout out to some open source projects that make the whole world ID and Whirlwind protocol possible uh semaphore is what

we use to generate all these zero knowledge proofs Hubble uh where where the worldcoin token lives and while I connect which we heavily use to connect the worldcoin app to the to the developers applications wouldn't be possible without them uh and finally we want to share a little bit more on what we're going to be working on for this protocol so um right now we are in a beta phase uh we have the the developer portal we have this in production it fully works but it's uh we haven't made an official announcement yet as we go along we'll do that we want to Port these over to

multiple chains so right now it's as I said it's only polygon but this can be easily replicated across multiple chains so that you know any developer can use it wherever they want we're working on making it more scalable in terms of uh gas fees uh for for insertions you actually don't need to worry too much about that and make it completely available to anyone who wants to use it um so it's a summary World ID um we're we're solving civil resistance at scale in a private inclusive way um it's completely self-custody user

user has their role ID and no one else it's open source and open protocol uh and it's very easy to use for Developers and I'll leave a few minutes for any questions that you may have been any of you have questions feel free to post them in the chat or even um you can take yourself off mute and ask it um on yeah Zoom we've got one question yeah what what if uh what if I sell it uh very interesting question so uh one thing that we're working on is recovery of your wall ID imagine you you lose

your phone you lose your backup God forbids but it's possible to lose it right uh so one thing one very important thing we're working on is being able to just go back to another and say like hey I'm here we'll revoke the old one and we'll issue you a new one so that's also what heavily descent disincent devices you to sell it or especially for someone to buy it because why would I buy something from you that you can just go around the corner and get back so um that's that's how we're tackling also right now it's not possible to export it export the world ID part from

the from the world Coin App obviously it's not impossible um but we're working on all these mechanisms so it's not possible to transfer it this is meant to be one one for each person right so the app on Play Store for the airdrop I need to get an operator uh how do I get one so uh we have a map of operators on the on the app we're working a lot on getting more and more operators on the ground um if uh for development you can just use the simulator and should be completely useful for that

simulator.worldcoin.org and you can just use this on the staging version it's exactly the same thing uh so World ID will have history no it does not have history in terms of like every every developer chooses uh what what to use with that uh so it it's really like if you use your role ID to claim an NFD say with with app a and you use your wall ID to claim another nft without B there's no way to link those so that's why very much the challenge right now we're facing is it's so private it's uh hard

to to figure out this recovery part so that's what we're working on right now um what changes World ID support polygon if you're using production polygon mainnet if you're using staging Network Mumbai and uh if you're using it off chain anything it's just an API any last questions from anyone amazing well thank you so much uh it was great chatting with you we'll be around on Discord feel for you um ask anything that uh comes up and yeah really excited uh to see what you

guys build thank you so much awesome thank you flywol and thank you to the world um coin team for being here today and giving us this Workshop we really really appreciate it um and thank you all for coming to this workshop and we enjoy hosting these events um if you don't mind do you mind switching on your cameras I'd love to take a quick screenshot um to post on Twitter to show everybody that we have such awesome workshops happening so switch on your camera and do what theater is doing um pull some peace signs stick your tongue out make a funny face you can even like do a reaction on the Emojis

like this so that'll be awesome all right I'll count three one two three awesome I think there was a total of four of us who put our cameras on thank you so much for coming um we really appreciate it I hope you have a lovely day and if you have any questions please ask in the technical questions Channel and we'll be there to answer it awesome bye [Music]