Create a Credential Template

Create a Credential Template

Creating credential templates on the cheqd mainnet is not available on the free tier. The cheqd testnet is available on all tiers.

Before issuing a credential you need to create a schema and credential definition. In Paradym we call this a credential template. This workflow defines actions that create a credential template, and takes parameters such as the name and attributes of the credential template from the workflow input.

Creating a credential template only needs to happen once for every type of credential you want to issue. In most cases you can copy this example workflow as is, and execute it through the UI. Once it has finished executing, you can extract the credential definition ID from the execution payload and use this as input to the Issue Credential Action.

The following actions are used in this example workflow:

YAML
name: Register Credential Template
 
# Workflow can be triggered through the API (or manually through the UI)
trigger:
  type: api
 
# Input object allows to dynamically pass the name, version and attributes of the schema
input:
  type: 'object'
  properties:
    attributeNames:
      type: array
      items:
        type: string
      minLength: 1
    name:
      type: string
    version:
      type: string
      description: Must match x.x.x or x.x (e.g. 1.0 or 1.0.0)
      default: '1.0'
    network:
      type: string
      default: 'cheqd:testnet'
      description: Mainnet is only available on the paid tiers.
      enum:
        - 'cheqd:testnet'
        - 'cheqd:mainnet'
  required:
    - name
    - version
    - attributeNames
    - network
 
actions:
  - id: createSchema
    name: anoncreds/createSchema@v1
    attributes:
      attributeNames: $.input.attributeNames
      name: $.input.name
      version: $.input.version
      network: $.input.network
 
  - id: createCredentialDefinition
    name: anoncreds/createCredentialDefinition@v1
    attributes:
      schemaId: $.actions.createSchema.output.schemaId
      tag: $.input.name