Skip to content

Run Redbelly Proof by Query Issuer Instance

Set up your own Issuer with the following steps:

  • Clone the receptor-issuer repository from Github which implements routes for Proof by Query and Selective Disclosure.

  • Pre-requisites/Assumptions:

  • Run task dlcircuit to download and unzip the Iden3 Circuits.

  • Developers are advised to run their RHS server. Follow steps listed here.

Environment variables

You will need these values to run issuer on the various Redbelly environments.

  • Create .env file.
  • Copy values from .sample.env to .env

.env

  • NODE_RPC_URL = Coming Soon
  • RHS_URL = {Add your RHS URL}
  • ISSUER_ECDSA_PRIVATE_KEY_HEX = {Wallet Private Key}
  • BOOTSTRAP_REGISTRY_CONTRACT_ADDRESS = 0xDAFEA492D9c6733ae3d56b7Ed1ADB60692c98Bc5
  • REDBELLY_REGISTRY_CONTRACT_ADDRESS = Coming Soon
  • ISSUER_PUBLIC_ADDRESS = {Wallet Public Key}
  • CIRCUITS_PATH = {Add path to Iden3 Circuits}
  • MIN_AMOUNT_TO_UPDATE_STATE = {Minimum amount to transition state}
  • NODE_RPC_URL = Coming Soon
  • RHS_URL = {Add your RHS URL}
  • ISSUER_ECDSA_PRIVATE_KEY_HEX = {Wallet Private Key}
  • BOOTSTRAP_REGISTRY_CONTRACT_ADDRESS = 0xDAFEA492D9c6733ae3d56b7Ed1ADB60692c98Bc5
  • REDBELLY_REGISTRY_CONTRACT_ADDRESS = Coming Soon
  • ISSUER_PUBLIC_ADDRESS = {Wallet Public Key}
  • CIRCUITS_PATH = {Add path to Iden3 Circuits}
  • MIN_AMOUNT_TO_UPDATE_STATE = {Minimum amount to transition state}

Install Dependencies

npm i

Run Demo

npm run dev

Create Issuer's DID

Creates issuer's Decentralised Identity (DID) and saves it as a global instance on its server.

curl --location 'http://localhost:3000/create-identity'

Sample Issuer's DID generated:

{
  "payload": {
    "method": "iden3",
    "id": "polygon:mumbai:x32x9zKVv8mxno2EE6DiP7YeKSxhQbeHL4p7GbDAM",
    "idStrings": [
      "polygon",
      "mumbai",
      "x32x9zKVv8mxno2EE6DiP7YeKSxhQbeHL4p7GbDAM"
    ],
    "params": [],
    "path": "",
    "pathSegments": [],
    "query": "",
    "fragment": ""
  }
}

Create Holder's DID

Creates holder's Decentralised Identity (DID) used to generate credentials for the specific Holder which is request for the credential.

curl --location 'http://localhost:5000/create-identity'
  • Fetch the Holder's DID to use below.

Sample Holder's DID Generated

{
  "message": "did successfully created",
  "did": {
    "method": "iden3",
    "id": "polygon:mumbai:x5fEEnyoRGR6dTCWMwJ87gUBRTRWYPiLJkyEHYCv6",
    "idStrings": [
      "polygon",
      "mumbai",
      "x5fEEnyoRGR6dTCWMwJ87gUBRTRWYPiLJkyEHYCv6"
    ],
    "params": [],
    "path": "",
    "pathSegments": [],
    "query": "",
    "fragment": ""
  },
  "did_String": "did:iden3:polygon:mumbai:x5fEEnyoRGR6dTCWMwJ87gUBRTRWYPiLJkyEHYCv6"
}

Generate Credential

Generates credential requested by the holder.

curl --location 'http://localhost:3000/generate-pbq-credentials' \
--header 'Content-Type: application/json' \
--data '{"did":{holderDID}}'

Sample Verifiable Credential Generated

{
  "message": "OK",
  "credential": {
    "id": "urn:951481e8-e5f5-48c3-b185-b3f9e6263ac2",
    "@context": [
      "https://www.w3.org/2018/credentials/v1",
      "https://schema.iden3.io/core/jsonld/iden3proofs.jsonld",
      "https://redbellynetwork.github.io/did-schema/passport/credential/v1.jsonld"
    ],
    "type": ["VerifiableCredential", "PassportCredential"],
    "credentialSubject": {
      "id": "did:iden3:polygon:mumbai:x3LXBvzJR4vwV4kHvwSrkBP9PRNYpiLwwTisVEKrZ",
      "name": "james testeleven",
      "passportNumber": "E55173628",
      "nationality": "AUS",
      "birthDate": 19600101,
      "customerReference": "2fcecbfc-a926-cf72-6182-4f475da27b28",
      "expiryDate": 20250101,
      "publicAddress": "0x9e125dB4B5Af7DBe334aA9653b2829b6F07e0391",
      "type": "PassportCredential"
    },
    "issuer": "did:iden3:polygon:mumbai:wznFQLNCwNgrcysagm7M1WZ1iv2ZgZqwYK8dZMZ1k",
    "issuanceDate": "2024-01-31T08:32:25.358Z",
    "credentialSchema": {
      "id": "https://redbellynetwork.github.io/did-schema/passport/credential/PassportCredential-v1.json",
      "type": "JsonSchema2023"
    },
    "credentialStatus": {
      "id": "http://localhost:8080/node?state=d00c36de5b7818e102b47c534fd97c125d88796826b064115acfd74e397ab00f",
      "type": "Iden3ReverseSparseMerkleTreeProof",
      "revocationNonce": 1940
    },
    "proof": [
      {
        "issuerData": {
          "id": "did:iden3:polygon:mumbai:wznFQLNCwNgrcysagm7M1WZ1iv2ZgZqwYK8dZMZ1k",
          "state": {
            "rootOfRoots": "0000000000000000000000000000000000000000000000000000000000000000",
            "revocationTreeRoot": "0000000000000000000000000000000000000000000000000000000000000000",
            "claimsTreeRoot": "8299309aaa4def73548235a717ec3b2fc8b91efbdba958aacaefbcccdbeb011c",
            "value": "d00c36de5b7818e102b47c534fd97c125d88796826b064115acfd74e397ab00f"
          },
          "mtp": {
            "existence": true,
            "siblings": []
          },
          "authCoreClaim": "cca3371a6cb1b715004407e325bd993c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000789a607710ebfa952cde0c650dedec522311e2ae3821a9c7471ef3d41fda5e0bbdf80c621861243963cf45ec8aa5024c18ed0e8188b72ad25c0029e284512c180000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
          "credentialStatus": {
            "id": "http://localhost:8080/node?state=d00c36de5b7818e102b47c534fd97c125d88796826b064115acfd74e397ab00f",
            "type": "Iden3ReverseSparseMerkleTreeProof",
            "revocationNonce": 0
          }
        },
        "type": "BJJSignature2021",
        "coreClaim": "cca3371a6cb1b715004407e325bd993c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000789a607710ebfa952cde0c650dedec522311e2ae3821a9c7471ef3d41fda5e0bbdf80c621861243963cf45ec8aa5024c18ed0e8188b72ad25c0029e284512c180000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
        "signature": "signature"
      },
      {
        "issuerData": {
          "id": "did:iden3:polygon:mumbai:wznFQLNCwNgrcysagm7M1WZ1iv2ZgZqwYK8dZMZ1k",
          "state": {
            "claimsTreeRoot": "edf712698b5c2b42e9923129f74bea6c62cbc02f283839231543c70566ea4d13",
            "revocationTreeRoot": "0000000000000000000000000000000000000000000000000000000000000000",
            "rootOfRoots": "df9330f8306c7b8e68195648ae120b7b01b1bbfdd238dddada02e0d78a3ec724",
            "value": "48eca96ed3813815860a42c7b2674574aa019be5c2f5db4b1b6c75ade7e15a14",
            "txId": "0xf276904e0a34b1fc43bc51a3a7d29bafec0502b12a6e6f16b928dadbb214724d"
          }
        },
        "type": "Iden3SparseMerkleTreeProof",
        "coreClaim": "coreClaim",
        "mtp": {
          "existence": true,
          "siblings": [
            "0",
            "12668154443577484692186593348211170053898334608718851465299950935342343821698"
          ]
        }
      }
    ]
  }
}