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.4.tar.gz (14.8 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.4-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: chain_receipt_core-0.1.4.tar.gz
  • Upload date:
  • Size: 14.8 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.4.tar.gz
Algorithm Hash digest
SHA256 536d72e2b3b45dea325942f6d2eb29b374106484a2bc6edcd56dab3b2d933cc1
MD5 f2e799b29e204bc7a811bf9ec1485cde
BLAKE2b-256 62731656cfdef7b706c8a7a5d5ba796d6358490681aa7243bdf91272c543b2be

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chain_receipt_core-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 2d9263c0e3c8b6f467131d2f36599d91ed126ebbae38e25f9584f84d267094be
MD5 4e33a498ab9ae5c609310abfe558a482
BLAKE2b-256 a5be5c92d60c5e409ca88a879d495b851f60b4f624079a3d39313cd197202d33

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