Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
An existing did:cheqd
entry created using any SDK/CLI. For development purposes, this can be done using the cheqd-node
Cosmos CLI.
NOTE: Use the cheqd DID Resolver for production-grade usage
Querying using the Cosmos CLI is useful for development purposes, but the DID Resolver is designed for programmatic usage. Production-grade SDKs such as Veramo SDK for cheqd also rely on the DID Resolver package.
The purpose of this document is to describe how an existing DID (and associated DIDDoc) can be deactivated using .
NOTE: The procedures below are only recommended for development purposes!
Using
cheqd-node
Cosmos CLI for real-world production usage is not recommended, since the identity keys are passed in raw form to the CLI. This is fine in development/testing usage, but is not recommend for mainnet.Developers are encouraged to use or look at .
Learn how to
with cheqd Cosmos CLI
As in flow with we need to compile payload.json
file with private key inside and pass it to the CLI. The resulting JSON in our example will look liks:
Send the updated DIDDoc to the ledger. This must be signed with the correct identity keys:
Payload_in_JSON
- previously compiled JSON.
--from
: Cosmos account key which will pay fees for the transaction to be written to ledger.
--node
: IP address or URL of node to send request to
--chain-id
: E.g., cheqd-testnet-6
--fees
: Set to 10000000000ncheq, which is the fixed fee for deactivating a DID
The purpose of this document is to describe how a DID (and associated DIDDoc) can be created using .
NOTE: The guidance below is only recommended to be used for testing purposes!
Using
cheqd-node
Cosmos CLI for real-world production environments is not recommended, since the identity keys are passed in raw form to the CLI. This is fine in development/testing usage, but is not recommend for mainnet.Developers are encouraged to use or look at .
Access to a . You can either get this from , or .
Understand how to use cheqd and .
Tokens to pay for identity transactions, since all ledger transactions are metered.
For testing purposes, CHEQ test tokens can be acquired from .
Mainnet CHEQ tokens can be .
For the remainder of this tutorial, it's assumed that the DID and associated DID Document is being created on testnet. These commands can easily be modified for mainnet.
First, we'll need to generate a verification key:
The result should look like the following:
Note: Keep this key safe! It is used to create the DIDDoc, and to update it in the future. Normally, you should be careful when cat
-ing such keys as it reveals the private key as well.
Encode the identity key's public key to one of the formats below according to the verificaiton method type you selected, as this will be later required in the verificationMethod
section:
A unique-id
should only be a 16-byte encoded base58 string (Indy-style) or a uuid.
For example, we can generate uuid using uuidgen
tool:
The result for our example will be b0ca0b75-ca6a-4674-a261-45f6dd0c9c77
, so let's use it as our unique-id
in our DIDDoc.
Copy-paste the template below into your terminal into a blank file (e.g., using nano
). We will add additional required information into the blank fields <xxxxx>
in the next steps.
<namespace>
: Can be testnet
or mainnet
. For this CLI, we strongly suggest using testnet
.
<unique-id>
: Unique identifier, created in step #3
<key-alias>
: A key alias for the verification method identifier, e.g., #key1
<verification-method-type>
: Verification method type slected from step #2 above
<public-key-base58>, <public-key-multibase>, <public-key-jwk>
: Any one of the values from the result of step #2 above
<auth-key-alias>
: Alias of authentication key. Can be a reference to an existing verification method.
<service-key>
: Alias for service property. This is an optional section but useful to understand the power of DIDDocs.
<URI-to-object>
: A valid URI that can act as a service endpoint.
The examples below show the variation in syntax for different verification method key types in the DIDDoc contents. Note that each key type has a slightly different output.
We recommend you save this DIDDoc file (e.g., in a file called diddoc.json
) for the following steps.
After assembling the DID-Document JSON file we are ready to compile the final payload file with private key inside.
The example of payload.json
files with different verification methods:
Now that we have our DIDDoc prepared, we can send a create DID request to the ledger:
Where:
--from
: Should be an alias of a cheqd/Cosmos key, which will be used to pay for the ledger transaction.
--fees
: Should equal 50000000000ncheq, which is equivalent to 50 CHEQ, the current price for a create DID transaction on testnet and mainnet.
After you execute the command, you will receive "code": 0"
if the DID was successfully written to the ledger.
Otherwise, the raw_logs
field in the response can help figure out why something went wrong. For example:
Finally, to check that the DID was successfully written to the ledger, we can use the following query:
where:
<identifier-of-your-DIDDoc>
: Fully-qualified DID with <unique-id>
For example:
Congratulations! You've created, hopefully, the first of many DIDs on cheqd!
Since upgrading to 1.x.y
version, we introduced versioning feature for DID Documents. This means that it is possible to get the previous version of a DID Document using the particular versionId of the document.
For querying particular version of the DID-Document the next command can be used:
Where:
id
- identifier of your DID-Document. Fully-qualified DID with <unique-id>
version-id
- particular id of version you want to get
Command:
Output:
Note that the output here is in snake_case because of how the cheqd ledger represents protobufs. This output would be in spec compliant JSON if queried using our DID resolver.
For querying all the versions there is a command:
Where:
id
- identifier of your DID-Document. Fully-qualified DID with <unique-id>
Output:
NOTE: The tutorials below are only recommended to be used for testing purposes!
Using
cheqd-node
Cosmos CLI for real-world production environments is not recommended, since the identity keys are passed in raw form to the CLI. This is fine in development/testing usage, but is not recommend for mainnet.
Utilise our cheqd Cosmos CLI for identity for testing purposes, following the tutorials listed below:
There are plenty of other places you can go to get started creating . Simply pick the option which is best suited for your needs:
The purpose of this document is to describe how an existing DID (and associated DIDDoc) can be updated using .
NOTE: The procedures below are only recommended for development purposes!
Using
cheqd-node
Cosmos CLI for real-world production usage is not recommended, since the identity keys are passed in raw form to the CLI. This is fine in development/testing usage, but is not recommend for mainnet.Developers are encouraged to use or look at .
Learn how to
with cheqd Cosmos CLI
Given this procedure below is intended for development/training purposes, we assume that the user stores their public/private keys safely during the DID creation process and has access to it.
Updating a DIDDoc requires the full updated DIDDoc to be sent. Only the updated/changed parts cannot be sent. This accounts for scenarios where the DIDDoc may have been updated on ledger, but the local copy is not synced with the latest changes.
Use a text editor like nano
to edit the body of the DIDDoc (the example below assumes it's saved in a file called payload.json
).
Send the updated DIDDoc to the ledger. This must be signed with the correct identity keys:
Payload_in_JSON
- previously compiled JSON.
--from
: Cosmos account key which will pay fees for the transaction to be written to ledger.
--node
: IP address or URL of node to send request to
--chain-id
: E.g., cheqd-testnet-6
--fees
: Set to 25000000000ncheq, which is the fixed fee for updating a DID
The purpose of this document is to describe how someone can create a new Resource on under an existing Collection.
This tutorial uses the , similar to the .
Install the latest stable cheqd-node CLI, either as a or .
Acquire test CHEQ tokens through (if creating it on our testnet), or (if you plan on creating it on mainnet).
An
Having under this DIDDoc Collection
. On Unix systems, the uuidgen
tool can be used to generate a new UUID:
Resource content should be placed in a file and stored locally.
Resources with the same Collection ID and name are grouped into version sets. Each resource in such a set has a link to the previous version (except the first version) and the next version (if it's not the most recent version).
To create a resource and mark it as a new version within a particular group, we need to use the same collection-id
and name
as in the previous version. Links between versions will be created automatically.
New versions have dedicated unique IDs and can be referenced and retrieved as any other resources.
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.
where payload.json
is:
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:
Finally, to check that the resource was successfully written, we can use the following query:
<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
Notice that previous_version_id
is not empty and pointing to the previously created resource with id
: 3e6bd814-6851-4c8a-b114-c64f035ef590
.
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 .
Install the latest stable cheqd-node CLI, either as a or .
Acquire test CHEQ tokens through (if creating it on our testnet), or (if you plan on creating it on mainnet).
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
. On Unix systems, the uuidgen
tool can be used to generate a new UUID:
Resource content should be placed in a file and stored locally.
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:
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:
where payload.json
is:
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:
Finally, to check that the resource was successfully written, we can use the following query:
<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:
Ouput:
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
.
There are also 2 annother commands for getting resource from ledger depending what the actual info is needed.
Here is the command which allows to get only metadata information without getting the whole resource. The format of call is:
Parameters collection-id
and resource-id
have the same meaning as before.
Example input:
Output:
For querying all the resources but only metadata there is a special command:
As the main parameter it requires only collection-id
.
Example input:
Ouput:
Congratulations! You've successfully created a resource on cheqd ledger; hopefully, the first of many.
Note that each of cheqd's on-ledger identity transactions has a fixed fee, . If your account has insufficient balance the transaction will fail.
You'll need to replace some values (as described in the ):
Note that each of cheqd's on-ledger identity transactions has a fixed fee, . If your account has insufficient balance the transaction will fail.
For example, we can and change the Service Endpoint from bar.example.com
to foo.example.com
:
As in flow with we need to compile payload.json
file with private key inside and pass it to the CLI. The result JSON in our example will look liks:
Note that each of cheqd's on-ledger identity transactions has a fixed fee, . If your account has insufficient balance the transaction will fail.
flags
- additional parameters like, --gas
or --from
. --fees
should match the price of the .
fees
- the specific fee for the transaction, depending on the
Simple setup for building cheqd DIDs into existing applications using REST APIs, building into the .
Walt.id SSI Kit is an SDK that supports the standards for identity, with full cheqd support.