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 Verifiable Credential
      • Setup Verida Wallet
      • Verify a Verifiable Credential
      • Verify a Verifiable Presentation
      • Revoke a Verifiable Credential
      • Suspend or Unsuspend a Verifiable 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 a Verifiable Accreditation
        • Verify a 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 a DID-Linked Resource
      • Search for DID-Linked Resources
  • đŸ› ī¸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
  • Pre-requisites
  • Creating a new Resource linked to a DID
  • 1. Create a new DID + DIDDoc
  • 2. Create a UUID for the Resource
  • 3. Prepare a file with Resource content
  • 4. Check that new Resource version was successfully written to the ledger
  • 5. Additional queries to the ledger

Was this helpful?

Edit on GitHub
Export as PDF
  1. Advanced features and alternatives
  2. Advanced Tooling
  3. cheqd Cosmos CLI for identity

Create a DID-Linked Resource

Create a DID-Linked Resource (DLR) linked to a cheqd DID, using the cheqd Cosmos CLI.

Last updated 27 days ago

Was this helpful?

The purpose of this document is to outline how someone can create a Resource on the cheqd network using . The process that's followed is similar to what's described in the .

Pre-requisites

  1. Install the latest stable cheqd-node CLI, either as a or .

  2. Acquire test CHEQ tokens through (if creating it on our testnet), or (if you plan on creating it on mainnet).

Creating a new Resource linked to a DID

1. Create a new DID + DIDDoc

Note: If you already have a DIDDoc and corresponding keys, you can skip this step.

To create a DIDDoc, you can follow the instructions to .

Let's assume the DID for the DIDDoc is as follows:

did:cheqd:mainnet:6h7fjuw37gbf9ioty633bnd7thf65hs1

2. Create a UUID for the Resource

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

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

3. Prepare a file with Resource content

Resource content should be placed in a file and stored locally.

Command

cheqd-noded tx resource create [payload-file] [resource-data-file] [flags]

Understanding Resource Fees

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.

Default (any other) file

Within the payload file the amount should be specified as:

  • denom: ncheq

  • amount: 5000000000

This equates to 5 CHEQ.

Parameters

  • payload-file - file with JSON formatted payload. The format and structure can be found in example

  • resource-data-file - file which will be sent to the ledger as a data. Can be a picture or an image or whatever you want.

  • flags - additional parameters like, --gas or --from.

Example input:

cheqd-noded tx resource create \
  --chain-id cheqd \
  --keyring-backend test \
  --output json \
  --fees 2500000000ncheq \
  --gas auto \
  --gas-adjustment 1.8 \
  --from base_account \
  [payload.json] [resource.json]

where payload.json is:

{
  "payload": {
    "data": null,
    "collectionId": "b0ca0b75-ca6a-4674-a261-45f6dd0c9c77",
    "id": "5e16a3f9-7c6e-4b6b-8e28-20f56780ee25",
    "name": "TestResource",
    "version": "1.0",
    "resourceType": "TestType",
    "alsoKnownAs": []
  },
  "signInputs": [
    {
      "verificationMethodId": "did:cheqd:testnet:b0ca0b75-ca6a-4674-a261-45f6dd0c9c77#key1",
      "privKey": "y4B5qis9BXUq/mODsrWtS3q5ejOk/okSIXlX1/a9HvuG3PgYmekfQmq3QhJ4JSzN/rkiGCQDNKoTXMmxuXDHbg=="
    }
  ]
}

After you execute the command, you will receive "code": 0" if the resource was successfully written to the ledger.

Otherwise, the raw_logs field in the response can help figure out why something went wrong. For example:

{
  "code": 1201,
  "data": "",
  "raw_log": "failed to execute message; message index: 0: id:cheqd:testnet:fcbarcelona: DID Doc not found"
}

4. Check that new Resource version was successfully written to the ledger

Finally, to check that the resource was successfully written, we can use the following query:

cheqd-noded query resource specific-resource \
    <collection-id> \
    <resource-id> \
    --node https://rpc.cheqd.network:443

Parameters

  • <collection-id>: The same unique identifier as that after the namespace of the corresponding DID created in step 1

  • <resource-id>: Unique ID of the resource within the collection of resources associated with the DIDDoc

Example input:

cheqd-noded query resource specific-resource \
    c82f2b02-bdab-4dd7-b833-3e143745d612 \
    3e6bd814-6851-4c8a-b114-c64f035ef590 \
    --node https://rpc.cheqd.net:443 --output json

Ouput:

{
  "resource": {
    "resource": {
      "data": "..."
    },
    "metadata": {
      "collectionId": "c82f2b02-bdab-4dd7-b833-3e143745d612",
      "id": "3e6bd814-6851-4c8a-b114-c64f035ef590",
      "name": "EventBrite Logo",
      "version": "",
      "resourceType": "image/png",
      "alsoKnownAs": [
        {
          "uri": "did:cheqd:mainnet:c82f2b02-bdab-4dd7-b833-3e143745d612/resources/3e6bd814-6851-4c8a-b114-c64f035ef590",
          "description": "did-url"
        }
      ],
      "mediaType": "image/svg+xml",
      "created": "2022-11-17T10:35:23Z",
      "checksum": "a95380f460e63ad939541a57aecbfd795fcd37c6d78ee86c885340e33a91b559",
      "previousVersionId": "",
      "nextVersionId": ""
    }
  }
}

Notice that both previous_version_id and next_version_id are empty now cause there is only one resource in such collection c82f2b02-bdab-4dd7-b833-3e143745d612.

5. Additional queries to the ledger

There are also 2 annother commands for getting resource from ledger depending what the actual info is needed.

Get metadata

Here is the command which allows to get only metadata information without getting the whole resource. The format of call is:

cheqd-noded query resource metadata [collection-id] [resource-id] [flags]

Parameters collection-id and resource-id have the same meaning as before.

Example input:

cheqd-noded query resource metadata \
    c82f2b02-bdab-4dd7-b833-3e143745d612 \
    3e6bd814-6851-4c8a-b114-c64f035ef590 \
    --node https://rpc.cheqd.net:443 --output json

Output:

{
  "resource": {
    "collection_id": "c82f2b02-bdab-4dd7-b833-3e143745d612",
    "id": "3e6bd814-6851-4c8a-b114-c64f035ef590",
    "name": "EventBrite Logo",
    "version": "",
    "resource_type": "image/png",
    "also_known_as": [
      {
        "uri": "did:cheqd:mainnet:c82f2b02-bdab-4dd7-b833-3e143745d612/resources/3e6bd814-6851-4c8a-b114-c64f035ef590",
        "description": "did-url"
      }
    ],
    "media_type": "image/svg+xml",
    "created": "2022-11-17T10:35:23Z",
    "checksum": "a95380f460e63ad939541a57aecbfd795fcd37c6d78ee86c885340e33a91b559",
    "previous_version_id": "",
    "next_version_id": ""
  }
}

Get collection of resources

For querying all the resources but only metadata there is a special command:

cheqd-noded query resource collection-metadata [collection-id] [flags]

As the main parameter it requires only collection-id.

Example input:

cheqd-noded query resource collection-metadata c82f2b02-bdab-4dd7-b833-3e143745d612  --node https://rpc.cheqd.net:443 --output json

Ouput:

{
  "resources": [
    {
      "collection_id": "c82f2b02-bdab-4dd7-b833-3e143745d612",
      "id": "3e6bd814-6851-4c8a-b114-c64f035ef590",
      "name": "EventBrite Logo",
      "version": "",
      "resource_type": "image/png",
      "also_known_as": [
        {
          "uri": "did:cheqd:mainnet:c82f2b02-bdab-4dd7-b833-3e143745d612/resources/3e6bd814-6851-4c8a-b114-c64f035ef590",
          "description": "did-url"
        }
      ],
      "media_type": "image/svg+xml",
      "created": "2022-11-17T10:35:23Z",
      "checksum": "a95380f460e63ad939541a57aecbfd795fcd37c6d78ee86c885340e33a91b559",
      "previous_version_id": "",
      "next_version_id": ""
    },
    {
      "collection_id": "c82f2b02-bdab-4dd7-b833-3e143745d612",
      "id": "9447c669-0ba1-4989-bd10-a85cc298aace",
      "name": "Discord Logo",
      "version": "",
      "resource_type": "image/png",
      "also_known_as": [
        {
          "uri": "did:cheqd:mainnet:c82f2b02-bdab-4dd7-b833-3e143745d612/resources/9447c669-0ba1-4989-bd10-a85cc298aace",
          "description": "did-url"
        }
      ],
      "media_type": "image/png",
      "created": "2022-11-17T10:35:51Z",
      "checksum": "b2939df5a48f422fc9d62f270c182f07b5fd5a7a334478ea73af4fdb5eb12d3b",
      "previous_version_id": "",
      "next_version_id": ""
    },
    {
      "collection_id": "c82f2b02-bdab-4dd7-b833-3e143745d612",
      "id": "ba4d1a8b-6395-4b96-8492-aaf2800d5727",
      "name": "Twitter Logo",
      "version": "",
      "resource_type": "image/png",
      "also_known_as": [
        {
          "uri": "did:cheqd:mainnet:c82f2b02-bdab-4dd7-b833-3e143745d612/resources/ba4d1a8b-6395-4b96-8492-aaf2800d5727",
          "description": "did-url"
        }
      ],
      "media_type": "image/png",
      "created": "2022-11-17T10:36:26Z",
      "checksum": "aeb8f203a6a21cca668c5c8983dfe86b3cf95add102305da8208100595d69800",
      "previous_version_id": "",
      "next_version_id": ""
    },
    {
      "collection_id": "c82f2b02-bdab-4dd7-b833-3e143745d612",
      "id": "cb3f5f64-c138-4309-b9ea-8d658b0ae28e",
      "name": "IIW Event Logo",
      "version": "",
      "resource_type": "image/png",
      "also_known_as": [
        {
          "uri": "did:cheqd:mainnet:c82f2b02-bdab-4dd7-b833-3e143745d612/resources/cb3f5f64-c138-4309-b9ea-8d658b0ae28e",
          "description": "did-url"
        }
      ],
      "media_type": "image/png",
      "created": "2022-11-17T10:36:37Z",
      "checksum": "d48e158b915eae31ba2db640bd4aac7f82179ee5ca0263a8fe99012d4b02cf48",
      "previous_version_id": "",
      "next_version_id": ""
    },
    {
      "collection_id": "c82f2b02-bdab-4dd7-b833-3e143745d612",
      "id": "e2651dd2-7ca7-44f1-9ba5-57a77747d9b4",
      "name": "GitHub Logo",
      "version": "",
      "resource_type": "image/png",
      "also_known_as": [
        {
          "uri": "did:cheqd:mainnet:c82f2b02-bdab-4dd7-b833-3e143745d612/resources/e2651dd2-7ca7-44f1-9ba5-57a77747d9b4",
          "description": "did-url"
        }
      ],
      "media_type": "image/png",
      "created": "2022-11-17T10:36:09Z",
      "checksum": "22ed95ff774cee8427c86b60288af4077b3b26424c758bec95a34aa8b7a88937",
      "previous_version_id": "",
      "next_version_id": ""
    }
  ],
  "pagination": null
}

Congratulations! You've successfully created a resource on cheqd ledger; hopefully, the first of many.

fees - the specific fee for the transaction, depending on the

đŸ’Ģ
🌠
cheqd Cosmos CLI
high-level Resource creation flow
standalone binary
Docker container image
our testnet faucet
CHEQ tokens
create a DID with cheqd Cosmos CLI
UUIDs are used to identify Resources
type of resource file defined here