Building Verifiable Credentials
A Verifiable Credential (VC) in LearnCard is a JSON document that follows the W3C Verifiable Credentials Data Model. This guide explains how to construct the JSON structure for various types of credentials.
Basic Structure
{
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3id.org/vc/status-list/2021/v1"
],
"type": ["VerifiableCredential"],
"credentialSubject": {
"id": "did:example:recipient123",
"name": "Credential Subject Name"
}
}Note: LearnCard automatically injects the issuanceDate and issuer fields when you call learnCard.invoke.issueCredential().
Examples by Use Case
1. Basic Educational Achievement
{
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3id.org/vc/status-list/2021/v1",
"https://purl.imsglobal.org/spec/ob/v3p0/context.json"
],
"type": ["VerifiableCredential", "OpenBadgeCredential"],
"credentialSubject": {
"id": "did:example:recipient123",
"type": ["AchievementSubject"],
"achievement": {
"id": "https://example.org/achievements/123",
"type": ["Achievement"],
"name": "Introduction to Blockchain",
"description": "Successfully completed the introduction to blockchain course",
"criteria": {
"narrative": "The recipient demonstrated understanding of blockchain fundamentals"
}
}
}
}2. Professional Certification
3. Digital Badge with Evidence
4. Employment Credential
5. Skill Assessment
6. Learning Pathway Completion
7. Attendance Credential
8. Membership Credential
Best Practices
Always include the core W3C VC context
Use specific types that match your credential purpose
Include only necessary fields to keep credentials compact
Ensure all custom fields are properly defined in contexts
Remember that LearnCard will add issuance date and issuer DID automatically
For detailed examples of different credential types, see the examples section above.
Last updated
Was this helpful?