A Kind is a meta-object that defines the structure, appearance, and interactions of a type of objects.

Kind Object

Metadata

The metadata of a kind contains essential information about its type and versioning. Every kind is minted from the Set of Kinds, with a kind of the Kind of Kind.

FieldValueDescription
traits0Reserved flags
rev1Current revision number (initially set to 1)
krevkindOfKind.metadata.revRevision of the Kind of Kind
srevsetOfKind.metadata.revRevision of the Set of Kind
kindkindOfKind.idID of the Kind of Kind
setsetOfKind.idID of the Set of Kind

Elements

Each kind has 6 elements, defined by the Kind of Kind. These elements serve as the core structure for both object typing and asset computation.

IndexElementTypeMutableDescription
0dataMatterYesHash of a bundle with committed matters and infos
1codeMatterYesHash of the kind contract
2skelInfoNoDeclares the element types for objects of this kind
3rels[0]InfoYesSupported relations (part 1)
4rels[1]InfoYesSupported relations (part 2)

Kind Contract

A Kind Contract is a Matter written in code form. It defines how an object’s assets are computed from its elements — enabling programmable logic for rendering, validation, or transformation.

Kind contracts are currently written in AssemblyScript, compiled to WebAssembly using kind-as. A Rust-based compiler is planned for future support.

@kind
class Hat {
  design: MatterImage;
  background: MatterImage;

  function meta(): Json {
    // return metadata
  }

  function picture(): Image {
    // image with background
  }

  function figure(): Image {
    // image without background
  }
}

Elements

The fields of the contract class define the elements of the object. These can be accessed during kind contract execution:

design: MatterImage;
background: MatterImage;

Facets

The methods exposed by the kind contract are called facet functions. Each facet function defines how a specific object asset is computed:

function picture(): Image {
  // image with background
}

Each output is called a facet image, and it can be accessed using a facet selector — a unique identifier used to dispatch to the correct function.

Kind Registry

OperationDescription
register_kindRegisters a new kind into the registry.
update_kindUpdates the mutable elements of an existing kind.
upgrade_kindApplies a new revision of kind or set to the kind object.