Core data structures for the Hyperledger Iroha blockchain.
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– deriveiroha_ffi::FfiTypefor exported types and expose helpers for building dynamic libraries.ffi_import– import the FFI bindings generated byffi_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.
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);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.