Identity Overview

Identities are a low-level construct that provide the foundation for user-facing functionality on the platform. An identity is a public key (or set of public keys) recorded on the platform chain that can be used to prove ownership of data.

Identities consist of three components that are described in further detail in the following sections:

Field Type Description
protocolVersion integer The protocol version
id array of bytes The identity id (32 bytes)
publicKeys array of keys Public key(s) associated with the identity
balance integer Credit balance associated with the identity
revision integer Identity update revision

Each identity must comply with this JSON-Schema definition established in rs-hpp:

{ "$schema": "<https://json-schema.org/draft/2020-12/schema>", "type": "object", "properties": { "protocolVersion": { "type": "integer", "$comment": "Maximum is the latest protocol version" }, "id": { "type": "array", "byteArray": true, "minItems": 32, "maxItems": 32, "contentMediaType": "application/x.hellar.dpp.identifier" }, "publicKeys": { "type": "array", "minItems": 1, "maxItems": 32, "uniqueItems": true }, "balance": { "type": "integer", "minimum": 0 }, "revision": { "type": "integer", "minimum": 0, "description": "Identity update revision" } }, "required": [ "protocolVersion", "id", "publicKeys", "balance", "revision" ] }

Example Identity

{ "protocolVersion":1, "id":"6YfP6tT9AK8HPVXMK7CQrhpc8VMg7frjEnXinSPvUmZC", "publicKeys":[ { "id":0, "type":0, "purpose":0, "securityLevel":0, "data":"AkWRfl3DJiyyy6YPUDQnNx5KERRnR8CoTiFUvfdaYSDS", "readOnly":false } ], "balance":0, "revision":0 }

Identity id

The identity id is calculated by Base58 encoding the double sha256 hash of the outpoint used to fund the identity creation.

id = base58(sha256(sha256(<identity create funding output>)))

Note: The identity id uses the Hellar Platform specific application/x.hellar.hpp.identifier content media type. For additional information, please refer to the js-hpp PR 252 that introduced it and identifier.rs.

Identity publicKeys

The identity publicKeys array stores information regarding each public key associated with the identity. Multiple identities may use the same public key.

Note: Since v1.0, each identity must have at least two public keys: a primary key (security level 0) that is only used when updating the identity and an additional one (security level 2) used to sign state transitions.

Each item in the publicKeys array consists of an object containing:

Field Type Description
id integer The key id (all public keys must be unique)
type integer Type of key (default: 0 - ECDSA)
data array of bytes Public key (0 - ECDSA: 33 bytes, 1 - BLS: 48 bytes, 2 - ECDSA Hash160: 20 bytes, 3 - BIP13 Hash160: 20 bytes)
purpose integer Public key purpose (0 - Authentication, 1 - Encryption, 2 - Decryption, 3 - Withdraw)
securityLevel integer Public key security level (0 - Master, 1 - Critical, 2 - High, 3 - Medium)
readonly boolean Identity public key can’t be modified with readOnly set to true. This can’t be changed after adding a key.
disabledAt integer Timestamp indicating that the key was disabled at a specified time

Keys for some purposes must meet certain security level criteria as detailed below:

Key Purpose Allowed Security Level(s)
Authentication Any security level
Encryption Medium
Decryption Medium
Withdraw Critical

Each identity public key must comply with this JSON-Schema definition established in rs-hpp: