Skip to content

Kinds

A kind is a meta-object that acts as the type definition for other objects.

Descriptor

Kinds are themselves objects: they have their own kind and are minted from a set. The Kind of Kind and the Set of Kind are genesis objects created during protocol initialization.

A kind’s descriptor is initialized with the following values:

FieldValueDescription
flags0Reserved flags
rev1Initially 1, increments as the kind itself evolves
krevlatestRevision of the Kind of Kind at creation (increments over time)
srevlatestRevision of the Set of Kind at creation (increments over time)
kind2ID of the Kind of Kind
set2ID of the Set of Kind

Elements

Each kind has 7 elements, as defined in the Kind of Kind object's eltys field.

IndexElementTypeMutableDescription
0codeMatterYesMatter Hash of the kind contract
1dataMatterYesMatter Hash of the kind data
2eltysInfoNoDeclares the element types for objects of this kind
3rels[0]InfoYesSupported relations (part 1)
4rels[1]InfoYesSupported relations (part 2)
5rels[2]InfoYesSupported relations (part 3)
6rels[3]InfoYesSupported relations (part 4)

We devote separate sections below to the code and data fields.

The eltys field defines the element types for objects of this kind. Each type is a uint8 (> 0). The field is stored as a packed uint8[], right-padded with zeros.

The rels[i] fields encode supported relations. Each is a packed uint64[] spread across 4 × bytes32, right-padded with zeros.

Kind Contract

The code field stores the matter hash of the kind contract compiled to Wasm.

Below is a simple example of a kind contract in AssemblyScript:

@kind
class Hat {
  image: MatterImage;
  bg: MatterImage;
 
  function meta(): Json {
    // ...
  }
 
  function picture(): Image {
    // ...
  }
}

Kind contracts can be written currently in AssemblyScript and compiled to Wasm using the kasc CLI from kind-as.

A Rust toolkit is planned for future support.

Kind Data

The data field stores a matter hash referencing a piece of data associated with the kind.

This data is available to the kind’s own contract and may also be used by the kind contracts of objects that use this kind. We will explore more in later chapters.

Kind Registry

When a kind is registered in the Kind Registry, it is assigned a kind ID.

A kind is used by specifying its kind ID and kind revision in the object’s descriptor when the object is minted by the set contract.

©2025 every