Implement an ERC20 Transfer On chain Verification with Polygon ID

Article series to follow on Medium

  1. Part-1 : Polygon-ID Core Concepts
  2. Part-2 : Creating and Issuance of Claims
  3. Part-3 : On chain verification by Verifier

Polygon ID Wallet setup

  1. Download the Polygon ID mobile app on the Google Play or Apple app store

  2. Open the app and set a pin for security

  3. Follow the Issue a Polygon ID claim doc to issue yourself a Credential.

Instructions to compile and deploy the smart contract

  1. Create a .env file in the root of this repo. Copy in .env.sample to add keys touch .env

  2. Install dependencies npm i

  3. Compile smart contracts npx hardhat compile

  4. Deploy smart contracts npx hardhat run --network mumbai scripts/deploy.js

  5. Update the ERC20VerifierAddress variable in scripts/set-request.js with your deployed contract address

  6. Run set-request to send the zk request to the smart contract npx hardhat run --network mumbai scripts/set-request.js

    • Successful tx means the age query has been set up: Check on PolygonScan.

Design Proof Request for Frontend

  1. Design a proof request: Query Based Requests

    • Update the contract_address field to your deployed contract address
  2. Create a frontend with a QR code to the proof request. A user can scan the QR code from the Polygon ID app and trustlessly prove that they are old enough to claim the ERC20 token without revealing their actual date.

Screenshots / User flow