/onchain-nonmerklized-issuer-demo

Primary LanguageTypeScriptApache License 2.0Apache-2.0

Onchain non-merklized issuer demo

NOTE: This is a demo only. Do not use it in a production environment.

Description

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.

Quick Start Installation

Requirements:

  • Docker
  • Docker-compose
  • Ngrok

Steps to run:

  1. Deploy the non-merklized on-chain issuer. Script to deploy or use the npm command.

  2. Copy .env.example to .env

    cp .env.example .env
  3. Run ngrok on 8080 port.

    ngrok http 8080
  4. 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 did
    • network - network of the contract. Default: polygon
    • chain - chain of the contract. Default: amoy
  5. Fill the .env config file with the proper variables:

    SUPPORTED_RPC="80002=<RPC_POLYGON_AMOY>"
    ISSUERS="<ISSUER_DID>"
    EXTERNAL_HOST="<NGROK_URL>"

    ISSUERS supports an array of issuers in the format "issuerDID1,issuerDID2"

  6. Use the docker-compose file:

    docker-compose build
    docker-compose up -d
  7. Open: http://localhost:3000

How to verify the non zero balance claim:

  1. Visit https://verifier-demo.polygonid.me/.
  2. Choose custom from the drop-down menu.
  3. Select the verifier based on your network:
    • For polygon mumbai: Mumbai
    • For polygon mainnet: Mainnet
    • For polygon amoy: Amoy
  4. Fill out the form:
  5. Press submit.
  6. Use the mobile application to verify.

License

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.