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.2.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.2-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: chain_receipt_core-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 f9e9eb1d387e1e55aeb7167133f6846e05339dc054192c1d582db608ed649cf2
MD5 6003f714a1a7ce15ae9b4ad80d462bc2
BLAKE2b-256 2844e4ccaeb0b5363f379b4403b71c1884502f5cf20e07564f5d803bf0f0b869

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chain_receipt_core-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 85f889957eaf52ad073d51a07a32e08e1f197386154cf3f4428f49c79b7ee9ac
MD5 4c24d6b24fcfcb40539d6479128f7190
BLAKE2b-256 a6115bd307f8231363ef5e803119d38a0dc75f6e3d14cfc6c0058ba8a2f00e54

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