Skip to main content

Offline cryptographic verifier for Vauban Command Center proof certificates.

Project description

vauban-verify

Offline cryptographic verifier for Vauban Command Center proof certificates.

Recomputes the Poseidon Merkle root from a certificate's decision_chain and asserts it matches the certificate's anchored merkle_root. No network calls. No trust in our infrastructure or keys. Trust derives entirely from your independent on-chain read of the anchored root.

Pure Python; the only runtime dependency is starknet-py (vendored poseidon-py for native felt252 arithmetic).

The reference implementation lives in command-center/src/proof/poseidon-hasher.ts (sprint-521, commit 139d76e). Cross-language parity is enforced by 30 deterministic test vectors checked in CI — any drift between TypeScript and Python fails the build.

Install

pip install vauban-verify

Or from source:

git clone https://github.com/seritalien/command-center
cd command-center/tools/vauban-verify
pip install -e ".[test]"

Requires Python ≥ 3.10.

CLI usage

vauban-verify path/to/cert.json
# → vauban-verify: OK — run_id=<…> leaves=<N> root=0x…
echo $?  # 0 = valid, 1 = tampered/invalid, 2 = usage error

Library usage

from vauban_verify import (
    compute_step_leaf_hash,
    compute_poseidon_merkle_root,
    verify_poseidon_merkle_proof,
    load_certificate,
    verify_offline,
)

# Recompute a leaf from a run_step payload
leaf = compute_step_leaf_hash({"step_id": "s1", "type": "decision", "agent": "BUILDER"})

# Recompute a Merkle root from a list of leaves
root = compute_poseidon_merkle_root([leaf, ...])

# Verify a sibling-path inclusion proof
ok = verify_poseidon_merkle_proof(leaf, proof, root)

# Verify a full certificate offline
cert = load_certificate("cert.json")
verify_offline(cert)  # raises VerifierError on any inconsistency

Security model

Threat Defended by
Compromised Vauban infrastructure This verifier runs offline; never contacts our servers
Compromised Vauban signing keys The verifier asserts only Merkle consistency; trust the chain anchor, not us
Hash-function preimage attacks Poseidon over felt252 — STARK-friendly, post-quantum sound
Drift between TS reference and verifier 30 cross-language vectors gated in CI (regen + diff)

The only thing that should be trusted is the on-chain merkle_root. Read it yourself from Starknet (e.g. via starknet-py's read_contract) and compare to cert.merkle_root — this verifier proves the rest of the certificate is internally consistent with that root.

Algorithm reference

  • JCS canonicalisation (RFC 8785 subset): keys sorted recursively, -0 → 0, arrays preserve order, JSON.stringify-equivalent emission.
  • Step leaf: Poseidon([0x1, sha256_to_31_felt(JCS(payload)), step_marker]).
  • Merkle: leaves sorted lexicographically, padded with Poseidon([0, 0]) to next power of 2, commutative pair-merge with Poseidon([min, max]).

Hex output matches starknet.js: lowercase, 0x-prefixed, no leading-zero padding (e.g. POSEIDON_NULL_LEAF = 0x1fb7169b936dd880cb7ebc50e932a495a60e0084cdab94a681040cb4006e1a0).

Publishing

Releases are published to PyPI via Trusted Publishers (sigstore-signed) using the .github/workflows/vauban-verify-publish.yml workflow. Tag a release with vauban-verify-vX.Y.Z to trigger publication.

License

MIT.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vauban_verify-1.0.0.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vauban_verify-1.0.0-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file vauban_verify-1.0.0.tar.gz.

File metadata

  • Download URL: vauban_verify-1.0.0.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for vauban_verify-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8d3bb7ce62383a2becd78ddea22c70c9a381f47a6c8f49d2b1c021d0091e68b9
MD5 7e40b826e69580deab1e9ba0bd497676
BLAKE2b-256 0b52e05f58cb606f356771aab215de032e724aa010c6b01b3b068b870e278325

See more details on using hashes here.

File details

Details for the file vauban_verify-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: vauban_verify-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for vauban_verify-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ad0e02e8b236d25a663850882c9fed646020cf22099116c20032ef09ef25db9d
MD5 65ea99dff81a3c98c19345f0a90fe8f5
BLAKE2b-256 e661a01ed9dd40f2748a7b5421c14864024a059ca0e033275707ae8432395133

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page