The purpose of this document is to describe how someone can create a new Resource on under an existing Collection.
This tutorial uses the cheqd Cosmos CLI, similar to the creating a new Resource tutorial.
Install the latest stable cheqd-node CLI, either as a standalone binary or Docker container image.
Acquire test CHEQ tokens through our testnet faucet (if creating it on our testnet), or CHEQ tokens (if you plan on creating it on mainnet).
Having a Resource already created under this DIDDoc Collection
UUIDs are used to identify Resources. 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.
flags
- additional parameters like, --gas
or --from
. --fees
should match the price of the speicfic resource file type defined here.
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
.