proofnest 0.2.1
Kollektiivse Intelligentsi Eksistentsi Protokoll - Verification layer for everything
License: MIT
Requires Python: >=3.10
Keywords: blockchain, consensus, did, identity, post-quantum, proof, verification

# 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