Reference decoders
Tiny, dependency-free implementations of a SPORE Tier-0 node — enough to
receive, verify, and display public messages — for machines that don't have a
Rust toolchain. They double as cross-language conformance oracles for
docs/REBUILD.md: each reproduces the same addresses, IDs,
and signature checks as the reference library.
| File | What |
|---|---|
spore_t0.py |
Pure-Python T0 node — standard library only; Ed25519 verify is the inlined public-domain reference. |
spore_t0.c |
Pure-C T0 node — zero dependencies; its own SHA-256, SHA-512, and Ed25519 verify (256-bit field arithmetic mod 2²⁵⁵−19). cc -O2 -o spore_t0 reference/spore_t0.c. |
spore_t0.sh |
Shell T0 node — parses + content-addresses with sha256sum/base32, verifies via openssl (3.0+). For a box with the usual Unix tools but no Rust/Python. |
vectors.json |
Deterministic test vectors, generated by cargo run --example gen_vectors. The source of truth. |
test_t0.py |
Checks spore_t0.py against vectors.json (address, IDs, a valid signature, a rejected tampered one, armor round-trip). |
test_decoders.sh |
The same conformance for the C and shell decoders (run in CI by reference.yml). |
All three decoders do the same job — parse an envelope (hex or ~S1.…~ armor),
derive the sender's address, recompute the ID, and verify the Ed25519 signature —
and all reproduce the vectors byte for byte.
Use it
# Dump + verify an envelope (hex or ~S1.…~ armor) — pick any decoder:
python3 reference/spore_t0.py '~S1.AEAB….~'
cc -O2 -o /tmp/spore_t0 reference/spore_t0.c && /tmp/spore_t0 '010012…'
echo '010012…' | bash reference/spore_t0.sh
# Conformance tests:
python3 reference/test_t0.py # Python
bash reference/test_decoders.sh # C + shell
Why this exists
A node you can read in one sitting, in a language that's on almost every machine,
with no packages to install, is the most portable seed of the protocol. If the
Rust build is unavailable, this file — plus docs/REBUILD.md
— is enough to rebuild a compatible node and rejoin the mesh. The Python verify is
correct but intentionally simple (and slow); it's a reference, not a fast library.
The C and shell ports extend this to boxes with a compiler or just the usual Unix tools; the vectors here make them straightforward to validate.