Metadata-Version: 2.4
Name: proofnest
Version: 0.2.0
Summary: Kollektiivse Intelligentsi Eksistentsi Protokoll - Verification layer for everything
Project-URL: Homepage, https://proofnest.io
Project-URL: Documentation, https://docs.proofnest.io
Project-URL: Repository, https://github.com/stellanium/proofnest
Project-URL: Issues, https://github.com/stellanium/proofnest/issues
Author-email: Stellanium AI <admin@stellanium.io>, Andrus Salumäe <andrus@stellanium.io>
License: MIT
License-File: LICENSE
Keywords: blockchain,consensus,did,identity,post-quantum,proof,verification
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Security :: Cryptography
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Requires-Dist: fastapi>=0.100.0
Requires-Dist: httpx>=0.24.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: uvicorn>=0.23.0
Provides-Extra: dev
Requires-Dist: black>=23.0.0; extra == 'dev'
Requires-Dist: mypy>=1.4.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
Requires-Dist: pytest>=7.0.0; extra == 'dev'
Requires-Dist: ruff>=0.0.280; extra == 'dev'
Provides-Extra: quantum
Requires-Dist: pqcrypto>=0.1.0; extra == 'quantum'
Description-Content-Type: text/markdown

# PROOFNEST CORE

**Kollektiivse Intelligentsi Eksistentsi Protokoll**

Python SDK for PROOFNEST - the verification layer for everything that exists.

## Quick Start

```bash
# Start API server
python3 api.py

# Use CLI
python3 cli.py stats
python3 cli.py identity create
python3 cli.py proof create --claim "My claim" --issuer did:pn:agent:xxx
```

## Architecture

```
PROOF = claim + evidence + identity + signature + time + anchor + consensus

┌─────────────────────────────────────────────────────────────┐
│                     PROOFNEST CORE                          │
├─────────────────────────────────────────────────────────────┤
│  cli.py          │ Command line interface                   │
│  api.py          │ FastAPI REST API (port 8200)             │
├─────────────────────────────────────────────────────────────┤
│  proof.py        │ PROOF primitive, Identity, Evidence      │
│  consensus.py    │ HotStuff-2 BFT, Validator, Vote, QC      │
│  anchor.py       │ Bitcoin anchoring (OpenTimestamps)       │
│  network.py      │ P2P gossip protocol                      │
│  storage.py      │ SQLite persistence                       │
│  blockchain.py   │ Go blockchain RPC client                 │
└─────────────────────────────────────────────────────────────┘
```

## API Endpoints

| Method | Endpoint | Description |
|--------|----------|-------------|
| POST | `/v1/identities` | Create DID:PN identity |
| GET | `/v1/identities` | List identities |
| POST | `/v1/proofs` | Create PROOF |
| GET | `/v1/proofs/{id}` | Get PROOF |
| POST | `/v1/proofs/{id}/verify` | Verify PROOF |
| POST | `/v1/validators` | Add validator |
| GET | `/v1/validators` | List validators |
| POST | `/v1/proofs/{id}/submit-consensus` | Submit to consensus |
| POST | `/v1/proofs/{id}/vote` | Vote on PROOF |
| POST | `/v1/proofs/{id}/anchor` | Anchor to Bitcoin |
| POST | `/v1/proofs/{id}/chain-anchor` | Anchor to blockchain |
| GET | `/v1/proofs/{id}/chain-verify` | Verify on blockchain |
| GET | `/v1/chain/status` | Blockchain status |
| GET | `/v1/stats` | System statistics |
| GET | `/health` | Health check |

## PROOF Types

- `CLAIM` - Generic assertion
- `IDENTITY` - Identity declaration
- `WORK` - Work completion proof
- `DECISION` - Decision record
- `TRUTH` - Verified truth
- `VALUE` - Value transfer

## Example: Full Flow

```python
import httpx

API = "http://localhost:8200"

# 1. Create identity
identity = httpx.post(f"{API}/v1/identities", json={
    "identity_type": "agent"
}).json()
did = identity["did"]

# 2. Create PROOF
proof = httpx.post(f"{API}/v1/proofs", json={
    "issuer_did": did,
    "claim": "I completed this task",
    "proof_type": "WORK"
}).json()
proof_id = proof["proof_id"]

# 3. Add validators and vote
for _ in range(3):
    httpx.post(f"{API}/v1/validators")

validators = httpx.get(f"{API}/v1/validators").json()

httpx.post(f"{API}/v1/proofs/{proof_id}/submit-consensus")

for v in validators["validators"][:2]:
    httpx.post(f"{API}/v1/proofs/{proof_id}/vote", json={
        "proof_id": proof_id,
        "validator_did": v["did"],
        "approve": True
    })

# 4. Anchor to blockchain
result = httpx.post(f"{API}/v1/proofs/{proof_id}/chain-anchor").json()
print(f"Anchored at height {result['height']}")
```

## Security

- **Dilithium3** - Post-quantum digital signatures (NIST PQC)
- **SHAKE256** - Quantum-resistant hashing
- **HotStuff-2 BFT** - Byzantine fault tolerant consensus (67% threshold)
- **Bitcoin Anchoring** - Immutable timestamping via OpenTimestamps

## Dependencies

```
fastapi
uvicorn
httpx
pqcrypto  # Dilithium3
```

## License

Proprietary - Stellanium LTD

---

**Autor:** Stellanium AI + Andrus Salumäe
**Kuupäev:** 2026-02-03
