Polygon ID Part-2 : Creating and Issuing claims

Atharva Paliwal
Coinmonks
Published in
7 min readNov 30, 2022

--

Source : Polygon ID Docs

This article is the second part of the article series on Polygon ID where we will cover the Issuing of Claims by an issuer through Polygon ID Platform and identity holder receiving it in his Polygon ID wallet.

However to get started with this article, you should know some pre-requisites that you can find in the first part of the series here that covers the core concepts of Polygon ID in a simplistic way.

So what all things will be covered in this article —

  1. Introduction to On Chain Verification.
  2. Introduction to Polygon ID Platform to issue yourself a claim.
  3. Receive the claim in your Polygon ID wallet.

In the next part of this series we will cover —

  1. Use the issued claim to verify your identity with Verifier using On chain verification.
  2. Get issued ERC20 Tokens in your Metamask wallet after verification from the verifier.

Introduction to On Chain Verification

The on-chain verification workflow allows Dapps to verify users’ claims inside a Smart Contract. Zero-Knowledge Proof cryptography enables this verification to happen in a private manner, namely without revealing any personal information of the user (identity holder).

Ex- We can use On chain verification to have a check that allows only people >18yrs of age to be able to cast vote.

Now, before approaching for on chain verification we will first issue ourselves a claim that we can use to send it to verifier. This claim will be given to us by an Issuer, in our case we will issue the claims to ourselves but in the real world, this can be done by any of the trusted organizations.

So, for this let’s check what Polygon ID Platform provides us.

Issuing claims by Polygon ID Platform

Polygon ID Platform is an Sandbox provided by Polygon ID team from where any Issuer can issue claims to the identity holder in a simplified way.

You can sign in and make your account onto the platform , after that you will receive a verification link in your mail and on clicking the link you would notice something like this —

Polygon ID Issuer Registration Page

So, this page is the registration page of the issuer that will issue claims to the holders via Polygon ID Platform. As of now since we are only issuing the claims to ourselves so we can create our own organization. But in real world this organization can be an Government backed Driving License Issuer etc.

After creating an organization successfully you will be redirected to an dashboard that allows the issuer to issue claims. It will look something like this —

Polygon ID Platform Dashboard Page

On the dashboard we have the create schema button from where the Issuer will be able to create the custom schemas. I have already explained about schemas in my previous part of the article. However we just have to give the parameters to the Polygon ID Platform and it generates the schema file for us.

Let’s create a schema which will give us more clarity —

On clicking the create schema button we notice that it asks us the Schema name that tells us what is the claim about and attributes that we want to specify.

Create Schema Page

There can be 2 attributes that you can add in your custom schema where you can specify the data type i.e. is it Boolean, Number or Date. Since in our case we are taking the scenario that we want to issue the claim to the holder claiming his age so we have selected Number data type.

After clicking on Save & Offer claim we get in the attributes that we mentioned in the create schema, where we have to put in the values specific to each identity holder that wants to get the claim issued.

Offer Claim Page

Now, the issuer mentions the age of the user or identity holder is i.e. 20 and he generates the claim for the user by filling in the value. He can also specify the Claim Expiration Date which will tell the identity holder when will the claim expire.

After generating the claim offer, you will see a link to the claim generated, you can just copy that link and share it with the identity holder or the person who requested for the claim to be issued.

Claim

When you open the link, you will notice the QR code that is generated from the schema attributes that we specified and now Identity Holder can scan this QR code from his Polygon ID wallet app and can get issued himself the claim from the Issuer Organization.

On the Polygon ID platform, visit to the dashboard and on clicking the “Offered claims” tag, you will notice the details about the claim you just created.

Offered Claims

To see the schema for the claim that you generated, just visit the “My schemas” tag and you would be able to notice a schema URL that is listed.

Claim Schema Page

If you will open that link, you will see that a file gets downloaded with JSON-LD extension. The file would contain something like this —

{
"@context": [{
"@version": 1.1,
"@protected": true,
"id": "@id",
"type": "@type",
"AgeCredential": {
"@id": "https://s3.eu-west-1.amazonaws.com/polygonid-schemas/33f9238b-dad0-440e-aa20-4561606c289b.json-ld#AgeCredential",
"@context" : {
"@version": 1.1,
"@protected": true,
"id": "@id",
"type": "@type",
"poly-vocab": "https://s3.eu-west-1.amazonaws.com/polygonid-schemas/33f9238b-dad0-440e-aa20-4561606c289b.vocab.schema.json",
"serialization": "https://github.com/iden3/claim-schema-vocab/blob/main/credentials/serialization.md#",
"Age": {
"@id": "poly-vocab:Age",
"@type": "serialization:IndexDataSlotA"
}
}
}
}]
}

Schemas are generally stored in JSON-LD format, but storing whole schema inside a claim would be highly inefficient, so only schema hash is stored inside the claim. The @id contains the unique url that contains the JSON-LD Document. The auth-vocab contains the url that describes the value types stored inside this claim. In our case it is just one i.e. Age. The serialization contains the instructions need to parse the raw claim into a JSON-LD document and the last part contains the reference to the value i.e. Age. Their @id is corresponding description in the auth-vocab while the @type indicates where the values should be stored inside the claim, in our case it is IndexDataSlotA.

While creating our schema, if we would have created 2 attributes that would have been stored IndexDataSlotB and as I said in my previous part of article that claims store data inside four data slots: two index slots(i_2,i_3) and two value slots (v_2, v_3). To properly design and fill a claim with information, it is necessary to define which data should be stored inside which data slots.

Receiving claim in our Polygon ID wallet

Before we proceed, I hope you would have downloaded the Polygon ID wallet app from the Playstore and would have done setting it up. The steps are somewhat similar to when you install Metamask wallet.

After setting up, you would notice something like this in your wallet —

Polygon ID wallet

After clicking on connect button, we have to scan the QR code from Polygon ID wallet app that we got from the issuer. After scanning the QR code we will receive the claim in our Polygon ID wallet.

Now we have got the claim in our Polygon ID wallet app, we now can share this claim whenever any verifier requests for the Age Proof.

So this is it for the second part, we will carry forward the verification process in the next part of this article.

Enjoyed the article? Find Part-3 of the article series attached here that covers on chain verification along with the demo.

Stay tuned and do follow me on Twitter, LinkedIn and Medium and do share it with your friends who are interested into this step if you have enjoyed reading this article.

Important Resources

Polygon ID Docs — https://0xpolygonid.github.io/tutorials/

Iden3 docs — https://docs.iden3.io/

Polygon ID Platform — https://platform-test.polygonid.com/sign-in

Polygon ID platform video— https://youtu.be/VClUFjs8lh8

Claims and Schemas — https://docs.iden3.io/protocol/claims-structure/

New to trading? Try crypto trading bots or copy trading

--

--

Atharva Paliwal
Coinmonks

Blockchain Developer (R&D) at Persistent Systems | Writes about new and less known things that you may want to add to your skills portfolio ✍️💫