zeropx-receipt-chain
Append-only, hash-chained JSON-lines ledger for tamper-evident event logs. Zero dependencies. Python 3.10+.
Every entry is SHA-256 self-signed and links the previous entry's
hash. Tamper with any entry and the chain breaks at that point.
verify walks the whole file and proves it.
Why
You want a small, auditable "what happened, in order, with proof" log that a compliance reviewer, an SRE, a regulator, or a customer can verify without trusting your infrastructure. Options today:
- A DB row with timestamps — great until someone with write access edits history.
- A blockchain / notarization service — great until you need to ship the log to a customer who won't call your API.
- An
append-only.logfile — no cryptographic proof. - This. One JSON-lines file, one SHA-256 per line, one chain.
The file is the whole system. Ship it, mail it, sign it, timestamp it — the format doesn't change.
Install
pip install zeropx-receipt-chain
(Python import module: receipt_chain | CLI command: receipt-chain)
Use as a library
from pathlib import Path
from receipt_chain import append_event, verify_ledger
ledger = Path("./deploys.jsonl")
# Every event must have event_id (unique) and observed_at_utc.
# `required=` extends that with your own schema.
append_event(
ledger,
{
"event_id": "deploy-2026-08-17-01",
"observed_at_utc": "2026-08-17T14:30:00Z",
"commit_sha": "a1b2c3d4",
"artifact_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"actor": "junior",
},
tag="deploys",
required=["commit_sha", "artifact_sha256", "actor"],
)
# Any time later — from anywhere, without state:
result = verify_ledger(ledger, tag="deploys", required=["commit_sha", "artifact_sha256", "actor"])
print(result["chain_valid"], result["entry_count"], result["head_entry_sha256"])
append_event is idempotent on identical events (same content →
same receipt_sha256 → no duplicate append). Reusing an event_id
with different content is rejected.
Use as CLI
# Append an event from a JSON file:
receipt-chain append \
--path ./deploys.jsonl \
--event ./one-deploy.json \
--tag deploys \
--required commit_sha,artifact_sha256,actor
# Verify the chain:
receipt-chain verify \
--path ./deploys.jsonl \
--tag deploys \
--required commit_sha,artifact_sha256,actor
Seal the ledger (v0.2+)
A seal is a specially-shaped event that freezes the ledger's current head-hash. Once appended, everything BEFORE the seal is provably older than any external anchor you attach to it — an OpenTimestamps proof, an RFC-3161 tsr token, a git commit SHA, a blockchain txid, a signed email you sent yourself. The seal module is opaque about what the anchor means; it just records the bytes.
# Prepare an anchor JSON (any dict — receipt-chain is opaque about it)
cat > anchor.json <<EOF
{"kind": "ots", "bytes_hex": "0100...", "calendar": "alice.btc.calendar.eternitywall.com"}
EOF
# Seal — records the current head-hash + the anchor
receipt-chain seal --path ./deploys.jsonl --tag deploys --anchor-json anchor.json
# Enumerate every seal in the ledger
receipt-chain list-seals --path ./deploys.jsonl
# Prove that this ledger produced a specific head-hash you published externally
receipt-chain verify-seal --path ./deploys.jsonl \
--sealed-head 5f8a4b... # the entry_sha256 from the seal you're checking
Sealing refuses to run on a broken chain — you can never accidentally
laundry-anchor a tampered ledger. Sealing an empty ledger is allowed
and records sealed_head_sha256: null.
Chain format (one entry per line)
{
"entry_sha256": "…64hex…",
"event": {
"event_id": "deploy-2026-08-17-01",
"observed_at_utc": "2026-08-17T14:30:00Z",
"receipt_sha256": "…64hex…",
...
},
"ledger_tag": "deploys",
"previous_entry_sha256": "…64hex… (or null for first entry)",
"recorded_at_utc": "2026-08-17T14:30:00.123456+00:00",
"schema_version": "1.0",
"sequence": 5
}
The entry_sha256 is SHA-256(canonical_json(entry_without_entry_sha256)).
The receipt_sha256 inside event is SHA-256(canonical_json(event_without_receipt_sha256)).
Canonical JSON = sorted keys, minimal separators, ASCII-safe. This is
deterministic across Python versions and platforms.
What it does not do
- Timestamp trust.
recorded_at_utcis what the writer said — for timestamp trust, notarizehead_entry_sha256externally (RFC 3161, OpenTimestamps, a blockchain, a signed email). - Distributed consensus. Two independent writers to the same file will race; use per-writer files and reconcile downstream.
- Confidentiality. The whole ledger is plaintext. Encrypt at rest if the events are sensitive; encryption doesn't affect the chain.
- Deletion. It's append-only. Compaction / rollup is out of scope for v0.1.
Poseidon2 batch summary (v0.3+, optional)
Install the sibling zeropx-poseidon2-goldilocks package to unlock a
cross-package feature: turn the ledger's SHA-256 entry-hash chain into
a Poseidon2 binary-Merkle tree. Byte-for-byte compatible with
Plonky2 / Quantus, so a downstream Rust prover can consume the same
commitment.
pip install "zeropx-receipt-chain[poseidon2]"
Use:
from receipt_chain.summary import (
poseidon2_batch_summary, poseidon2_inclusion_proof,
)
# One succinct root over every entry
s = poseidon2_batch_summary(ledger_path)
print(s["poseidon2_merkle_root_hex"]) # 64-hex Poseidon2 root
# Prove membership of a specific entry
p = poseidon2_inclusion_proof(ledger_path, sequence=3)
# `p` is ready to feed into poseidon2_goldilocks.verify_merkle_proof
The two features compose: you can seal a snapshot with the Poseidon2 root as the external anchor, so the seal itself becomes a succinct commitment over the entire prior chain:
from receipt_chain import seal_ledger
from receipt_chain.summary import poseidon2_batch_summary
s = poseidon2_batch_summary(ledger_path)
seal_ledger(ledger_path, external_anchor={
"kind": "poseidon2_batch_root",
"root_hex": s["poseidon2_merkle_root_hex"],
"entry_count": s["entry_count"],
})
Or from the CLI:
receipt-chain poseidon2-summary --path ./deploys.jsonl
receipt-chain poseidon2-summary --path ./deploys.jsonl --inclusion-of 3
Standalone Windows binary
A precompiled Windows binary is built by:
py -3.14 -m pip install pyinstaller
py -3.14 -m PyInstaller --onefile --name receipt-chain --paths src packaging_entry.py
Result: single-file dist/receipt-chain.exe (~9 MB) that runs on any
Windows machine without Python installed.
Author & Provenance
Sole Author: Dr. Vander Geraldo Rodrigues da Cunha Júnior (vgrcjr@gmail.com).
Technical & AI-Assisted Provenance Disclosure: Auxiliary computational/LLM tooling was used strictly for boilerplate and test-harness scaffolding under 1:1 human architectural design, code review, deterministic test verification, and sole human authorship. Zero runtime third-party or AI dependencies.
License
MIT.
Metadata
Release files for zeropx-receipt-chain 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| zeropx_receipt_chain-0.3.0.tar.gz | 19.1 kB | Without provenance | Details for zeropx_receipt_chain-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| zeropx_receipt_chain-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for zeropx_receipt_chain-0.3.0-py3-none-any.whl |
Total release size: 36.5 kB
Release files / zeropx_receipt_chain-0.3.0.tar.gz
| Download URL | zeropx_receipt_chain-0.3.0.tar.gz |
|---|---|
| Size | 19.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f6f06453b9aaa359dd8508d77cb11915e84ced5e6327ef98a735437f1452a80a
|
|
BLAKE2b-256 checksum How to use checksums |
dba4cdf4d54ff997d9d94aec7720d35a5222cf44cc0f5ed282ae3ef5d80c7baa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.13
|
Release files / zeropx_receipt_chain-0.3.0-py3-none-any.whl
| Download URL | zeropx_receipt_chain-0.3.0-py3-none-any.whl |
|---|---|
| Size | 17.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fc6ebdd08fbee8d4f609bbd0a2186acef0be9cb0670072ca8dc191516a32b1ec
|
|
BLAKE2b-256 checksum How to use checksums |
2918ccf0073d8255e306921d3ebe20e1d842db3102901b85e40cf4503423b415
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.13
|
Security for zeropx-receipt-chain 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.