NOTE: This is a demo only. Do not use it in a production environment.
This is a demo frontend page that communicates with the non-merklized on-chain issuer to issuer non-merklized credential. The on-chain non-merklized issuer can use information from a blockchain (such as balance, token ownership, etc.) to issue a credential directly on the blockchain. This approach is decentralized and trustless - no need to trust an issuer to act honestly, because it's enforced by the smart contract and auditable on chain. But it comes with a few limitations: max 4 data fields in the credential and data is public. More about non-merklized credentials. You can also consider the merklized on-chain issuer solution if you need a centralised issuer without a limit on the number of fields.
Requirements:
- Docker
- Docker-compose
- Ngrok
Steps to run:
-
Deploy the non-merklized on-chain issuer. 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_STATE_CONTRACTS="80002=<AMOY_STATE_CONTRACT_ADDRESS>,21000=<PRIVADO_STATE_CONTRACT_ADDRESS>" SUPPORTED_RPC="80002=<RPC_POLYGON_AMOY>,21000=<RPC_PRIVADO_MAIN>" ISSUERS="<ISSUER_DID>" EXTERNAL_HOST="<NGROK_URL>"
ISSUERS
supports an array of issuers in the format"issuerDID1,issuerDID2"
-
Use the docker-compose file:
docker-compose build docker-compose up -d
-
Open: http://localhost:3000
- Visit https://tools.privado.id/query-builder.
- Build the next verification request:
URL to JSON-LD Context: https://gist.githubusercontent.com/ilya-korotya/660496c859f8d31a7d2a92ca5e970967/raw/6b5fc14fe630c17bfa52e05e08fdc8394c5ea0ce/non-merklized-non-zero-balance.jsonld Schema type: Balance Attribute field: balance | address Proof type: Merkle Tree Proof (MTP) Circuit ID: any Query type: Selective disclosure
- Press: Create query
- Scan the QR code with PrivadoID application
onchain-nonmerklized-issuer-demo is part of the 0xPolygonID project copyright 2024 ZKID Labs AG
This project is licensed under either of
at your option.