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 YT video to issue yourself a Proof Of Personhood attesting if you are a VerifiedPerson or not.
-
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
- results in x contract address: 0xDa486713DfFf7F4244465E34C1786FFbe6d85604
- example contract creation: https://mumbai.polygonscan.com/address/0xDa486713DfFf7F4244465E34C1786FFbe6d85604
-
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 mumbai scripts/set-request.js
- Successful tx means the query has been set up: https://mumbai.polygonscan.com/tx/0x0aa557b705960e2bee1f17077389eddde168011bafc8e7cc3dd31ce6f1677f19
-
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 a person to claim the ERC20 airdrop without revealing their actual personhood.