State Transition Overview

State transitions are the means for submitting data that creates, updates, or deletes platform data and results in a change to a new state. Each one must contain:

Fees

State transition fees are paid via the credits established when an identity is created. Credits are created at a rate of 1000 credits/hellars. Fees for actions vary based on parameters related to storage and computational effort that are defined in rs-hpp.

Size

All serialized data (including state transitions) is limited to a maximum size of 16 KB.

Common Fields

All state transitions include the following fields:

Field Type Description
protocolVersion integer The platform protocol version (currently 1)
type integer State transition type:
0 - data contract create
1 - documents batch
2 - identity create
3 - identity topup
4 - data contract update
5 - identity update
signature array of bytes Signature of state transition data (65 bytes)

Additionally, all state transitions except the identity create and topup state transitions include:

Field Type Description
signaturePublicKeyId integer The id of the identity public key that signed the state transition (=> 0)

State Transition Types

Data Contract Create

Field Type Description
dataContract data contract object Object containing valid data contract details
entropy array of bytes Entropy used to generate the data contract ID (32 bytes)

More detailed information about the dataContract object can be found in the data contract section.

Entropy Generation

Entropy is included in Data Contracts and Documents.

// From the Rust reference implementation (rs-hpp) // entropyGenerator.js fn generate(&self) -> anyhow::Result<[u8; 32]> { let mut buffer = [0u8; 32]; getrandom(&mut buffer).context("generating entropy failed")?; Ok(buffer) }