Skip to main content

๐Ÿ’ฌ Claim

In this section, you'll play the role of a claimer.

  • You'll first make a claim about yourself in the form of a Claim object;
  • But a claim in itself has no value. To become valid in the eyes of verifiers, it needs to be attested by an entity that verifiers trust: an attester. So you'll create a RequestForAttestation object from your Claim object, sign it with the DID, so that an attester can attest it.
  • The claim will eventually be attested.

We'll look into the attestation in the next steps - for now, let's just focus on your claim.

๐Ÿ’ก KILT is an open system. Anyone/anything can make a claim about themselves. But a claim only has value if the verifier trusts the attester.

Create a file

Create a new file claim.js. All of the code for this step needs to go into this file.

Code: create a Claim

In the previous step, you've generated two mnemonics, DIDs and accounts. You'll now need the first mnemonic you've created; it's referred to as <claimerMnemonic> in the code snippet below.

We'll create a claim using the provided CTYPE and the claimer account.
Paste the following in claim.js.

import * as Kilt from '@kiltprotocol/sdk-js'

export function main(
claimerLightDid: Kilt.Did.LightDidDetails,
ctype: Kilt.CType
): Kilt.Claim {
const claimContents = {
name: 'Alice',
age: 25,

const claim = Kilt.Claim.fromCTypeAndClaimContents(

return claim

Don't run the code just yet! One more thing to add...

Code: create a RequestForAttestation

Once your claim will be built, you will want to sign it and prepare it for the attester. To do so, let's build a RequestForAttestation object from your Claim.

Append the following code to your main function inside claim.js:

import * as Kilt from '@kiltprotocol/sdk-js'

export async function main(
claimerLightDid: Kilt.Did.LightDidDetails,
claim: Kilt.Claim,
keystore: Kilt.Did.DemoKeystore
): Promise<Kilt.RequestForAttestation> {
const requestForAttestation = Kilt.RequestForAttestation.fromClaim(claim)

await requestForAttestation.signWithDid(keystore, claimerLightDid)

// log this so you can paste it locally

return requestForAttestation


Run the code by running this command in your terminal, still within your kilt-rocks directory:

node claim.js

This outputs your RequestForAttestation object.

Copy and paste it somewhere: we'll need it in the next step to get it attested by an attester.

let others attest your claim

In a real-life setup, the different actors - claimer, attester and verifier - communicate with each other via a messaging system and can rely on the KILT SDK's messaging capabilities.

We don't need to do this here.

If you're following this tutorial on your own, you're playing all three KILT roles: claimer, attester and verifier. So you can simply copy the outputs of the different functions you're calling and use them as inputs for the other actors.

If you're following this as a workshop, you can simulate message exchange by exchanging your requests via chat, email, or simply by pasting requests for attestations or credentials in a shared document such as this hackmd.

OK, you've made a claim as a claimer and created a request for attestation.

Let's switch roles and get this attested!