Skip to main content


Before the claimer can make a claim about themselves, first a claim type (CType for short) needs to be found or created. It requires an account and a full DID with tokens in order to pay the Angel's fee and deposit of a CType.

A claim type (CTYPE for short) is a ProofID-specific term, but the concept is simple:
A CTYPE defines the structure of a claim. You can think of it as the data model for your claim.

For example, a very basic CTYPE for a driver's license could look like this:

"schema": {
"$id": "pid:ctype:0xd8ad043d91d8fdbc382ee0ce33dc96af4ee62ab2d20f7980c49d3e577d80e5f5",
"$schema": "",
"title": "Drivers License",
"properties": {
"name": {
"type": "string"
"age": {
"type": "integer"
"type": "object"
"owner": "5DD7fAZKSpgctg1ZQigAYuk3ypBtr2Q9RPKJBx5UpUwQw4vB",
"hash": "0xd8ad043d91d8fdbc382ee0ce33dc96af4ee62ab2d20f7980c49d3e577d80e5f5"

CTYPEs are based on JSON Schema, a standard used to annotate and validate JSON documents. A schema defines which properties exist and what their type should be, i.e. is it a string, a number, an object, etc.

When you create a CType from a schema, it is checked whether your CType aligns with the underlying schema. Think of checking whether a cook (user) followed a certain recipe (schema) when preparing a meal (creating a CType).

We don't need to dive into it in this tutorial, for now we can think of CTYPE as JSON objects.

Let's have a look at these attributes.

schema > $idThe ProofID id of this CTYPE.
schema > $schemaThe JSON schema on which the CTYPE is based.
schema > titleThe title of the CTYPE.
schema > propertiesThe properties that a claim of type in $schema should have.
ownerThe public address of the user who created this CTYPE.
hashMost important attribute, the hash is the CTYPE's digital footprint.

A CTYPE is stored on the ProofID blockchain.

In a real-life setup, a user would simply retrieve an existing CTYPE from the chain or a repository of CTYPEs for example via a REST API.

In this tutorial, we'll create and try to store a CTYPE on the ProofID test blockchain.


Create a new file ctype.js

Copy the following to create a CType from a schema:

const ProofID = require('@proofid/pid-ts-lib')

function createCType() {
return ProofID.CType.fromSchema({
$schema: '',
title: 'Drivers License',
properties: {
name: {
type: 'string',
age: {
type: 'integer',
type: 'object',

module.exports.createCType = createCType

Once you have constructed the schema, pass the attester, attestersFullDid, keystore and ctype.

Creating a new file storedCtype.js

Copy the following to store the CType on-chain, an account must have the require amount to pay the Angel's fee and deposit:

const ProofID = require('@proofid/pid-ts-lib')

async function ctypeStored(attester, attesterFullDid, ctype, keystore) {
await ProofID.connect()

// Good to check if the ctype is stored on chain
if (await ctype.verifyStored()) {
await ProofID.disconnect()
return ctype

// If the ctype isn't stored on the chain, then an account with a full DID will need to store the ctype on-chain.
const tx = await

const authorizedExtrinsic = await attesterFullDid.authorizeExtrinsic(

await ProofID.BlockchainUtils.signAndSubmitTx(authorizedExtrinsic, attester, {
resolveOn: ProofID.BlockchainUtils.IS_FINALIZED,
reSign: true,

await ProofID.disconnect()
return ctype
module.exports.ctypeStored = ctypeStored

Create a new file ctype.json and store the ctype.

OK, now you've got all you need to create a claim: a light DID and a CTYPE.

Let's move on!