This is a basic Hardhat project showcasing how to create a Soulbound Token using an Age Credential from Polygon ID!
Tutorial: Video coming soon
Presentation Slids: https://pitch.com/public/2ac4415d-fcf6-4ad2-ac7f-1427483b8ece
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
- results in x tx hash: 0xecf178144CceC09417412D66E2ecC8a2841eE228
- example contract creation: https://mumbai.polygonscan.com/address/0xecf178144ccec09417412d66e2ecc8a2841ee228
-
Update the
ERC721VerifierAddress
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 age query has been set up: https://mumbai.polygonscan.com/tx/0x2ddb2db7b3d35cf7cdf658209b257fd2a51c49df2249bf46ede8979eb8410ffb
-
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 mint an SBT
Additional Tutorials from Steph and Manny: https://github.com/oceans404/tutorial-examples/tree/main/on-chain-verification https://github.com/codingwithmanny/polygonid-on-chain-verification
Starter kit from Steph for using API in a frontend: https://github.com/oceans404/generate-frontend-polygon-id-issuer