Skip to content


This guide presents an example of how to use the on-chain issuer. We created a small application, where we communicate with Metamask to retrieve the user's balance and a claim about this balance is generated via the on-chain issuer.

There are three main components in this application:

  1. On-chain issuer (demo|contract)
  2. Server for user authorization
  3. Front-end component for communication with Metamask


Currently, the state contract on the mainnet does not support onchain issuers. Please, use the Mumbai network instead.


  1. Node js => 18.x
  2. Go => 1.20.x
  3. npm => 9.x.x
  4. docker => 20.x
  5. Polygon ID wallet app

How to run the On-chain Issuer

  1. Clone this repository:

    git clone

    All the variables which need to be altered are in the file:

  2. Deploy an on-chain issuer contract. You can use this sample here or create your own smart contract with custom logic.

    Use the following State Contract addresses:

    • For mumbai network: 0x134B1BE34911E39A8397ec6289782989729807a4
    • For mainnet network: 0x624ce98D2d27b20b8f8d521723Df8fC4db71D79D


    You can find more information on how to deploy a smart contract using Hardhat in this readme.

  3. Fill in the configuration files with the actual values.

    • ONCHAIN_ISSUER_CONTRACT_ADDRESS should be retrieved from the smart contract deployment.
    • URL_MUMBAI_NODE is easily acquired with any Infrastructure provider, such as Alchemy, Infura etc.
    • URL_POLYGON_NODEis easily acquired with any Infrastructure provider, such as Alchemy, Infura etc.
    • ONCHAIN_CONTRACT_OWNER is where a private key should be set to deploy the contract.
    • MUMBAI_CONTRACT_STATE_ADDRESS represents the already deployed Mumbai State Contract and shouldn't be changed.
    • MAIN_CONTRACT_STATE_ADDRESS represents the already deployed Mainnet State Contract and shouldn't be changed.
    • ONCHAIN_ISSUER_CONTRACT_BLOCKCHAIN sets the blockchain where the on-chain issuer contract was deployed as eth or polygon.
    • ONCHAIN_ISSUER_CONTRACT_NETWORK sets the blockchain network where the on-chain issuer contract was deployed, as main, mumbai or goerli.
  4. Run the script:



Don't forget to download and install the Polygon ID wallet app before you go the next steps.

- For Android: <a href="" target="_blank">Polygon ID on Google Play</a>
- For iOS: <a href="" target="_blank">Polygon ID on the App Store</a>

Issue and fetch credential

  1. Open http://localhost:3000 in your web browser and click on Sign Up.

  2. Scan the QR code with your Polygon ID wallet app and follow the instructions on the application.

  3. You will see your DID and now you can connect to MetaMask. Follow the flow on the MetaMask app.

  4. The On-chain issuer application will now display your account. Now share your account balance with the application.

  5. The account balance will be shown in gwei together with some other information about the claim.

  6. Clicking on Get Claim will finally lead to the QR Code used to fetch the credential with MTP proof. Here we are making a request to the on-chain issuer node. This node then saves this claim in a contract address. Scan it with the Polygon ID wallet and the credential should be added to the mobile app.

Here is the credential on the mobile app:

How to verify the balance claim

  1. Go to the Verifier website.
  2. Choose custom from the dropdown menu.

  3. Fill up the form.

    • Circuit Id: Credential Atomic Query MTP;
    • URL:
    • Type: BalanceCredential
    • Field: balance
    • Operator: all the operators work for the claim. More information here
    • Value: set the value that you want to verify.

    Here is an example:

  4. Press submit.

  5. Use the mobile application to scan the QR code and complete the verification process. The verifier will check revocation status and additional information and the proof will be sent to the verifier. The Verifier website will present then the proof information.