Metadata-Version: 2.4
Name: trustchain-core
Version: 0.1.0
Summary: Merkle tree and cryptographic proof primitives for the Arkava Trust Chain
Project-URL: Homepage, https://github.com/Arkava-Ai/arkava-trustchain
Project-URL: Source, https://github.com/Arkava-Ai/arkava-trustchain
Project-URL: Documentation, https://github.com/Arkava-Ai/arkava-trustchain/blob/develop/docs/Arkava_TrustChain_Technical_Architecture_v0.2.md
Author: Arkava Ltd
License: Apache-2.0
Keywords: arkava,audit,cryptography,ed25519,merkle-tree,sovereign-ai,trust-chain
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Security :: Cryptography
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: cryptography>=42
Requires-Dist: jcs>=0.1
Requires-Dist: jsonschema>=4.20
Requires-Dist: prometheus-client<1,>=0.20
Requires-Dist: pycryptodome>=3.20
Requires-Dist: structlog<25,>=24
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == 'dev'
Description-Content-Type: text/markdown

# trustchain-core

Merkle tree and cryptographic proof primitives for the Arkava® Trust Chain.

`trustchain-core` provides the foundational cryptographic building blocks for the
Arkava Trust Chain — an append-only, cryptographically verifiable accountability
substrate. It implements Merkle trees, batch accumulators, inclusion and consistency
proofs, Ed25519 signature verification, and canonical JSON encoding for witness
manifests.

## Installation

```bash
pip install trustchain-core
```

Requires Python 3.11+.

## Quick Start

```python
from trustchain_core import MerkleTree, BatchAccumulator, compute_batch_root

# Build a Merkle tree
tree = MerkleTree()
tree.add_leaf(b"event 1")
tree.add_leaf(b"event 2")
root = tree.get_root()

# Verify an inclusion proof
proof = tree.prove_inclusion(0)
assert tree.verify_inclusion_proof(proof)

# Batch accumulator for daily manifests
accumulator = BatchAccumulator()
batch_root = compute_batch_root([b"event 1", b"event 2"])
```

## Features

- **Merkle trees** — SHA3-512 leaf hashing, RFC 6962-compatible inclusion and consistency proofs
- **Batch accumulator** — deterministic batch root computation with algorithm ID headers
- **Ed25519 verification** — signature verification with public key registry
- **Canonical encoding** — RFC 8785 (JCS) canonical JSON for reproducible manifest hashing
- **Witness manifests** — daily commit-signed manifest generation and verification
- **Algorithm dispatch** — extensible crypto algorithm registry with future-compatibility
- **Ethereum compatibility** — hash encoding compatible with Ethereum smart contracts
- **Typed** — PEP 561 `py.typed` marker for type checker support

## Documentation

- Architecture: [`Arkava_TrustChain_Technical_Architecture_v0.2.md`](https://github.com/Arkava-Ai/arkava-trustchain/blob/develop/docs/Arkava_TrustChain_Technical_Architecture_v0.2.md)
- ADR-0007: [Witness anchoring](https://github.com/Arkava-Ai/arkava-trustchain/blob/develop/docs/adr/TC-ADR-0007-witness-anchoring.md)
- ADR-0019: [Manifest canonical encoding and v1 field lock](https://github.com/Arkava-Ai/arkava-trustchain/blob/develop/docs/adr/TC-ADR-0019-manifest-canonical-encoding-and-v1-field-lock.md)

## Licence

Apache-2.0. Arkava® Trust Chain is a registered trademark of Arkava Ltd.

© 2026 Arkava® / All rights reserved.