📜SDK

Get started with the cheqd TypeScript SDK, an NPM package providing the core functionality to create and manage Decentralized Identifiers (DIDs) and DID-Linked Resources (DLRs) on the cheqd network.

Introduction

The cheqd TypeScript SDK is an NPM package providing the core functionality to create and manage Decentralized Identifiers (DIDs) and DID-Linked Resources (DLRs) on the cheqd network in a simple and intuitive way.

The SDK also provides interfaces to interact with the cheqd network, including sending transactions and querying data, as well as utilities for key management and cryptographic operations.

Transaction fees can alternatively be paid in IBC-transferred tokens accepted by the cheqd network through governance proposals. This allows for greater flexibility in how users can manage their transaction costs. For example, paying fees in a different token can help users avoid price volatility in the native token by using MiCA-compliant stablecoins such as USDC, EURC, etc. This is achieved through the use of fee-abstraction module over IBC.For more information on IBC transfers, see the IBC documentation.

The SDK is designed to be easy to use and integrate into existing applications, making it a great choice for developers looking to build decentralized identity solutions on the cheqd network, fine-tuning their applications to meet specific needs.

Explore the SDK

Explore Advanced SDK Features

The cheqd SDK provides advanced modules for comprehensive identity and transaction management. Each module supports both traditional native token fees and modern fee abstraction capabilities.

Core Identity Modules

Fee Management Modules

Module Integration Patterns

Fee Abstraction Integration

All SDK modules support fee abstraction, allowing you to:

  • Multi-Token Fees: Pay transaction fees in USDC, EURe, or OSMO

  • Stablecoin Strategy: Use MiCA-compliant stablecoins for predictable fee costs

  • Cross-Chain Compatibility: Accept IBC-transferred tokens from connected chains

  • Governance Integration: Support tokens approved through network governance

Example: Create a DID while paying fees in USDC:

const feeInUsdc = {
  amount: [coin('12000', 'ibc/F663521BF1836B00F5F177680F74BFB9A8B5654A694D0D2BC249E03CF2509013')],
  gas: '360000',
  payer: feePayer
};

await sdk.createDidDocTx(signInputs, didPayload, feePayer, feeInUsdc);

Feemarket Integration

Standard Cosmos SDK transactions benefit from dynamic pricing:

  • Real-Time Pricing: Gas prices adjust based on network demand

  • Cost Optimization: Lower fees during network low-activity periods

  • Congestion Management: Automatic fee adjustment for transaction prioritization

  • API Integration: Direct access to current gas prices via network endpoints

Example: Token transfer with dynamic fees:

const feemarketModule = new FeemarketModule(sdk.signer, sdk.querier);
const gasPrice = await feemarketModule.generateSafeGasPriceByDenom('ncheq');
const fee = FeemarketModule.generateFeesFromGasPrice(gasPrice, sender, '200000');

await sdk.signer.signAndBroadcast(sender, [transferMsg], fee);

Fee Strategy Decision Matrix

Transaction Type
Native CHEQ
Fee Abstraction
Dynamic Feemarket
Best Use Case

DID Operations

✅ Fixed pricing

✅ USDC/EURe/OSMO

❌ Fixed model only

Fee abstraction for stablecoin predictability

DID-Linked Resources

✅ Fixed pricing

✅ USDC/EURe/OSMO

❌ Fixed model only

Fee abstraction for multi-chain integration

Token Transfers

✅ Standard

✅ Alternative tokens

✅ Dynamic pricing

Dynamic fees during low congestion

Staking Operations

✅ Standard

✅ Alternative tokens

✅ Dynamic pricing

Fee abstraction for predictable costs

Governance Voting

✅ Standard

✅ Alternative tokens

✅ Dynamic pricing

Dynamic fees for cost efficiency

Getting Started by Use Case

For Identity Applications

  1. Start with DID Module for identity creation

  2. Add Resource Module for credential schemas

  3. Integrate Fee Abstraction for stablecoin payments

For DeFi Applications

  1. Use Feemarket Module for optimal transaction costs

  2. Add Fee Abstraction for multi-token support

  3. Implement dynamic fee strategies based on market conditions

For Enterprise Solutions

  1. Implement Fee Abstraction for predictable costs

  2. Use DID Module for organizational identities

  3. Deploy Resource Module for document management

Last updated

Was this helpful?