🧠 Use Case

Design a decentralized identity solution for underserved populations to access public and private services with verifiable credentials.

In many low-infrastructure regions, people lack formal documentation. This solution enables identity creation and access using Cardano-native verifiable credentials (VCs), anchored via CIP-68 NFTs and validated through off-chain hash comparisons — with optional on-chain enforcement for gated access.

1. Functional Flow Diagram

[NGO Agent / Self Onboarding]

↓

[VC Created & Signed (JSON-LD)]

↓

[SHA-256 Hash of CredentialSubject]

↓

[Anchor hash in CIP-68 NFT (optional)]

↓

[Store VC in Wallet / Mobile App]

↓

[Verifier App → Upload or Scan VC]

↓

[VC Hash Compared to On-Chain Anchor or Registry]

↓

[Access Granted / Denied]

2. Verifiable Credential (VC) – Schema Breakdown

📁 vc-schema/basic-identity.json

Field Description Example
@context W3C standard credential context https://www.w3.org/2018/credentials/v1
type Credential type ["VerifiableCredential", "BasicIDCredential"]
issuer DID of the credential issuer did:cardano:ngo789
issuanceDate Date of issuance 2025-07-10T00:00:00Z
credentialSubject Data about the subject (user) { name, birthYear, nationality }
proof Digital signature block Ed25519 signature
{

"@context": ["<https://www.w3.org/2018/credentials/v1>"],

"type": ["VerifiableCredential", "BasicIDCredential"],

"issuer": "did:cardano:ngo789",

"issuanceDate": "2025-07-10T00:00:00Z",

"credentialSubject": {

"id": "did:cardano:user123",

"fullName": "Fatima Diallo",

"birthYear": "1990",

"nationality": "Senegalese",

"verifiedBy": "Red Cross Dakar"

},

"proof": {

"type": "Ed25519Signature2020",

"created": "2025-07-10T00:00:00Z",

"proofPurpose": "assertionMethod",

"verificationMethod": "did:cardano:ngo789#keys-1",

"jws": "eyJhbGciOiJFZERTQSJ9..."

}

}

3. CredentialSubject Hashing Script

📁 utils/hash.ts

import { createHash } from 'crypto'

export function hashCredentialSubject(credentialSubject: object): string {

const canonical = JSON.stringify(credentialSubject)

return createHash('sha256').update(canonical).digest('hex')

}

// Example usage

const subject = {

fullName: "Fatima Diallo",

birthYear: "1990",

nationality: "Senegalese",

verifiedBy: "Red Cross Dakar"

}

console.log("VC Hash:", hashCredentialSubject(subject))

⚠ Exclude the proof field from hashing to ensure verifiability and privacy.

4. CIP-68 NFT Metadata (for Anchoring VC)

📁 nft-metadata.json

{

"name": "ID Credential - Fatima Diallo",

"description": "Anchored VC for identity verification",

"vc_hash": "0x9f2a3878c1ed2f...d21b7a",

"issuer_did": "did:cardano:ngo789",

"credential_type": "BasicIDCredential",

"schema_id": "ipfs://QmSchemaRef123",

"issued_at": "2025-07-10T00:00:00Z"

}