how it works
The XY primitive.
Every system transforms state. pruv captures the before, the after, and generates cryptographic proof that the transition occurred. No blockchain. No consensus. Just math.
The core idea
f(X) = Y
Every function transforms state
pruv(f)(X)
= Y + XY — pruv adds proof to every transition
XY is a cryptographic record containing hashes of both X and Y, a timestamp, an optional Ed25519 signature, and a link to the previous record in the chain.
Step by step
1
Capture X (before state)
When a state transition begins, pruv snapshots the current state. This becomes X — a SHA-256 hash of the before state. X can be anything: a database record, a configuration file, an API payload.
2
Execute transition
Your code runs exactly as it normally would. pruv does not modify your business logic, intercept calls, or add middleware. It observes the input and the output. Zero performance overhead on your hot path.
3
Capture Y (after state)
When the function returns, pruv captures the result as Y — the after state, hashed the same way as X. Now pruv has both endpoints of the transition.
4
Generate XY (proof)
pruv combines X and Y into a single verifiable record: XY. This includes hashes of both states, a timestamp, an optional Ed25519 signature, and a link to the previous entry. The result is a tamper-evident proof that the transition occurred.
The XY record
// Simplified XY record structure
{
"id": "xy_8f3a2b1c",
"x_hash": "sha256:a1b2c3d4...",
"y_hash": "sha256:e5f6a7b8...",
"timestamp": "2025-01-15T10:30:00Z",
"signature": "ed25519:...",
"prev_entry": "xy_7e2f1a0b",
"chain_id": "order_processing"
}
The chain rule
When Y of one transition becomes X of the next, pruv links them into an unbreakable chain. Each XY record references the previous one.
Entry[0].x
GENESIS
Entry[N].x
== Entry[N-1].y
Break one
Chain breaks. Verification detects exactly where.
Verification
Anyone with the XY records can independently verify the proof. No special tools, no vendor lock-in, no trust required. Walk the chain, recompute every hash, check every link.
from pruv import verify
# Verify a single entry
result = verify("order_processing", entry_id="xy_8f3a2b1c")
print(result.valid) # True
# Verify an entire chain
chain = verify("order_processing", full_chain=True)
print(chain.length) # 1,247 entries
print(chain.valid) # True — every link verified
Properties
Tamper-evident
Any modification invalidates the hash chain. Tampering is mathematically detectable.
Verifiable
Anyone can verify using standard crypto libraries. No proprietary tools required.
Local-first
Proofs generated locally, synced asynchronously. Works offline. Works air-gapped.
Redaction-safe
Sensitive data redacted while preserving cryptographic proof. Hash still verifies.
Append-only
Records can only be added. The chain is a permanent, ordered log of state transitions.
Language-agnostic
Simple JSON schema. Implement in any language. SHA-256 + Ed25519 are universal.