Polygon 🛠Building a Lens Issuer using Polygon ID
ETHGlobal·Mon, Oct 9, 2023, 12:00 AM
Join Tony Olendo for workshop, "Building a Lens Issuer using Polygon ID". Some of the most skilled web3 developers, designers and product builders from all around the globe came together for a weekend-long hackathon at ETHGlobal New York 2023. ----------------- Follow us: https://twitter.com/ETHGlobal​ Check us out: https://ethglobal.co​m Email us at: hello@ethglobal.com
Transcript
foreign [Music] Orlando I am a developer relations engineer at polygon and yeah developer releases Julia polygon and I lead the developer Education team and today I'm here to talk to you about the exciting concept of self-solving identity and polygon ID specifically um introduced to you like what what what polygon ID looks like and show like the intersection of polygon ID and lens essentially because um one of the most powerful use cases of identity is in social media and so imagine if you could like verifiably discover who that tool was polygrin you wouldn't actually enable you to be able to track them down like like Liam Neeson would like you to right um so how do we get started with polygon ID let's first Define it uh Poland ID is essentially a tool that uses zero knowledge proofs to let the user prove their identity without exposing the private information right which is which is a really important concept but when you look at it practically it means that I could attest to my job history and I could say yeah so my name is Tony I've worked at polygon lab since that date and um I previously I worked at coordinate shout out coordinate um up until that day and so from there I could like see like um um I could Define a schema for my data and say um I want to store data for everybody um who uses my my uh my system and be able to Define like the um the name of the organization the organization that employed them the roles that they had whether or not it was technical or not and the start date right um but I could also use it to Define simple things like even like a data schema that just defines whether or not I have a dog and um I could define whether or not I have a dog if I have a cat and then the total number of pets I have right so this is a picture of my dog um uh so I can Define the pet ownership yes yes I have a dog no I do not have cats because cats are evil and um I have one pet right so how do we know these these uh these claims are true right so we need somebody to be able to actually attest and say well do we have a third party or something somebody who could like authoritatively say that yeah I do work at polycon how about polygon HR or HR recorded it you know so we could actually we could actually find a source of truth that we could use to be able to attest to this information and what that is that particular the artist station is called a verifiable credential or a VC and it means that um basically that you could have one or more claims that are made by a trusted issuer so say um when you start a new job and somebody has to go and like call your old job and be able to say well um did did um did Kim actually work here and you could be able to say yeah I came actually worked there um and then that person leaves with the with it with the definitive trust that yeah you actually work there and they could actually test to you to your particular um employment history that you that you divide but if you're gonna if you're gonna Define it like technically essentially it um um a variable credential is is basically samples of two things one one is a claim which is a basic assertion made of the about a particular subject and then the credential is essentially a set of one or more claims that are made by an by an issuer and so a verifiable credential is a Tampa evidence credential that has authorship that can be that that can be cryptographically verified um and so when we actually issue a verifiable credential this is what it would potentially look like right so if we have this preferable credential that is like my uh a job held Occidental where I could say well this is this is who employed me this is whether or not I had a technical role or this is a start date that essentially forms a schema um and then if we if we have communication and contact with you with your previous employers we could actually authoritatively State yeah you employ the polygon labs and you will also employed by coordinate right um but then I can't really my dog can't adjust for itself and say yeah um um it was it it actually worked at NASA or something of that sort like it doesn't necessarily work that way right so you need to find a natural Authority that could actually become an issue of said uh verifiable credentials but at the end of this um at the end of all of this you've introduced um a couple of different concepts all of them are really important but the main thing to remember is that when we're looking at like decentralized identity and um our variable credentials they essentially comprise of three three primary actors right so you have an issuer an issuer could be you could be a DMV it could be the university you went to it could be the college you went to it could be um um any any government body um and basically they are the ones who could who could make attestations about you as a subject or any other subject that you're actually dealing with and then you have an identity holder who is me and you so you and I have an identity um and the and the identity holder holds these These are these are particular claims or verifiable credentials inside of a wallet and using using that wallet I can now present um the the verify book credentials using zero knowledge to a verifier and the most significant piece of that is that you could imagine if you're going to buy alcohol and you have a verifiable credential of your birth date then you could actually just present just your you could actually present just whether or not your you you're actually above 21 without necessarily revealing your actual birth date so that's that's one of the easiest and simple ways of looking at it but if you look at it in uh in practice I could actually um have my former manager Liam at uh at coordinate issue me a verifiable credential using the schema that we actually defined and the schema has about three different claims um the name of my former employer whether I had a technical Rule and my start date and using a zero knowledge proof I can now present that information to a particular issuer and the issue of doesn't need to know the full details all all they will need to know is whether or not I had a technical role and we could actually just give them just that succinct piece of information and leave out the name the name of my previous employer or even my start date so that's the kind of flexibility that we would see when you're looking at uh cell server Solutions um well self-solver and identity Solutions such as polygon ID and others um but let's just kind of expand this to a concept that I guess we actually mostly familiar with at least I hope right A Room of people of culture I'm sorry imagine everybody's knows Harry Potter right um yeah but basically you could think of like um the the uh the uh issue example being like the Sorting Hat that would essentially issue Harry with the credential that says you are of house Gryffindor and what that does is that if you if you actually have that then um the verifier could be um could be like a Magic Door and when you go to the Magic Door it basically unlocks like a Gryffindor common room or it could be the team captain and because you're of house Gryffindor you could then be eligible to join um the Quidditch team so those are like simple simple a simplified example of how you should actually like conceptualize how how you could use polygon ID in the in the absolutely real world that is the Harry Potter Universe right because it exists um so let's just break down further like the uh the components of this we have the polygon ID wallet that basically holds your verifiable credentials um it basically and what it does is that it does two two primary well three primary things it holds your it holds your verifiable credentials um it also interacts with with an issuer who basically fetches where it basically fetches at stores verifiable credentials and it also interacts with a verifier to share zero knowledge proofs based on send verifiable credentials right um so this is what it looks like like when a credential is issued you start off the process with um the the offer and then the claim is added and it now exists spotted at the pit and when you open the verifiable credentials you could see various claims inside of it that are like whether or not you're allowed in the pit the number of projects built the data was issued uh the the ID of the issuer whether or not it's expired and uh signature well with the type of proof I won't go into signature proofs in this particular talk but that's essentially what it looks like and verification is fairly simple um you would basically be you'd basically open up your polygon ID wallet and scan a QR code that would be used to verify and from there you would like generate a proof internally and make that available and whether or not um uh you actually have access to to to whatever VC gated tool you're looking at you would then be given access this way um so that's that's the standard workflow in the context of verification but let's talk about lens right which is the fun thing that's why most of you keep I'm at um yeah so lens protocol is basically our three social graph built on the polygon proof of stake blockchain for now um and uh when we look at Lens I'm going to go through like so I'll start off this presentation because we all know how great conference Wi-Fi is I pre-recorded this just to ensure that you know we have a consistent experience but this is a um an example that shows like the workflow of how of how you would use you would use and you would use an issuer to build a front-end that issues credentials based on your lens Pro right so you start off here where you have the lens application so you you first first of all log into lens as you can see signs a transaction um and gives you all that information and once you connect boom you're in so it has like your buyer information the number of followers and the and the people who are following you and then we create an issuer which is the first step of this another issuer will then create a um so the other stage I'll just explain what's happening here so first of all we actually create an issuer so your app becomes becomes an a issuer that issues credentials right so so you could think of it like a lens issuer that you actually created in this stage and then from here the user would then enter their did from their polygon wallet and once and and once they enter the did generates a QR code and they have a QR code so now we have a verifiable credential that we are using to prove the number of followers that you actually have right so um if you scan this piece of information well it's just kind of the QR code it would automatically add a um a verifiable credential to your polygon ID wallet with with the schema that we actually Define so why is this useful um it actually provides a greater degree of trust um and the follow the number followers example is it is it meant to be like the absolute killer compelling use case but a really good demo of what it looks like for you to consume data from the lens API stick it into a verifiable credential and issue it to a to a user who will then hold it inside of their wallet um so let's go through the process of what this looks like I have the sample code is available there you could actually go through and and look at it like from the beginning to the end um and um it shows like the entire life cycle from when you start off from getting the from logging into lens all the way through to issuing the QR code and there's a dependency on qr.io there that a movie that will be able to figure out how to how to manage and like mitigate in the initial instance but it should be easy for you to do so what does the process look like first of all we set up an issuer node and then we create an issuer and then we design a schema um after we decide a schema we query the lens API and then we issue a verifiable credential easy right easy but let's go through it step by step um these are the things that you'll have to do once so you need to set up your issue a node that you only need to do once you need to create an issuer that again you also need to do once and store your issuer did uh and the ID is your decentralized identifier or or identity you need to you need to design a schema that essentially is like a shape of the data that you want to you you want to send to the users polygon ID wallet and then from there you could uh when they when when a new lens user comes to your dap they could essentially query you could actually have them log in and you query the lens the lens API and you're issuing a verifiable credential all day right um so first of all you start off with the issue a node setup so this is where you actually go to set up the issuer node um this uh on the left is the code and the docs on the right I'm not sure if it's your left or my left I'm left-handed so it always like compensate and get things wrong it makes diving around the new sitter is really really fun um but anyway you could actually get set up and I have a tutorial that shows you like a step-by-step guide of getting started with a polygon issuer node so you could feel free to watch that um sorry if the QR codes are coming up really really quickly um but you could just check out um YouTube polygon ID issue a node and it'll take you through the full process and I think I also have a video aside from that as well so you've successfully managed to set up your issuer node what to do it's probably running on some cloud provider or you're running it off of your computer locally or you know you Wrangle the digital solution droplet to be able to do whatever whichever whichever configuration works for you um then you could create an issuer so let's go through the process from a code standpoint it's really really straightforward all you need to do is to send a request to slash V1 identities and you're sending in three bits of information um the method which is uh the the uh the standard like polygon ID schema that you want to be able to divide for your Debs which basically um is the um is how how polygon ID [Music] dids are actually defined um uh you have the blockchain which is uh the blockchain that you want to use yeah you want to use polygon and the specific Network you want to use is Mumbai and when you do that you get the response on the right right cool well you get a response below where it says response on your screen or wherever you're looking at this from um and the main thing you're looking at is like the identifier and that's your did um and the did is what you want to store and so now um you're able to have an issue and that did is what you would store inside of your database and every other person who comes for a who who comes to get a VC from from you would actually get a verifiable credential backed by this particular date so then the beauty of it is that we want to talk about like schemas uh which is a final step in terms of like making sure that you're able to actually um have a reliable set of data that you could use so a schema essentially encodes the structure of a particular verifiable credential and they allow you to to they allow for interoperable use of VCS across different Services um if you have a schema you could actually combine various schemas during uh well various uh verifiable credentials um when you're actually doing the verification later on and the schema components are basically defined on two primary things which is your Json LED context which is a description of the type and this fields and the schema which contains the validation rules for the for the specific issuer node um so if you want to if you want to build your own schemas you should check out the schema Builder which is on your left boom I finally got it right like 20 minutes into the talk but anyway on your left the schema Builder really really good tool for you to be able to understand like what it looks like so please do not roll your own schemas just use a schema Builder um it like it works really really well um and if you want to understand how to build your custom schemas you could do that um and it will show you just how to add the bits of information um a small caveat I'm not sure if that was actually fixed but sometimes you have to click out of the focus area for you to actually click the button so it can be a bit frustrating we are still working on the ux for the schema Builder and next to it you can see at the very top you have the query Builder as well which on the verification side which I'm deliberately not covering on this talk um um would actually enable you to actually get started with that [Music] um so now you've done all the things you need to do once so you have a schema which basically is the shape of your data you have an issuer and you set up the issuer node so let's get to um using your uh your uh actually creating like the uh the VCS so for this particular example the top the top part assumes certain things that you've gone to lens and you've gotten a figure for the lens followers and you've gotten a figure for the lens ID and so what what we're essentially doing here is that the the schema that I'm using in this example had um two two uh two primary bits of information that were storing lens followers and lens ID and what we're doing which is really important and and I sort of pointed out earlier is we're using the ID in the credential subject and we and we're actually using the did that we created for our issue so that's your custom issuer right so anybody building here will have different dids for their personal issuers and that's what you actually include when you're generating the verifiable credentials and from there all you'll get is a claim ID and once you get the claim ID you could actually um added to the request so if you select the path at the very top so you have a claim ID and if you if you request that you get a QR code so this is the body that is basically encrypted in the QR code so once you actually request this this is what you get back and that's what you send to qr.io and qr.io generates the QR code that is presented to the user and once the user scans that it's it's embedded in the in the polygon ID wallet and that's like the full like workflow of getting from basic tool like fully set up to issue credentials uh so again I'll go through by sample application just to hopefully tie the concepts together you log into lens first of all um once you sign in you week then query your lens profile and get bits of information about two so we have the number of followers you have and who you're following uh we take your reticulars ID we created issuer and from the issuer we get a did the did is then the user did and then we create a verifiable credentials that we generate a QR code and boom the QR code is created the user scans this and it and enters their wall um so that's the full workflow of issuance um again if you want to look at the sample repo it's available here um for you to actually review um and I'm giving it oh okay one person is scanning in the meantime I'm I was actually going to sing while you were presenting but you actually finished really quickly so you everybody thanks you um this wasn't supposed oh yeah sorry building a VC gated app so if you want to do like a verifier Steph um who used to be with polygon did a really good um um repo I mean like talk and has a really good repo on the verification piece right so I've shown you the issue inside which is all we have time for um if you go back to East Global the East Global YouTube and you look for a talk titled building a VC gated dap um you'll see Steph stock and Seth stock covers like the the catch section I've showed you the pitch right so the pitch on the catch is kind of covered and you could see like a full a full service example of what that looks like and once you have that then I think you have all of the pieces that you need from the issue inside and then you have the verification side that you could then continue to use um but basically her her her her VC gated app was really cool because he it it would it was asked the user to prove that they were born before 2023 to view right so um most of you here would be eligible um I hope but yeah uh it was a really good example there this is the schema and this is the request so you basically just request that you say um we make sure that the birthday is less than the start date like the year that you define and this is the the this is the request that you that you actually build and everything else should be easily verifiable on the other side so questions 404 is her GitHub full stack polygon ID VC gated app shows you the verification side of things which I encourage you to look at as you're going through that um and you could scan so yeah and once you build with that you could actually get like a birthday gated there's a she actually deployed this I'm not sure it's still live but yeah you could see you could scan your code and you go through the whole process and this is the URL to the verification version so if you want to get the the verifier side of things please look at this and hopefully you could combine the two and when some bounties on polygon ID
Automatic transcript — names and jargon may be misspelled.