Setup your Veramo CLI to start using cheqd's identity functionality, including Decentralized Identifiers (DIDs), Verifiable Credentials and DID-Linked Resources (DLRs).
If you're looking to use the Veramo CLI with cheqd or develop a proof-of-concept application, use the official Veramo CLI setup guide.
This step is exactly :
Note: Depending on your system permissions, you might be prompted for additional permissions. Add sudo to the beginning of the command in case that happens.
Verify the installation was correct. Command below should output latest version of Veramo you installed.
did-provider-cheqd packageInstall the did-provider-cheqd NPM package in a similar fashion:
You can check all of your NPM package versions by running the command:
agent.yml configuration fileDownload the file that contains the configuration for cheqd network to be used with Veramo CLI.
You can do this in terminal through:
Note: Alternatively, you can also fetch this by the repository.
agent.yml file in an editor to customise the configYou can open the agent.yml in a text editor/IDE of your choice to edit a few mandatory settings.
In terminal, you can edit the agent.yml file using an editor like nano:
Make sure you provide the actual relative/absolute path to the file.
By default, the did-provider-cheqd package has a default SQLite database password, but it's a good idea to modify and change this to a new key unique to your install.
Take the key generated and replace the value under dbEncryptionKey in the agent.yml file.
In order to be able to read/query did:cheqd entries from the ledger, you need to configure a REST API endpoint for a instance.
The default value is set to resolver.cheqd.net, which is an instance of the cheqd DID Resolver hosted by the cheqd team. This DID Resolver instance can handle requests for did:cheqd:mainnet as well as did:cheqd:testnet namespaces.
If you want, you can replace the url property with a different REST API endpoint for a different instance of the cheqd DID Resolver.
Note: This configuration is an advanced step and not recommended for most users. Skip it and continue to the next step in most cases, unless you know why you want to switch the resolver interface.
If you plan on interacting with multiple DID methods using Veramo CLI, you can alternatively query did:cheqd using instead. This allows your CLI configuration to handle .
Firstly, comment out the custom did-cheqd-resolver entry and uncomment the universal-resolver entry. This tells Veramo CLI to use the Universal Resolver interface for did:cheqd.
Also comment out this section for the did-cheqd-resolver:
Finally, uncomment and configure the universal-resolver interface:
In order to add cheqd Testnet to your Leap extension, please follow the following tutorial:
While reading/querying from the cheqd ledger incurs no cost, if you want to to cheqd ledger, you need to pay transaction fees for the ledger writes.
You need to configure this in under didManager section as shown above, where you'll need to edit:
cosmosPayerMnemonic: . This is only stored locally, and the mnemonic is used to reconstitute the account address and keys used to pay for the transaction.
rpcUrl: For both did:cheqd:mainnet: as well as did:cheqd:testnet: sections, you can specify a Cosmos SDK RPC endpoint. This endpoint is where transactions are sent to. By default, this is populated with rpc.cheqd.net (for mainnet) and rpc.cheqd.network
agent.yml file and exitMake sure all your edits above are persisted and saved to a file that you can access.
Once you've completed Step 2 above, verify that your Veramo configuration is accurate using the following command. If your configuration is correct, you should get a success message like the one below.
If the
config checkthrows an error, check out our to see common errors and fixes.
Now that your Veramo CLI installation is successfully set up to work with cheqd, try following our tutorials for:
defaultProvider: The default cheqd network is set to did:cheqd:testnet to allow developers to test out network functionality. However, if you prefer, you can switch this out to did:cheqd:mainnet instead.
npm i @veramo/cli@latest -gveramo -v
x.x.xnpm install @cheqd/did-provider-cheqd@latest -gnpm list -gwget -c https://raw.githubusercontent.com/cheqd/did-provider-cheqd/main/agent.ymlnano <path/to/>agent.yml$ veramo config gen-key
X25519 raw private key (hex encoded):
4a5aeb56c7956dd6f3312e7094130a03afc060b95621fa3a86577aaf2b67cc1d
You can use this key with @veramo/kms-local#SecretBox
or replace the default agent.yml 'dbEncryptionKey' constantdid-cheqd-resolver:
$require: '@cheqd/did-provider-cheqd?t=function&p=/cheqd#getResolver'
$args:
- url: 'https://resolver.cheqd.net/1.0/identifiers/'# DID resolvers
didResolver:
$require: '@veramo/did-resolver#DIDResolverPlugin'
$args:
- resolver:
$require: did-resolver#Resolver
$args:
- key:
$ref: /did-key-resolver
# cheqd:
# $ref: /did-cheqd-resolver
cheqd:
$ref: /universal-resolver# did-cheqd-resolver:
# $require: '@cheqd/did-provider-cheqd?t=function&p=/cheqd#getResolver'
# $args:
# - url: 'https://resolver.cheqd.net/1.0/identifiers/'universal-resolver:
$require: '@veramo/did-resolver#UniversalResolver'
$args:
- url: https://dev.uniresolver.io/1.0/identifiers/# DID Manager
didManager:
---
defaultProvider: did:cheqd:testnet
providers:
did:cheqd:mainnet:
$require: '@cheqd/did-provider-cheqd#CheqdDIDProvider'
$args:
- defaultKms: local
cosmosPayerMnemonic: <your_cosmos_mnemonic_paying_for_did_txs>
networkType: mainnet
rpcUrl: 'https://rpc.cheqd.net'
did:cheqd:testnet:
$require: '@cheqd/did-provider-cheqd#CheqdDIDProvider'
$args:
- defaultKms: local
cosmosPayerMnemonic: <your_cosmos_mnemonic_paying_for_did_txs>
networkType: testnet
rpcUrl: 'https://rpc.cheqd.network'$ veramo config check -f <path/to/>agent.yml
Your Veramo configuration seems fine. An agent can be created and the 'agent.execute()' method can be called on it.Troubleshoot issues that may arise while using the Veramo CLI for cheqd.
This guide provides common errors and potential fixes for them if you encountered errors when setting up Veramo CLI.
@cheqd/did-provider-cheqdThis error typically happens when the version of did-provider-cheqd is incompatible with the version of Veramo CLI being used.
This can happen if you didn't use the npm -g ("global") flag when installing the packages, and have a conflicting package version for any of the required packages in the folder where you executed this command from.
To verify if this is the case, check the version number of globally-installed NPM packages. Your list may be shorter or longer than this list, but pay close attention to the @cheqd/did-provider-cheqd and @veramo/cli versions.
Compare and contrast this from the output from the same folder where the command failed without the --global / -g flag:
In this example above, you'll see that the version of the @veramo/cli package is not the same one as the global one. This could equally happen with the @cheqd/did-provider-cheqd version.
Doing a global install for both packages will ensure that you've got the correct packages, regardless of which folder the agent.yml file is kept in.
This error is thrown if the cosmosPayerMnemonic value is set to an incorrect number of words (it should either be 12 or 24 words), or if it's left to the default value of 'your cosmos payer mnemonic'.
Note: You can use the same mnemonic for both mainnet and testnet, since the same account address has separate balances on different networks.
Heads-up: Even if you're trying it on testnet you still need to put cosmosPayerMnemonic for your mainnet (You can use the same cosmosPayerMnemonic). Otherwise, you will still be getting the same error as above when you run veramo config check -f agent.yml.
wget -c https://raw.githubusercontent.com/cheqd/did-provider-cheqd/main/agent.yml command is giving you errorsFirst, create agent.yml file at root directory level.
Second, , copy everything from there and paste it in your agent.yml file. And you're good to go. π
$ veramo config check -f agent.yml
Unable to create agent from ./agent.yml. Error creating @cheqd/did-provider-cheqd['CheqdDIDProvider']: Cannot find module '@cheqd/did-provider-cheqd'$npm list -g
/usr/local/lib
βββ @cheqd/[email protected]
βββ @veramo/[email protected]+6fbd22fa
βββ [email protected]$ npm list
@cheqd/[email protected] /path/to/some/other/folder
βββ @cheqd/[email protected]
βββ @cheqd/[email protected]
βββ ...
βββ @veramo/[email protected]
βββ @veramo/[email protected]
βββ @veramo/[email protected]
βββ @veramo/[email protected]
βββ @veramo/[email protected]
βββ ...$ veramo config check -f agent.yml
Your Veramo configuration seems fine. An agent can be created and the 'agent.execute()' method can be called on it.
/usr/local/lib/node_modules/@cheqd/did-provider-cheqd/node_modules/@cosmjs/crypto/build/bip39.js:2137
throw new Error(`Invalid word count in mnemonic (allowed: ${allowedWordsLengths} got: ${words.length})`);