1. Create your identity keys within a DID Document template
The first step is generating a template for your DID Document, including a new DID and associated public/private key pair. This process also aligns with method 1 in the key management guide.
It is important to note that this step does not create your DID on ledger, but it generates your identity keys as a draft DID Document for you to use in the on-ledger transaction in Step 3.
Command (inline)
You can use the following command in your CLI to create your DIDDoc and associated identity keys:
Within this command, you are able to choose from the following inputs below to produce different types of DIDDocs:
verificationMethod
Ed25519VerificationKey2020
JsonWebKey2020
Ed25519VerificationKey2018
methodSpecificIdAlgo
base58btc
uuid
network
mainnet
testnet
Expected output
Once you have submitted the command above, you should receive a DID Document draft template, including a set of identity keys, including your chosen inputs and arguments. You can find an example of this output below:
Once you have created a template for your DIDDoc and generated your keys, and before creating a DID on-ledger, you will need to prepare the payload.json file. This file can be saved where ever you choose, but the location must be specified in the create DID command used in Step 3. (By default, it will be saved under the project root directory.)
You should copy and paste the output of Step 1 as an initial starting template for your payload.json file.
Example of payload.json files
The below examples show the variation in syntax for different verification method key types in the DIDDoc payload file itself. Note that each key type has a slightly different output.
Ed25519VerificationKey2018
{"kms":"local","alias":"Veramo specific name of your DIDDoc","document": {"context": [],"id":"did:cheqd:testnet:<uniqueId>","controller": ["did:cheqd:testnet:<uniqueId>" ],"verificationMethod": [{"id":"did:cheqd:testnet:<uniqueId>#key-1","type":"Ed25519VerificationKey2018","controller":"did:cheqd:testnet:<uniqueId>","publicKeyBase58":"H3C2AVvLMv6gmMNam3uVAjZpfkcJCwDwnZn6z3wXmqPV" }],"authentication": ["did:cheqd:testnet:<uniqueId>#key-1" ],"assertionMethod": [],"capabilityInvocation": [],"capabilityDelegation": [],"keyAgreement": [],"alsoKnownAs": [],"service": [] },"versionId":"<uuid>",// optional"keys": [{"publicKeyHex":"<public_key_in_hex_encoding>","privateKeyHex":"<private_key_in_hex_encoding>","kid":"<equal_to_public_key_hex>","type":"Ed25519"// add additional key(s) if required }],"fee": {"amount": [{"denom":"ncheq","amount":"50000000000" }],"gas":"400000","payer":"cheqd1rnr5jrt4exl0samwj0yegv99jeskl0hsxmcz96"// add the cheqd account the transaction will come from }}
Ed25519VerificationKey2020
{"kms":"local","alias":"Veramo specific name of your DIDDoc","document": {"context": [],"id":"did:cheqd:testnet:<uniqueId>","controller": ["did:cheqd:testnet:<uniqueId>" ],"verificationMethod": [{"id":"did:cheqd:testnet:<uniqueId>#key-1","type":"Ed25519VerificationKey2020","controller":"did:cheqd:testnet:<uniqueId>","publicKeyMultibase":"z2yJuNbhoUpRn7ypAugSLzkCc8QEw146RJ8DD3jzCZQ6A" }],"authentication": ["did:cheqd:testnet:<uniqueId>#key-1" ],"assertionMethod": [],"capabilityInvocation": [],"capabilityDelegation": [],"keyAgreement": [],"alsoKnownAs": [],"service": [] },"versionId":"<uuid>",// optional"keys": [{"publicKeyHex":"<public_key_in_hex_encoding>","privateKeyHex":"<private_key_in_hex_encoding>","kid":"<equal_to_public_key_hex>","type":"Ed25519"// add additional key(s) if required }],"fee": {"amount": [{"denom":"ncheq","amount":"50000000000" }],"gas":"400000","payer":"cheqd1rnr5jrt4exl0samwj0yegv99jeskl0hsxmcz96"// add the cheqd account the transaction will come from }}
JSONWebKey2020
{"kms":"local","alias":"Veramo specific name of your DIDDoc","document": {"context": [],"id":"did:cheqd:testnet:<uniqueId>","controller": ["did:cheqd:testnet:<uniqueId>" ],"verificationMethod": [{"id":"did:cheqd:testnet:<uniqueId>#key-1","type":"JsonWebKey2020","controller":"did:cheqd:testnet:<uniqueId>","publicKeyJwk": {"kty":"OKP",// external (property name)"crv":"Ed25519",// external (property name)"x":"VCpo2LMLhn6iWku8MKvSLg2ZAoC-nlOyPVQaO3FxVeQ"// external (property name) } }],"authentication": ["did:cheqd:testnet:<uniqueId>#key-1" ],"assertionMethod": [],"capabilityInvocation": [],"capabilityDelegation": [],"keyAgreement": [],"alsoKnownAs": [],"service": [] },"versionId":"<uuid>",// optional"keys": [{"publicKeyHex":"<public_key_in_hex_encoding>","privateKeyHex":"<private_key_in_hex_encoding>","kid":"<equal_to_public_key_hex>","type":"Ed25519"// add additional key(s) if required }],"fee": {"amount": [{"denom":"ncheq","amount":"50000000000" }],"gas":"400000","payer":"cheqd1rnr5jrt4exl0samwj0yegv99jeskl0hsxmcz96"// add the cheqd account the transaction will come from }}
Parameters
kms (default local): Key Management System (KMS) to be used for storage.
alias: A human-friendly alias for the DID. Only used locally when referencing operations in Veramo CLI.
document: Full body of the DID Document
versionId: (optional): Custom versionId for the DID Document. If this is not set manually, then a UUID will be automatically generated for the DID Document version.
keys: Keys used to sign the DIDDoc. These must match the ones specified in the DIDDoc, otherwise an error will be thrown.
fee
amount: An array of coins, coins are represented as an object with 2 fields