inferadb-ledger-types
Core types, errors, and cryptographic primitives for InferaDB Ledger.
Overview
This crate provides foundational types used throughout InferaDB Ledger:
- Identifiers:
OrganizationSlug,OrganizationId,VaultId,BlockHeight,TxId - Data structures: Blocks, transactions, operations, entities, relationships
- Cryptography: SHA-256 hashing, Merkle tree implementation
- Errors: Unified error types using
snafu - Codec: Serialization via
postcard
Usage
use ;
// Hash data
let hash: Hash = sha256;
// Combine hashes
let combined = sha256_concat;
// Type-safe identifiers
let org: OrganizationSlug = new;
let vault: VaultId = 0;
// Build domain types with type-safe builders
use ;
use Utc;
let header = builder
.height
.organization_slug
.vault_id
.timestamp
.prev_hash
.state_root
.tx_root
.tx_count
.proposer
.signature
.build;
let tx = builder
.id
.operations
.seq
.timestamp
.build?; // Fallible: validates operations
License
MIT OR Apache-2.0