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 Distribution

chain_receipt_core-0.1.3.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

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

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

Uploaded Python 3

File details

Details for the file chain_receipt_core-0.1.3.tar.gz.

File metadata

  • Download URL: chain_receipt_core-0.1.3.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.15

File hashes

Hashes for chain_receipt_core-0.1.3.tar.gz
Algorithm Hash digest
SHA256 1afc5c2c4935b8185773f8af2176e2407179759dac22ac8b78d89333a3e38c80
MD5 c67809df0f417cca59b66d32a2b6fe3e
BLAKE2b-256 5934f2047984c328f5e8971122ea39033caade82947b7004ecca48339b24ab2e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chain_receipt_core-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 17f23feba89150b98c1f297a0c71d760d7580dd8212c1b775db6c9b53f963173
MD5 ce656649e45a16bd9546dd6f81c878ba
BLAKE2b-256 b227a014730b0c053777d7a1c36e8a08e56cc8300ba6420846395254502bc633

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