Skip to main content
Version: v0.5.x

cheqd

cheqd is a blockchain network, built in the Cosmos ecosystem for Self-Sovereign Identity (SSI). The cheqd Network leverages the cheqd DID method and enables DID-Linked Resources to be written to the network, associated with a DID and controlled using the verification methods in the DID Document.

Through this approach, the cheqd Network is able to natively support the Ledger Agnostic AnonCreds Specification (v1.0) through its AnonCreds Object Method (as well as VC-JWT and JSON-LD).

cheqd also has a dedicated token, $CHEQ, used for identity writes to the network, voting in a decentralised governance framework as well as for various payment flows between verifiers, holders and issuers of Verifiable Credentials.

Installing cheqd

When using Credo with the cheqd, there's a few extra dependencies that need to be installed. We need to install the @credo-ts/cheqd package, which implements the needed interfaces for the agent.

React Native

To enable react-native support we need to follow the steps below

In the package.json file add the below code snippet, which replaces the cosmjs dependencies with he cosmjs-rn packages

Using NPM overrides we can point the cosmjs packages to cosmjs-rn.

{
"overrides": {
"@cosmjs/amino": "npm:@cosmjs-rn/amino@^0.27.1",
"@cosmjs/encoding": "npm:@cosmjs-rn/encoding@^0.27.1",
"@cosmjs/math": "npm:@cosmjs-rn/math@^0.27.1",
"@cosmjs/stargate": "npm:@cosmjs-rn/stargate@^0.27.1",
"@cosmjs/tendermint-rpc": "npm:@cosmjs-rn/tendermint-rpc@^0.27.1",
"@cosmjs/utils": "npm:@cosmjs-rn/utils@^0.27.1",
"@cosmjs/proto-signing": "npm:@cosmjs-rn/proto-signing@^0.27.1",
"@cosmjs/crypto": "npm:@cosmjs-rn/crypto@^0.27.1"
}
}

Following that we need to add a buffer polyfill

yarn add buffer

create a shim.js file with the below code snippet

import { Buffer } from 'buffer'
global.Buffer = Buffer

import shim.js file into your file where the App is imported

Adding the cheqd to the Agent

After installing the dependencies, we can register the cheqd Module on the agent by adding the below code snippet to the agent constructor.

import { Agent, DidsModule, KeyType, DidDocument } from '@credo-ts/core'
import { agentDependencies } from '@credo-ts/react-native'
import { AskarModule } from '@credo-ts/askar'
import { ariesAskar } from '@hyperledger/aries-askar-react-native'

import {
CheqdAnonCredsRegistry,
CheqdDidRegistrar,
CheqdDidResolver,
CheqdModule,
CheqdModuleConfig,
CheqdDidCreateOptions,
} from '@credo-ts/cheqd'
import { AnonCredsModule } from '@credo-ts/anoncreds'
import { anoncreds } from '@hyperledger/anoncreds-react-native'

const agent = new Agent({
config,
dependencies: agentDependencies,
modules: {
dids: new DidsModule({
registrars: [new CheqdDidRegistrar()],
resolvers: [new CheqdDidResolver()],
}),

// AnonCreds
anoncreds: new AnonCredsModule({
registries: [new CheqdAnonCredsRegistry()],
anoncreds,
}),

// Add cheqd module
cheqd: new CheqdModule(
new CheqdModuleConfig({
networks: [
{
network: '<mainnet or testnet>',
cosmosPayerSeed: '<cosmos payer seed or mnemonic>',
},
],
})
),
// Indy VDR can optionally be used with Askar as wallet and storage implementation
askar: new AskarModule({
ariesAskar,
}),
},
})

The cosmosPayerSeed can be a 32-bit seed value or a mnemonic, which can be managed using Keplr wallet which can be installed on a mobile or as a browser extension in chrome or safari which allows user's to create accounts, exchange tokens etc. To setup keplr wallet for cheqd follow this tutorial