Skip to content

Latest commit

 

History

History

README.md

Iroha Data Model

Core data structures for the Hyperledger Iroha blockchain.

FFI

iroha_data_model can expose or import types for use over a foreign function interface. Enable one of the following mutually exclusive features to activate FFI bindings:

  • ffi_export – derive iroha_ffi::FfiType for exported types and expose helpers for building dynamic libraries.
  • ffi_import – import the FFI bindings generated by ffi_export.

Use in Cargo.toml:

iroha_data_model = { path = "path/to/iroha_data_model", features = ["ffi_export"] }

These features place the corresponding implementations in dedicated ffi modules within the crate.

Trait Objects

Many parts of the data model operate on trait objects to allow mixing different instruction and query types. The [InstructionBox] type wraps a Box<dyn Instruction> and the [QueryBox] alias wraps a Box<dyn Query + Send + Sync>.

use iroha_data_model::prelude::*;

let instruction: InstructionBox = InstructionBox::from(
    Log::new(Level::INFO, "trait objects".into())
);
let query: QueryBox<Account> = Box::new(FindAccounts);

Formal Verification

The verification module provides deterministic checks for structural invariants across domains, accounts, asset definitions, and live asset holdings. Construct a [WorldSnapshot] from your in-memory state and call [WorldSnapshot::verify] to obtain a [VerificationReport] summarizing the results, including detailed violation messages when invariants are broken.