Create a Credential
Tutorial: Create and Send Your First Digital Credential
Welcome! This tutorial will walk you through creating your very first digital Verifiable Credential (VC) and sending it to your LearnCard app. Think of a VC as a secure, digital certificate or badge that can prove something, like an achievement or a skill.
What you'll accomplish:
Set up a simple "Issuer" environment using the LearnCard SDK.
Design and create a "Workshop Completion" Verifiable Credential.
Digitally sign (issue) the credential to make it official.
Send this credential to your own LearnCard app using your Profile ID.
View the received credential in your LearnCard app.
Why is this useful? Understanding this basic flow is the first step to building applications that can issue digital badges, certificates, or any other kind of verifiable proof to users, empowering them with portable and trustworthy records.
Prerequisites:
Node Installed: Node.js installed on your computer.
Basic Understanding: While this is a beginner tutorial, a quick read of our What is a Verifiable Credential? and What is a DID? Core Concept pages will be helpful.
Part 0: Project Setup
Open the package.json file that was created in your learncard-tutorial-js directory and add the following line:
Part 1: Setting Up Your Issuer Environment
For this tutorial, your computer will act as the "Issuer" – the entity creating and sending the credential.
Step 1.1: Create an Issuer Script
Create a new file in your project folder: issueCredential.ts
Create a new file in your project folder: issueCredential.js
Step 1.2: Initialize LearnCard SDK for the Issuer
This instance will represent your workshop organization.
This code initializes a LearnCard instance.
Step 1.3: Ensure Issuer Has a Service Profile
To interact with the LearnCard Network effectively (like sending credentials), your Issuer's DID should be associated with a Service Profile.
Step 1.4: Generate Secure Seed and .env file
Create and save your seed to .env:
Run the following command in your terminal:
Run the following command in your Windows cmd prompt:
Run the following command in Powershell:
Add config variables to your .env:
.env:Part 2: Designing Your "Workshop Completion" Credential
Now, let's define what information our "Workshop Completion" credential will hold.
Step 2.1: Retrieve Your LearnCard Profile ID
Login or Signup for LearnCard App, and grab your unique Profile ID:
Step 2.1: Define the Credential Content
A Verifiable Credential is a set of claims made by an Issuer about a Subject (the recipient).
✨ Key Points:
@context: Tells systems how to interpret the fields.type: Helps categorize the credential.VerifiableCredentialis standard.credentialSubject: This is the core information. Theidhere should be the DID of the person receiving the credential. For this tutorial, we're using therecipientProfileId(which you got from your app) to construct a DID.
Learn more about schemas in our Credentials and Data section of our Core Concepts.
Part 3: Creating and Signing the Credential (Issuance)
Let's take the content and make it an official, signed Verifiable Credential.
Step 3.1: "Issue" / "Sign" the Unsigned Credential
The LearnCard SDK helps you with this:
Part 4: Sending the Credential to Your LearnCard App
Now, let's send this official credential to your LearnCard app.
Step 4.1: Use sendCredential
sendCredentialThis function from the LearnCard SDK (via the Network plugin) handles the delivery.
Part 5: Putting It All Together & Viewing in Your App
Let's create a main function to run these steps.
Step 5.1: Main Script Logic
Step 5.2: Run Your Script
Replace Placeholders:
Save the file.
Open your terminal in your project directory and run:
npx tsx issueCredential.ts
Replace Placeholders:
Save the file.
Open your terminal in your project directory and run:
node issueCredential.js
Step 5.3: View in Your LearnCard App
After the script runs successfully, open your LearnCard app on your device. You should see the new "Workshop Completion Certificate" appear! It might take a few moments for you to get the notification.

Summary & What's Next
Congratulations! You've successfully: ✅ Set up a basic Issuer using the LearnCard SDK. ✅ Defined, created, and digitally signed a Verifiable Credential. ✅ Sent that credential to your own LearnCard app.
This tutorial covers the fundamental flow of issuing credentials. From here, you can explore:
Creating more complex credentials with different Schemas and Types.
Using ConsentFlows to manage data sharing before issuing credentials.
Integrating this issuance logic into your own applications and backend services.
Explore the rest of our documentation to learn more about the powerful features of LearnCard!
Last updated
Was this helpful?