| Crates.io | strata-rs |
| lib.rs | strata-rs |
| version | 0.4.3 |
| created_at | 2026-01-04 20:20:30.730717+00 |
| updated_at | 2026-01-15 13:30:01.405216+00 |
| description | Deterministic binary data format with canonical encoding |
| homepage | |
| repository | https://github.com/Emagjby/Strata |
| max_upload_size | |
| id | 2022419 |
| size | 80,825 |
Deterministic data language with canonical binary encoding.
This crate is the reference Rust implementation of Strata.
Same data → same bytes → same hash.
No ambiguity. No normalization. No silent coercions.
Golden vectors are law.
Strata is a strict, minimal data model with a fully deterministic binary encoding.
It is designed for systems where:
Strata draws a hard line between representation and truth:
Value is an in-memory representation.scb bytes define truthThis crate defines canonical truth for Strata.
It provides:
.scb).st)If another language disagrees with this crate, the other language is wrong.
cargo add strata-rs
Or in Cargo.toml:
[dependencies]
strata-rs = "*"
Strata supports a fixed, closed value model:
Value =
Null
| Bool(bool)
| Int
| String
| Bytes
| List(Value*)
| Map(string → Value)
Rules:
The model is intentionally small.
Power comes from determinism, not expressiveness.
Values may be constructed manually or using DX macros.
Macros are pure sugar and do not affect canonical encoding or hashing.
use strata::value::Value;
let value = map! {
"id" => int!(42),
"name" => string!("Gencho"),
"active" => bool!(true),
"skills" => list![
string!("rust"),
string!("systems"),
],
"meta" => map! {
"a" => int!(1),
"a" => int!(2), // last-write-wins
},
};
Available macros:
null!()bool!(...)int!(...)string!(...)bytes!(...)list![ ... ]map!{ "k" => v, ... }Macros construct the exact same Value structures as manual code.
Encoding is fully deterministic.
Rules include:
Identical values always produce identical .scb bytes.
use strata::encode::encode_value;
let bytes = encode_value(&value)?;
The decoder is strict and transparent.
It:
Decoding reveals reality.
Encoding enforces truth.
use strata::decode::decode_value;
let value = decode_value(&bytes)?;
Hashes are computed as:
BLAKE3-256(canonical_scb_bytes)
Example:
use strata::hash::hash_bytes;
let hash = hash_bytes(&bytes);
Hashes are stable across:
.st)Strata Text is a human-friendly authoring format.
Example:
user {
id: 42
name: "Gencho"
active: true
skills: ["rust", "systems"]
}
Parsing:
use strata::parser::parse;
let value = parse(source)?;
Text is never canonical.
Only encoded .scb bytes are.
This crate ships with a CLI for inspection and tooling.
strata compile input.st output.scb
strata decode input.scb
strata hash input.st
strata hash input.scb
strata fmt input.st
All failures are explicit and structured.
Decode errors include:
InvalidTagUnexpectedEOFInvalidVarintInvalidUtf8TrailingBytesParse errors include:
CLI exit codes:
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Invalid input |
| 2 | I/O failure |
| 100 | Internal error |
Canonical truth lives in /vectors.
This implementation:
If vectors disagree with code, code is wrong.
Canonical integration documentation lives in the Integration Reference:
The Integration Reference is the single source of truth for integrators.
Strata evolution is governed by Northstar documents.
Any canonical change requires a new Northstar.
MIT License
This crate is intentionally strict.
It is designed for:
If convenience matters more than correctness, use something else.
If correctness matters, this is the reference.