Tutorial: https://0xpolygonid.github.io/tutorials/verifier/on-chain-verification/overview/
This tutorial uses Hardhat as a development environment and Polygon Mumbai testnet as the network.
-
Download the Polygon ID mobile app on the Google Play or Apple app store
-
Open the app and set a pin for security
-
Follow the Issue a Polygon ID claim doc to issue yourself a KYC Age Credential attesting your date of birth.
-
Create a .env file in the root of this repo. Copy in .env.sample to add keys
touch .env
-
Install dependencies
npm i
-
Compile smart contracts
npx hardhat compile
-
Deploy smart contracts
npx hardhat run --network mumbai scripts/deploy.js
- Drop Token deployed to: 0x34cb10Ec8b300821943112c73e81191784c19C93
- ERC20Verifier contract hash: 0xf7d67448132bfBdBE496Ef1633fD62f0D342f9a8
- FactoryContract hash: 0xAC70A6c866328e6283A787FDE99B6d8860cB517D
-
Update the
ERC20VerifierAddress
variable in scripts/set-request.js with your deployed contract address -
Run set-request to send the zk request to the smart contract
npx hardhat run --network matic scripts/deploy.js
- Successful tx means the age query has been set up: https://mumbai.polygonscan.com/tx/0xd04afd57eb3c0388525026a15578802289bce06d78060069f072540e7d9dd1ca
-
Design a proof request (see my example in qrValueProofRequestExample.json) and more info in the docs: Query Based Requests
- Update the
contract_address
field to your deployed contract address
- Update the
-
Create a frontend with a QR code to the proof request. Codesandbox example A user should be able to scan the QR code from the Polygon ID app and trustlessly prove that they are old enough to claim the ERC20 airdrop without revealing their actual birthday.