Global Proof of Personhood with World ID - ETHGlobal Singapore 2024
ETHGlobal Singapore · September 2024 · 32:13
Ian Dilick, who works in developer relations and partnerships at Tools for Humanity, asks how to tell a real, unique person from a bot online. The workshop compares email, government ID, web of trust and biometric approaches, and explains why World ID relies on iris verification with the Orb, MPC-split iris codes and a Merkle tree on Ethereum. It covers sign in with World ID, incognito actions, onchain proof verification, and use cases such as voting, airdrops and free trials.
Speakers
Topics
From ETHGlobal Singapore, hosted by ETHGlobal.
Transcript
[Music] all right hi everyone I'm Ian I do developer relations and Partnerships at tools for Humanity supporting the worldcoin ecosystem and I am here to tell you about global proof of personhood with World ID so in this workshop I'll go over what world ID is how you integrate World ID and what you can build with World ID one some of the use cases that it's really well suited for so World ID right if you have World app on your phone our mobile application
you might recognize this little passport right but what is World ID actually built for World ID is built to answer this very big very important question how do you know who or what is a real and unique person especially on online right AI is getting better and better at well pretty much everything it's getting so good at solving captas that the captures are getting too hard for humans to solve and when captures stop being an effective way to tell humans from Bots online a lot of websites are going to start resorting to things like asking for a photo of your driver's license or your passport which is bad for your privacy and also bad for
accessibility a lot of people don't have government IDs right we've built World ID to be private inclusive and robust right so in terms of privacy we're not interested in who you are just that you're a real human who's only signing up for World ID once we want it to be inclusive we want it to be as accessible as possible for people all around the world right as I mentioned less than half of the global population has a digitally verifiable government ID which can make it actually quite exclusionary if you stop using cches and instead need people to verify like a passport and we also want World ID to be robust right we want to make sure that
when it's being used for civil resistance that it is truly one person one world ID right other mechanisms that might have been used in the past for civil resistance like hey one email One account didn't work super well that's why I got a whole lot of Netflix two we free trials so with all of this right there's a lot of different ways that we can try to identify that this is a real person right email or phone don't really work super easy to get multiple emails super easy to get multiple phone numbers but they're at least accessible right we
looked at doing kyc of official government IDs but as I said less than half of the global population has a digitally verifiable government ID and that also causes some problems in terms of scalability we looked at web of Trust Systems scalability is also an issue there right a web of trust can work really well for you know a community right a few thousand people but most existing web of Trust Systems really cannot scale to all of humanity right they'll start with an initial trusted set somewhere in the hundreds or maybe you know single- digit thousands of initial trusted users that Define like the starting state of that web of trust but to scale to you know billions
of people you're going to have to be a lot of hops away from that initial trusted set and in a web of trust system the more like trusted verifications that there are between you and that initial trusted set is inherently the less trusted you can be because there's more opportunities for ulent verifications so we settled on using Biometrics as sort of the basis for World ID and when it comes to Biometrics there are plenty of different biometric factors that you can use we looked at fingerprints face scans Palm scans right the things that people might already be more familiar with but those actually don't scale super well to all of humanity Right Touch ID or face ID on
Apple devices can distinguish about 1 in3 million people which for unlocking my phone I love those odds right that six-digit passcode there is a one in a million chance that someone guesses that pass code right on the first try right but with face ID that's one in 30 million and it's also not something that they can change or try to Brute Force very easily right I love the odds that in the US where I live there are about 14 people in the country who could unlock my phone with their face if they stole it and yeah I feel really really good about those odds if you're one of those 14 and manag to steal my phone you know what good on you you've earned it so the full other end of the Spectrum
in terms of how unique some of these biometric factors are we looked at DNA but it's not nearly private enough right there's no way that we could do anything with DNA and say that we don't know who you are as a real human right so what we settled on is the iris it has lots of entropy it's extremely unique right even like identical twins will have very different irises and it's something that doesn't reveal very much at all about who you are right especially if that image is like infrared instead of RGB right so you don't even see like the color of the iris you might see you know if it's light or dark but it really doesn't tell us anything about who you are just is
something that is very unique to each person doesn't change very much over time is like very difficult to change intentionally and is not something that you can capture very passively right so in terms of how we get those Iris biometric scans we looked at sensors and cameras on phones already today they don't have a high enough image quality to actually look at the pattern of your iris at a high enough level of detail to distinguish that you're unique at the scale of all of humanity and there is some existing hardware for things like this again in the US I use clear for getting through airport security where rather than you
know checking my ID they take an iris scan um similarly actually the uh Vision Pro from Apple with optic ID fundamentally uses this exact same technology of looking at the pattern of your iris but with the off-the-shelf hardware it was clunky it was really expensive uh often times still wasn't uh the level of detail that we wanted uh so we settled on building custom Hardware right and this is how we've started with we want to know who's a real human and who isn't and turn into a hardware company and if you've ever like worked with Hardware you know it's a total pain it's super expensive it's very slow but for this very big very important problem
it's absolutely worth it so this is the hardware we've built this is the worldcoin orb the orb has been in development since early 2020 and gone through quite a few different revisions uh but the orb's job is to make sure you're actually a human there's over a dozen machine learning models running locally on the orb checking that you're not a cat not a dog not a photo of a human not a mannequin head right the orb takes a photo of each of your irises and on the device calculates the iris code that digital representation of the pattern of your iris and then that Iris code is checked for uniqueness in an MPC system that stores uh the iris codes of everyone who's ever verified at
the orb but split into multiple secure shares so there's no one entity that has your full Iris code after that Iris code is verified to be unique your world ID is now verified and the public Key Of Your World ID is added to a Merkel Tree on ethereum Main so everything here is built to be privacy first decentralized and open source right we never ask your name your email your address your passport number anything like that because we aren't interested in who you are just that you're a real human in terms of decentralization right when it comes to Bringing World ID to other chains right you can permissionless Bridge those
routs from ethereum mainnet to other blockchains the worldcoin foundation is focusing on the decentralization of the protocol it an even lower level right exploring having other companies build manufacture and operate orbs or even design alternative orbs from the ground up um and in terms of Open Source every single smart contract that we Deploy on chain as part of the protocol is open source and available on GitHub today 95% of the orb Hardware is open source and the majority of the orb software is open source and we are gradually open sourcing more and more of that which isn't already open sourced so World ID has a lot of different
potential use cases right knowing that your user isn't a bot knowing that your user isn't civil attacking and has one account per real human can be useful in a ton of different scenarios right voting is one that's always super obvious right you want to know that each vote was cast by an actual person but you want your vote to be anonymous for social media we've seen that paying $8 a month for a check mark does doesn't really do anything to fight bots on uh a very big social media platform that I won't call out by name but you probably know who I'm talking about right in terms of airdrops obviously you don't want airdrop farmers and civil attacks uh and customer incentives are one that I specifically
find quite interesting right I mentioned the Netflix free trial earlier I always say like the one of the killer use cases for World ID would be bringing back the Netflix free trial because the problem for Netflix was that people would just never actually pay for Netflix they'd spin up a new email account get another twoe free trial and then two weeks later do it all over again with World ID because you as one human have one world ID if they gate that free trial behind World ID they know yes this is a real person like not a bot they get this free trial and then if you try to claim that free trial again with a new email you still only have the one verified World ID you can use
so you're only going to be able to claim that free trial once and if you want to finish up that season of that show that you were halfway through at the end of that twoe free trial well you probably got to pay for Netflix we've also built World ID to be super easy to integrate right you can use it across web mobile and onchain applications and there's two main ways to integrate World ID sign in with World ID which is pretty similar to sign in with Google sign in with Facebook sign in with apple right using the same standard and then Incognito actions which are a little bit more custom uh a little bit more powerful uh more
directly interacting with the protocol but uh requires a little bit more manual configuration in the process so to start we'll talk through how you can use signin with World ID but first I'll show you what it actually looks like to use it and I will sign into our developer portal here so developer. worldcoin toor is where you can find our developer portal so I'll click log up here I'll choose to sign in with worldcoin and it'll show me this QR code so from within World app I'll actually scan this QR code and then I'll verify with World ID to sign in to the developer portal here and then it will redirect me great
so I'll actually walk you through like creating a new application real quick so for my app name let's just say eth Global Singapore uh I have to choose a staging or production app so for a staging app I won't use World app as a user I'll use the simulator and I'll walk through that a little bit more later uh if you're using your app onchain you will use a staging app for test Nets and a production app for main net chains and then you'll select cloud or onchain so if you want to use signin with World ID you have to select Cloud uh for Incognito actions you'll select cloud or onchain depending on where you're going to verify the zero
knowledge proofs and again I'll describe all of that in more depth later um but as part of like highlighting signing with World ID I figure I'll walk you through a little bit of the developer portal so I may let's make a staging Cloud application here and for in Cognito actions I can create an action but let's just look at sign in with World ID right I'll have a client ID I'll have a client secret here I'll add in some redirect Uris um and the whatever like off Library you're using should explain a little bit more about that uh so now that we know like where our client ID and client secret are and where to add the redirect URI let's look
at how we would actually integrate signing with World ID into our application there's lots of different ways that you can integrate oidc open ID connect right that's standard used by signing with Google signing with Facebook all of these other major like Integrations for signing in ozero is one way next.js is a great library for this that's what our template repository uses uh you can use your own oidc o library with our oidc well-known file for quickly uh configuring everything you can custom implement the oidc flow but what I recommend is sticking with nextjs it's generally the simplest most configurable easiest to get going with
and as I said what we use with our template repository so with nexo the only configuration you need to add support for signing with World ID is this code snippet here right this is the snippet for one single provider and again like you don't need to Snap photos of this this is in our template repository uh I promise it's a lot EAS easier to copy the code from GitHub than from the photo on your phone um but I just want to talk through it here so you understand what's going on right so you set an ID the name of your like signin provider here I mentioned that well-known file which just includes a lot of machine readable
configuration uh for signing with World ID as like a sign-in provider that other apps can consume so it tells it where to exchange and access token for uh or sorry exchange an authorization code for an access token right all the like really meaningful little details that you don't want to have to worry about so you just give it this link and it has the configuration now uh we will have the client ID and client secret that we configured in the developer portal and then we're mapping the information that we get back from Sig in with World ID to a user profile right so in oidc terminology this user sub is uh like
just the identifier of the user because in World ID we don't know a user's name right we'll just return that sub as the name of that user as well um in this case the sub is the nullifier hash the unique identifier of the user in the context of that application and action so what this means is that for me when I use my world ID to to sign in to two different websites they get different identifiers for me so even if they try to share their databases with each other and collude with each other they can't tell that I control these two accounts on these two platforms unless I choose to provide
other information to them as well right I could choose to set my display name on both websites to be e and dilic right I could use the same profile photo on both but that's information that isn't provided by World ID that's information I get to choose to provide similarly I can choose to be fully Anonymous on one platform and fully doxed on the other right but there's no way to De anonymize that account because I was doxed on some other account that Ed sign in with World ID nobody not even worldcoin can tell that those two accounts belong to the same person and one other thing that we return in the profile here is this credential type or verification level
right we talked about the orb verification right using this Iris code to make sure that you're unique and if only signed up for World ID once but we also have what we call the device verification level where just for installing World app on your phone it will check to make sure it's running on a real phone right not in a virtual machine not in one of the like app cloner environments on Android uh and provide a better than average Cil resistance mechanism right it's not really able to attest to humanness right but it is able to at least say like well this is a real mobile device right so your cost of a Cil attack right the cost
for every extra device verified World ID you'd want to get would be the cost of another mobile device that supports World ID and supports World app so that device verification level is good for accessibility right users don't need to go visit an orb they just need to download and install World app but it's not as strong as the orb credential so with this depending on which verification level that user has your application gets to know is this someone who's orb verified or is this just someone whose device verified and you might give some more privileges or a nice sign up bonus to someone whose orb verified that you wouldn't give to
someone whose device verified that's totally up to you but that's everything that you really need to know about how to integrate signing with World ID it's meant to be really really simple right I was talking to someone earlier and they're like am I eligible for bounties if I just like integrate it integrate signing with World ID and I'm like yes it like literally the point is that it should be that easy right bot resistance and Cil resistance are useful for almost any application you can think of and it shouldn't be like a complete pain to to protect against civil attacks in your app so now I'll talk a little bit about Incognito actions with Incognito actions you're
learning that your user is a unique human doing an action only once or whatever number of times you want right that can be an infinite number of times that can be three times that can be 10 times but most use cases will limit the user to doing something once right like verifying a social media account right so in a voting use case for example that signal might be who you're placing a vote for in this election right something where if that value is different at all between when you're generating the proof and when you're verifying the proof the proof won't verify and the sort of basic flow here is that uh in your application you'll
integrate our widget and it'll show a QR code to the user the user scans that QR code and that will uh let World app know what application and action it should generate this zero knowledge proof for then it will generate the zero knowledge proof when the user presses the button to generate that proof and then that zero knowledge proof gets returned to your application and your application will verify that zero knowledge proof either with our smart contracts on on chain or with our developer portal API offchain right so let's see what this actually looks like as a user so here I'll use our simulator instead of World app right so for a staging
action here we've just got some action identifier that got made up here I'll click continue with worldcoin and this opens ID kit so for a production app or if I want to run the simulator on my phone which you can do as well I would scan this QR code with my camera but for a staging app to make it a little bit easier you can actually just click on the QR code to copy all the information in there on the simulator click paste code and paste yes I'll allow it to paste and that function is the exact same as me scanning that QR code from my phone so now I'll say verify with orb because I set this action to require the orb verification level um but for the
simulator right you get to choose which verification level you want to use in World app it will just use the orb verification level if you verified at the orb or it will fall back to the device verification level so I click verify with orb the simulator generates the proof sends it back to ID kit our front end widget and it has called our developer portal API to verify that proof quite simple right so everything for your integration with uh World ID starts with ID kit ID kit is typically used as a react widget we have a vanilla JavaScript
version uh if you're interested in that um we've also recently launched uh Swift and cotlin libraries we have a rust library that is occasionally used uh so if you're not using uh the react version or the vanilla JavaScript version might be good to come see me at the booth and we can talk a little bit more about details there of how to use those other uh libraries we provide but here it's just the single react widget we have our app ID from the developer portal the action that again we configure in the developer portal you can create multiple of those for an app ID or you can create just one on success
and handle verify are two callback functions that I'll talk a little bit more about in just a second and then we can set the minimum verification level that we want to require uh so if you're using typescript we have this verification level enum where you can just say verification level. device or. orb um by default it requires the orb verification level right so this zero knowledge proof that you get from World app looks like this you have the root of the Merkel tree against which you need to verify it you have the nullifier hash which is the unique identifier of the user in the context of Your Action you have the actual Zer knowledge proof Pro itself
which is this really long heximal string and then which verification level that user created a proof with and this proof response here is what's used as the input to the handle verify and on success callback functions right so we receive this proof and we get it as the input to this callback but we have to verify this proof right I cannot make it clear enough that we have to verify this proof if you do not verify this knowledge proof right if you just console log it and go great we're moving on you will not be eligible to receive our bounties right you have to verify that proof so one way to verify that proof is
with our uh developer portal API so you can take that proof and pass it back to uh your application's back end and I saw a few phones pop up we again have a template repository for this like all of the code you see here is public on GitHub so please I don't want to have to deal with like trying to help people copy it off of images on their phones um so you pass this proof object to your applications back end we have this verify cloudproof helper function for calling our developer portal API right and you give it that proof the app ID action and signal that you configured right make sure that signal
is the exact exact same as what the signal was in the ID kit and then we'll get a response code of 200 if it verified successfully or 400 if it didn't for whatever reason um with those uh callback functions handle verify is great for the uh developer portal API verifications because ID kit will call handle verify as soon as it receives that proof from World app and if you throw an error in the handle verify callback function that error will be displayed beautifully in World app or in ID kit
excuse me so when you're in that situation where you can immediately take that proof pass it to the API get a response if it worked or not and then display that to the user it generally creates a better user experience on success gets called when the ID kit widget is closed so if you're doing this uh Dev portal API proof verification on success might be where you choose to redirect the user to the next page now that they're verified right and one other note uh that I will say is if you're having your user like verify their account once with World ID and then you're storing that their account is verified with World ID
you should be updating that user in your database in your backend right don't like return that the proof verified successfully to your front end and then make another call to your back end from the front end to say that this user verified right keep things within the secure context of your back end as much as possible now for onchain verification slightly more complex not really all that difficult either so in our Constructor we'll set uh the world ID router contract address uh which you can get from our documentation I'm happy to help you find that for whatever chain you want to use
if you just come over to our booth you'll set the app ID and action ID from our developer portal just as before and we're calculating the external nullifier uh which in the terms of semaphore right the protocol in which World ID is based that is the scope of uniqueness for the thing you're performing for us it's just that we hash together the app ID and action idea specific way overall it's not super interesting we have the code that does all this again so you don't need to worry about it too much and then we'll have this function that for our example here we'll call verify and execute right this is like within your smart
contract uh you'll take in the signal rout nullifier hash and proof uh that you get returned from ID kit right four apps that are are using on chain verification we see that handle verify callback function used a lot less and we see a lot more of the on suuccess callback function being used to just temporarily store that proof object returned from ID kit and then using it as input to a Smart contract call on chain so in this function uh we've got this mapping of nullifier hashes to Boolean uh that should have been defined in our
Constructor and wasn't that's my bad uh that's just saying if we've seen this nullifier hash before and if we have we want to revert because we only want to let users do this action one time the key difference between onchain and cloudproof verifications is that for cloud verifications our Dev portal will track how many times the users perform that action you can set how many times you want to allow them to do it there for onchain proof verification you have to do that in your smart contract yourself right and this is an example of doing it for only allowing the user to do it once so once we've made sure they haven't already done this action we call verify proof on the world ID router smart contract right we pass in the root
the group ID will always be one because we only support the orb verification level on chain if you want to use the device verification level you must verify the proofs with our developer portal API so that group ID will always be one uh we have hash the signal in a specific way for this proof verification we pass in that nullifier hash that external nullifier that was defined in our Constructor and the proof itself if something about the proof doesn't verify that will revert if the proof does verify it will just continue it doesn't return a value or anything like that uh it will just prevent further execution if something goes wrong otherwise we'll
just move on to marking that nullifier hash as true in this mapping so that we can prevent the person from doing that action again then after all that is where you should put in the functionality for your smart contract to do what you want after you know that your user verified with World ID that can be minting some tokens to them that might be storing their wallet address in another mapping to know that that wallet address has been verified with World ID and check that for other actions and other functions in your smart contract but well your functionality should come after everything that I've described here and again we have a template repository for
this we have 20K in prizes pretty simple use World ID for things where bot resistance or civil resistance are useful be creative about it uh and then we have two separate prizes for governance and public goods use cases for the prize pool again you have to verify the proof you have to integrate World ID correctly you you have to make a good faith effort to integrate World ID correctly right but if you just like slap ID kit in your package.json and then don't do anything with it anywhere you're not getting the pool prize sorry not sorry so that's everything you need to know you can go to worldcoin [Applause] toorgle
repositories and if you have any of questions please come find me at our booth and I will be more than happy to help you out [Applause] [Music]
Related talks
- Global Proof of Personhood with World ID -ETHGlobal London 2024
- Building for Real Humans with World - ETHGlobal Bangkok 2024
- Polygon 🛠 The Future of Identity is Self-Sovereign: Build a dapp with Polygon ID - Steph Orpilla
- Introducing Self Protocol
- Worldcoin 🛠️ Global Proof of Personhood with World ID - Ian Dilick
- Ensuring Privacy in Digital Identity to Prevent a Dystopian Crisis
- Self Sovereign e-ID Schemes & Privacy Challenges
- Zero Knowledge for Private Identity on Public Blockchains | European Blockchain Convention
- ZK Identity With No Compromises
