Skip to main content

Reference implementation of the Chain-Receipt v1.0.0 spec — canonical JSON, SHA-256 receipt hash, Ed25519 signing, chain integrity, replay-attestation primitives.

Project description

chain-receipt-core (Python)

Reference implementation of the Chain-Receipt v1.0.0 spec (../SCHEMA.md). Provides:

  • Pydantic v2 models (Receipt, Interaction, Chain, Stability, Signature)
  • RFC 8785–compatible canonical JSON
  • SHA-256 hash helpers (receipt_hash, compute_tool_calls_hash, compute_text_hash)
  • Ed25519 sign / verify
  • ReceiptBuilder for emitter-side use
  • verify_receipt, verify_chain
from chain_receipt_core import (
    ClientInfo, Interaction, ReceiptBuilder, generate_keypair, verify_chain,
    compute_text_hash, compute_tool_calls_hash,
)

sk, pub_b64 = generate_keypair()
client = ClientInfo(
    name="chain-receipt-langchain-sdk",
    version="0.1.0",
    platform="python-3.12",
    emitter_pubkey=f"ed25519:{pub_b64}",
)
b = ReceiptBuilder(client=client, private_key=sk,
                   verifier_url="https://chain-determinism.org",
                   chain_seed=pub_b64.encode())

inter = Interaction(
    vendor="anthropic", model="claude-sonnet-4-5", temperature=0.0,
    system_prompt_hash=compute_text_hash("you are helpful"),
    prompt_hash=compute_text_hash("hello"),
    response_hash=compute_text_hash("hi"),
    tool_calls_hash=compute_tool_calls_hash([]),
    n_tool_calls=0, latency_ms=120,
)
r = b.build(interaction=inter)
assert verify_chain([r]).ok

Cross-language conformance vectors live in ../conformance/vectors/.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

chain_receipt_core-0.1.1-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file chain_receipt_core-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for chain_receipt_core-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 df4f7e96cc722c3212f91ee676dd9fc4b4f8dfa3e00cd8812d22a254c1bbb7eb
MD5 dc98dbde1a9939dc3b7b9baa72fb24c4
BLAKE2b-256 eb8439b64ca64bffefbd30cee62f399fefabffb05ff8b263a86a5ba34cf0db76

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