Product Docs
Product DocsTechnical DocsLearning & GovernanceUseful Links
  • Product Docs
  • Node Docs
  • Learning Docs
  • ℹ️Getting Started
    • Product Overview
    • ➡️Get Started with cheqd Studio
      • 👉Set Up Your Account
      • 🗝️Create API Keys
      • 🪙Token Top Up
      • 🔄Advanced Configuration Options
    • ☑️Use Trust Registries for AI Agents
      • 🏗️Build an AI Agent Trust Registry
        • Setup AI Agent Trust Registry
          • Issue Verifiable Credentials to AI Agent
        • Setup and Configure MCP Server
          • Create AI Agent DID
          • Import Credential to AI Agent
          • Advanced functionality
            • Issue a Verifiable Credential
            • Verify a Credential
      • 🤝Validate AI Agent Trust Chain
  • 🟢Start using cheqd
    • 🆔Create DIDs and Identity Keys
      • Create a DID
      • Create Identity Keys
      • Create a Subject DID
      • Resolve a DID
      • Update a DID
      • Deactivate a DID
    • ✅Issue Credentials and Presentations
      • Issue a Credential
      • Setup Verida Wallet
      • Verify a Credential
      • Verify a Presentation
      • Revoke a Credential
      • Suspend or Unsuspend a Credential
    • ♻️Charge for Verifiable Credentials
      • Understanding Credential Payments
        • Access Control Conditions
        • Privacy Considerations
      • Charge for Status List
      • Issue Credential with Encrypted Status List
      • Create Verifier Pays Issuer flow
      • Bulk Update or Rotate Encryption Keys
    • 🤝Build Trust Registries
      • Decentralized Trust Chains (DTCs)
        • Root Authorisations
        • RTAO -> TAO
        • TAO -> SubTAO
        • TAO -> Trusted Issuer (TI)
        • Referencing Trust Registry within a Verifiable Credential
      • Set up Trust Chain
        • Issue Verifiable Accreditation
        • Verify Verifiable Accreditation
      • Get Started with TRAIN
        • Deploy TRAIN and Anchor rTAO in DNS
        • Validate Trust Chain
    • 🎋Create Status Lists
      • Bitstring Status List
        • Create Bitstring Status List
        • Update Bitstring Status List
        • Check Bitstring Status List
        • Search Bitstring Status List
      • Token Status List
        • Create Token Status List
        • Update Token Status List
    • ↕️Create DID-Linked Resources
      • Understanding DID-Linked Resources
        • Context for developing DID-Linked Resources
        • Technical composition of DID-Linked Resources
        • Referencing DID-Linked Resources in VCs
      • Create DID-Linked Resource
      • Search DID-Linked Resource
  • 🛠️Integrate an SDK
    • Choosing the right SDK
    • 🍏Credo
      • Setup Credo Agent
      • Decentralized Identifiers (DIDs)
        • Create a DID
        • Update a DID
        • Deactivate a DID
      • DID-Linked Resources
        • Create DID-Linked Resource
        • Resolve DID-Linked Resource
        • Create AnonCreds Schema
        • Create AnonCreds Credential Definition
      • Verifiable Credentials and Presentations
        • Issue a Verifiable Credential (AnonCreds)
        • Present a Verifiable Credential (AnonCreds)
    • 🍊ACA-Py
      • Setup ACA-Py Agent
      • Decentralized Identifiers (DIDs)
        • Create a DID
        • Update a DID
        • Deactivate a DID
      • DID-Linked Resources
        • Create AnonCreds Schema
        • Create AnonCreds Credential Definition
      • Verifiable Credentials and Presentations
        • AnonCreds
          • Issue a Verifiable Credential
          • Present a Verifiable Credential
          • Revoke a Verifiable Credential
        • JSON-LD
          • Issue a Verifiable Credential
          • Present a Verifiable Credential
    • 🍈Veramo
      • Setup Veramo CLI for cheqd
        • Troubleshooting Veramo CLI Setup
      • Decentralized Identifiers (DIDs)
        • Create a DID
        • Querying a DID
        • Update an existing DID
        • Deactivate a DID
        • Create an off-ledger holder DID
        • Managing Identity Keys
        • Troubleshooting
      • Verifiable Credentials and Presentations
        • Issue a Verifiable Credential
        • Verify a Verifiable Credential
        • Create a Verifiable Presentation
        • Verify a Verifiable Presentation
      • Credential Payments
        • Charge for Status List
        • Issue Credential with Encrypted Status List
        • Verifier pays Issuer
      • Bitstring Status List
        • Create Status List
        • Issuing a Verifiable Credential referencing Status List
      • DID-Linked Resources
        • Create a DID-Linked Resource
        • Create a new Resource version within existing Collection
    • 🫐Walt.id Community Stack
  • 🏗️Architecture
    • Architecture Decision Record (ADR) Process
    • List of ADRs
      • 🔵ADR 001: cheqd DID Method
      • 🟢ADR 002: DID-Linked Resources
      • 🟡ADR 003: DID Resolver
      • 🟠ADR 004: DID Registrar
      • 🟣ADR 005: DID Resolution & DID URL Dereferencing
  • 💫Advanced features and alternatives
    • ➡️DID Registrar
      • Setup DID Registrar
      • Create a DID
      • Create a DID-Linked Resource
    • ⬅️DID Resolver
      • Setup DID Resolver
    • ⚡AnonCreds Object Method
      • Schemas
      • Credential Definitions
      • Revocation Registry Definitions
      • Revocation Status Lists
    • 🌠Advanced Tooling
      • cheqd Cosmos CLI for identity
        • Create a DID
        • Update a DID
        • Deactivate a DID
        • Query a DID
        • Create a DID-Linked Resource
        • Update a DID-Linked Resource
      • Direct interaction with ledger code
      • VDR Tools CLI with cheqd (deprecated)
      • Demo Wallet for Identity Setup
  • ⚛️Network
    • Get started with cheqd Network
      • Identity Write Pricing
      • Comparison to Hyperledger Indy
    • ⏩Setup your Wallet
      • Setup Leap Wallet
        • Congifure cheqd Testnet for Leap
      • Setup Keplr Wallet
      • Migrate from Keplr to Leap Wallet
    • ↪️Useful Tools and APIs
      • Block Explorer
      • Testnet Faucet
      • Validator Status API
      • Cheqd x Cosmos Data APIs
      • Cosmos Airdrop Helpers
      • Cosmos Address Convertor
      • Ethereum Bridge
    • ⬆️Network Upgrades
      • 2021
        • 0.1.x
        • 0.2.x
        • 0.3.x
      • 2022
        • 0.4.x
        • 0.5.x
        • 0.6.x
      • 2023
        • 1.x
      • 2024
        • 2.x
        • 3.x
      • Root Cause Analysis of Outages
        • v1.x upgrade RCA
  • ⚖️Legal
    • License
    • Code of Conduct
    • Security Policy
  • 🆘Support
    • System Status
    • Discord
    • Bugs & Feature Requests
Powered by GitBook
LogoLogo

General

  • Website
  • Blog
  • Get $CHEQ

Product Docs

  • Product Docs
  • cheqd Studio
  • Creds.xyz
  • Bug/Feature Requests

Technical Docs

  • Node Docs
  • GitHub
  • Block Explorer

Learning Docs

  • Learning Docs
  • Governance Docs
  • Governance Forum
  • Governance Explorer
On this page
  • Instructions
  • 1. Create a DID
  • 2. Create your Resource content and save the file locally
  • 3. Create a UUID for the Resource
  • 4. Choose an option for passing the resource that best suits you
  • 5. Prepare your payload file
  • 6. Understanding Resource Fees
  • 7. Create new DID-Linked Resource

Was this helpful?

Edit on GitHub
Export as PDF
  1. Integrate an SDK
  2. Veramo
  3. DID-Linked Resources

Create a DID-Linked Resource

Create a DID-Linked Resource (DLR), linked to a Decentralized Identifier (DID) on cheqd, using Veramo.

Last updated 8 days ago

Was this helpful?

Follow these instructions to create a new DID-Linked Resource on cheqd mainnet or testnet.

⚠️ Before you begin...

Make sure you've correctly for Veramo CLI

Instructions

1. Create a DID

Follow tutorial to generate keys and create a DID.

2. Create your Resource content and save the file locally

DID-Linked Resources can be any type of file or content that is below ~200kb in size.

For the purpose of an example, lets use an AnonCreds schema (JSON file) as the resource:

{
  "name": "degreeSchema",
  "version": "1.5.7",
  "attrNames": ["name", "age", "degree", "grade"]
 }

Save this file locally and call it something like resource.json.

3. Create a UUID for the Resource

$ uuidgen
e7b662f8-d3f8-4a83-bd00-2cdcd6cc50ab

4. Choose an option for passing the resource that best suits you

Option 1: Passing resource as Base64

Prepare a file with resource and encode it into base64. On Unix systems, you can use the following command input:

$ base64 -w 0 resource.json
<path-to-the-resource-file>

Expected output:

$ base64 -w 0 resource.json
SGVsbG8sIHdvcmxk

You will need to paste the output of the Base64 into the data field of the payload.json file as shown in step 5.

Option 2: Passing resource as file

Once you have saved your Resource file locally, you can copy the path and enter it in the file field of the payload.json file as shown in step 5.

5. Prepare your payload file

Before carrying out a Resource transaction, you will need to prepare the payload.json file. This file can be saved wherever you choose, but the location must be specified in the create Resource command. (By default, it will be saved under the project root directory.)

Parameters

  • kms (default local): Key Management System (KMS) to be used for storage;

  • payload: Resource definition

    • collectionId: The last fragment of the corresponding DIDDoc

    • id: Use output from the previous step here

    • name: Arbitrary human-readable string used to identify the resource

    • resourceType: Resource type, such as CL-Schema, JSONSchema2020, etc

    • version: (Optional) client-given resource version

    • alsoKnownAs: (Optional) alternative URI(s) provided for the resource

    • data: (Optional) base64 encoded data of resource file

  • signInputs: Keys used to sign the corresponding DIDDoc. These must match the ones specified in the DIDDoc, otherwise an error will be thrown

    • verificationMethodId: Verification method ID from DIDDoc where key is published

    • keyType should match values that you used to create the DIDDoc

    • privateKeyHex should match values that you used to create the DIDDoc

  • file: (Optional) path to resource file

  • fee:

    • amount: An array of coins, coins are represented as an object with 2 fields

      • denom: ncheq (smallest denomination classification)

      • amount: See section below on fees

    • gas: Each transaction must specify the maximum amount of gas it may consume.

    • payer (Optional): The cheqd fee payer address

    • granter (Optional): The cheqd fee granter address, Provided the grantee has an allowance by the granter

The Payload file can include a Resource passed either as a file or a base64 encoded string:

Example Payload file for passing Resource as Base64 encoded string
{
    "kms": "local",
    "payload": {
        "collectionId": "d3e515cf-81af-40cb-9ac1-154827986d29", // unique ID of associated 'parent' DID
        "id": "e7b662f8-d3f8-4a83-bd00-2cdcd6cc50ab",
        "name": "TestResource",
        "resourceType": "JsonDocument",
        "version": "",
        "alsoKnownAs": [],
        "data": "SGVsbG8sIHdvcmxk" // note that the base64 encoded content is passed here
    },
    "network": "testnet",
    "signInputs": [{
        "verificationMethodId": "did:cheqd:testnet:d3e515cf-81af-40cb-9ac1-154827986d29#key-1",
        "keyType": "Ed25519",
        "privateKeyHex": "0f5c124886178037952e87e0cdc55d185732577fca19ae877e64ac9ab24a0cc534e5326e70f1a42d785d93048aee806c359ec75a7b06f39253befd1746708438"
    }],
    "fee": {
      "amount": [{
        "denom": "ncheq",
        "amount": "2500000000" // 2.5 CHEQ is the fixed fee for a JSON transaction
        }],
      "gas": "1000000",
      "payer": "cheqd1rnr5jrt4exl0samwj0yegv99jeskl0hsxmcz96" // must match the account set in the agent.yaml file
    }
}
Example Payload file for passing Resource as file
{
    "kms": "local",
    "payload": {
        "collectionId": "d3e515cf-81af-40cb-9ac1-154827986d29",
        "id": "e7b662f8-d3f8-4a83-bd00-2cdcd6cc50ab",
        "name": "TestResource",
        "resourceType": "JsonDocument"
        "version": "",
        "alsoKnownAs": []
    },
    "network": "testnet",
    "signInputs": [{
        "verificationMethodId": "did:cheqd:testnet:d3e515cf-81af-40cb-9ac1-154827986d29#key-1",
        "keyType": "Ed25519",
        "privateKeyHex": "0f5c124886178037952e87e0cdc55d185732577fca19ae877e64ac9ab24a0cc534e5326e70f1a42d785d93048aee806c359ec75a7b06f39253befd1746708438"
    }],
    "file": "/path/to/resource.json", // note that the resource passed as file is inputted here
    "fee": {
      "amount": [{
        "denom": "ncheq",
        "amount": "2500000000" // 2.5 CHEQ is the fixed fee for a JSON transaction
        }],
      "gas": "1000000",
      "payer": "cheqd1rnr5jrt4exl0samwj0yegv99jeskl0hsxmcz96" // must match the account set in the agent.yaml file
    }
}

6. Understanding Resource Fees

The maximum file size for a resource is roughly 46KB which may require a gas fee of up to 2000000.

The fee for a resource transaction changes depending on the file type being passed to the ledger. Currently there are three different variations on the fee:

JSON file

Within the payload file the amount should be specified as:

  • denom: ncheq

  • amount: 2500000000

This equates to 2.5 CHEQ.

Image file

Within the payload file the amount should be specified as:

  • denom: ncheq

  • amount: 10000000000

This equates to 10 CHEQ.

Note that images may also require a larger 'gas' fee of up to 2000000

Default (any other) file

Within the payload file the amount should be specified as:

  • denom: ncheq

  • amount: 5000000000

This equates to 5 CHEQ.

7. Create new DID-Linked Resource

veramo execute -m cheqdCreateLinkedResource --argsFile path/to/payload.json

If you do not specify the --argsFile in the previous step, you can also paste a JSON inline argument object by using the --argsJSON flag followed by the JSON payload.

. On Unix systems, the uuidgen tool can be used to generate a new UUID:

Note that transaction fees are paid by the cheqd account set in the agent.yml configuration file, . If you do not specify a fee in the transaction, the ledger will automatically deduct the appropriate fee from the account set in youragent.yml configuration. Each of cheqd's on-ledger identity transactions has a fixed fee, . If your account has insufficient balance the transaction will fail.

🛠️
🍈
configured the cheqd plugin's agent settings
this
UUIDs are used to identify DID-Linked Resources
setup here
the pricing for cheqd DIDs and DID-Linked Resources can be found here