NOTE: This is a demo only. Do not use it in a production environment.
This is a demo service that communicates with the merklized on-chain issuer to issuer merklized credential. At first glance, it may appear to be a decentralized issuer, but it is not. In the case of a merklized credential, the service issues a credential locally, then calculates the Merkle root for the credential and saves the core claim of the credential on-chain. As a result, the user will have a MTP proof, and the issuer will manage all of their trees on-chain. After that, the user can use the MTP proof to build a ZK proof to prove the claim on-chain with an on-chain verifier.
If you want to have a decentralized on-chain issuer, consider using this contract and this demo.
Requirements:
- Docker
- Docker-compose
- Ngrok
Steps to run:
-
Deploy the on-chain merklized issuer contract. Script to deploy or use the npm command.
-
Copy
.env.example
to.env
cp .env.example .env
-
Run
ngrok
on 8080 port.ngrok http 8080
-
Use the utility to calculate the issuerDID from the smart contract address:
go run utils/convertor.go --contract_address=<ADDRESS_OF_ONCHAIN_ISSUER_CONTRACT>
Available flags:
contract_address
- contract address that will convert to didnetwork
- network of the contract. Default: polygonchain
- chain of the contract. Default: amoy
-
Fill the
.env
config file with the proper variables:SUPPORTED_RPC="80002=<RPC_POLYGON_AMOY>" ISSUERS_PRIVATE_KEY="<ISSUER_DID>=<PRIVATE_KEY_OF_THE_CONTRACT_DEPLOYER>" EXTERNAL_HOST="<NGROK_URL>"
ISSUERS_PRIVATE_KEY
supports a list of issuers in the format"issuerDID=ket,issuerDID2=key2"
-
Use the docker-compose file:
docker-compose build docker-compose up -d
-
Open: http://localhost:3000
- Visit https://tools.privado.id/query-builder.
- In the
URL to JSON-LD context
field, select the schemaipfs://QmbbTKPTJy5zpS2aWBRps1duU8V3zC84jthpWDXE9mLHBX
. - In the
Attribute field
text box, select thebalance
field. - In the
Proof type
field, selectMerkle Tree Proof (MTP)
proof type. - In the
Circuit ID
drop down, select theCredential Atomic Query MTP v2
circuit. - Select a query type in the
Query type
section. - Select a
Operator
if you have selected theConditional
check box in theQuery type
section. - Provide an attribute value in the
Attribute value
field if you have selected theConditional
check box. - Click the
Create query
button. - Scan the QR code using the mobile application.
onchain-merklized-issuer-demo is part of the 0xPolygonID project copyright 2024 ZKID Labs AG
This project is licensed under either of
at your option.