Skip to main content

DCL Core

Tamper-evident record chain + multi-party consensus primitives for AI agent audit systems. Part of the Deterministic Commitment Layer / Leibniz Layer™ ecosystem by Fronesis Labs.

This is a clean-history consolidation: the single-agent chain logic previously duplicated inside dcl-webhook, and the multi-agent consensus logic from dcl-v2, unified into one module with two known issues fixed.

What changed vs the previous implementations

1. ChainState.verify() now detects content tampering

The chain logic previously embedded in dcl-webhook/dcl_core.py only checked that prev_hash pointers linked correctly between rows. It never recomputed a row's hash from its own stored fields. That meant a party with direct database access could edit verdict, confidence, or reason on an existing row — without touching tx_hash/prev_hash — and verify() would still report the chain as clean. This defeated the core tamper-evident claim.

verify() here recomputes each row's hash from all of its stored fields and compares it against the stored tx_hash. Editing any field now breaks verification. See tests/test_fixes.py::test_detects_content_tamper_not_just_link_break.

2. Super-Hash consensus no longer uses XOR

dcl-v2's original formula was H*_t = hash(h_t1 ⊕ h_t2 ⊕ ... ⊕ h_tM). XOR is commutative and reversible: a party submitting last (or able to observe the running combination) can solve for a contribution that forces the final Super-Hash to any target value, without breaking any hash function — cheap arithmetic forgery, not a cryptographic break.

compute_super_hash() instead sorts contributions by party ID and hashes their length-prefixed concatenation. Order no longer matters (no last-mover advantage) and the XOR-forgery trick no longer works. See tests/test_fixes.py::test_super_hash_xor_forgery_no_longer_trivial.

Structure

dcl_core/
├── chain.py       ChainState — append-only chain, content-hash verify()
└── consensus.py   ConsensusRound, compute_super_hash — multi-party consensus
tests/
└── test_fixes.py  Regression tests for both fixes above

Quick start

pip install -e .
python -m pytest tests/ -v
from dcl_core import ChainState

chain = ChainState("audit.db")
tx_hash, idx = chain.append(
    verdict="COMMIT", input_hash="0xabc...", policy_hash="0xdef...",
    agent_id="agent-1", reason="policy checks passed", confidence=0.95,
    task_type="generation",
)

clean, bad_index, reason = chain.verify()
from dcl_core import ConsensusRound, verify_super_hash

round_ = ConsensusRound(expected_parties={"org-a", "org-b", "org-c"})
round_.submit("org-a", h_a)
round_.submit("org-b", h_b)
round_.submit("org-c", h_c)
super_hash, contributions = round_.seal()
assert verify_super_hash(contributions, super_hash)

Scope

This repo publishes the protocol layer only — record format, hash-chain verification, and consensus combination. Scoring/policy engines (behavioral fingerprinting, epistemic validation thresholds, reputation weighting) stay in separate, closed modules that build on top of this.

License

Apache License 2.0 — see LICENSE.

Download files

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

Source Distribution

dcl_core-0.3.0.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

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

dcl_core-0.3.0-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file dcl_core-0.3.0.tar.gz.

File metadata

  • Download URL: dcl_core-0.3.0.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.3

File hashes

Hashes for dcl_core-0.3.0.tar.gz
Algorithm Hash digest
SHA256 5d8e5401afc2380c0830ae7ca7e6412aae3c43c22660ea579d6304fd056dc543
MD5 a5297a0b1637dc002aa74b03aa111ca1
BLAKE2b-256 87588344ae2050fac6dd0b91b88194c21adc8c1b1cbac9a94b1e2c5665ac4cf2

See more details on using hashes here.

File details

Details for the file dcl_core-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: dcl_core-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.3

File hashes

Hashes for dcl_core-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2d42928e01ce1ed4d800acc9881e14543746e99e464904639aeb61329d0941f8
MD5 96716eb6361dfb1ba683913126755551
BLAKE2b-256 c58c863657090133f136492f9f86c3dbe354f2abebf171e63f80de11c0dea11e

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