|
| 1 | +# ProofLink SDK |
| 2 | + |
| 3 | +> Cryptographic receipts for autonomous AI actions. |
| 4 | +
|
| 5 | +Every autonomous action gets a receipt. **SHA-256 hash-chained, Bitcoin-anchored, publicly verifiable** at [verify.itechsmart.dev](https://verify.itechsmart.dev). |
| 6 | + |
| 7 | +[](https://github.com/Iteksmart/prooflink-sdk/actions/workflows/test.yml) |
| 8 | +[](LICENSE) |
| 9 | + |
| 10 | +## What it does |
| 11 | + |
| 12 | +ProofLink turns "the agent did X" into a receipt you can prove later. Each receipt is: |
| 13 | + |
| 14 | +- **Hash-chained** — every receipt links to the previous one's SHA-256 |
| 15 | +- **Bitcoin-anchored** — submitted to 4 OpenTimestamps calendars, settled in the next Bitcoin block |
| 16 | +- **Publicly verifiable** — anyone can replay the chain at [verify.itechsmart.dev](https://verify.itechsmart.dev) |
| 17 | +- **Tamper-evident** — modifying a past receipt breaks every receipt that follows |
| 18 | + |
| 19 | +The SDK is a **thin wrapper**. The cryptography lives in `append.py` (the canonical seal logic) and the verify API. The SDK adds idiomatic language bindings — it does not reimplement. |
| 20 | + |
| 21 | +## Two modes |
| 22 | + |
| 23 | +| Mode | Available methods | Where it runs | |
| 24 | +|---|---|---| |
| 25 | +| **Server** (append.py present) | `seal`, `verify`, `chain_status`, `submit_to_ledger` | iTechSmart UAIO host or any host with `/opt/itechsmart/audit_ledger/append.py` | |
| 26 | +| **Client** (verify API only) | `verify`, `chain_status` | Anywhere with HTTPS access to `verify.itechsmart.dev` | |
| 27 | + |
| 28 | +`seal()` raises a clear error in client mode — read-only methods still work. |
| 29 | + |
| 30 | +## Install |
| 31 | + |
| 32 | +### Python |
| 33 | + |
| 34 | +```bash |
| 35 | +pip install prooflink |
| 36 | +``` |
| 37 | + |
| 38 | +### Node |
| 39 | + |
| 40 | +```bash |
| 41 | +npm install @itechsmart/prooflink |
| 42 | +``` |
| 43 | + |
| 44 | +## Quick start |
| 45 | + |
| 46 | +### Python |
| 47 | + |
| 48 | +```python |
| 49 | +from prooflink import ProofLinkClient |
| 50 | + |
| 51 | +client = ProofLinkClient() |
| 52 | + |
| 53 | +# Seal a receipt (server mode only) |
| 54 | +receipt = client.seal({ |
| 55 | + 'category': 'container_restart', |
| 56 | + 'actor': 'system:supervisor', |
| 57 | + 'subject': 'suite-nginx', |
| 58 | + 'action': 'restarted after OOM kill', |
| 59 | + 'outcome': 'service healthy 12s after restart', |
| 60 | + 'details': {'pid': 12345, 'oom_score': 800}, |
| 61 | +}) |
| 62 | +print(receipt['hash']) # 64-char SHA-256 |
| 63 | +print(f"https://verify.itechsmart.dev/{receipt['hash']}") |
| 64 | + |
| 65 | +# Verify any receipt by hash (any mode) |
| 66 | +entry = client.verify(receipt['hash']) |
| 67 | + |
| 68 | +# Chain status (any mode) |
| 69 | +status = client.chain_status() |
| 70 | +# {'chain_intact': True, 'total': 15741, 'breaks': 0} |
| 71 | +``` |
| 72 | + |
| 73 | +### Node |
| 74 | + |
| 75 | +```javascript |
| 76 | +const { ProofLinkClient } = require('@itechsmart/prooflink') |
| 77 | +// or: import { ProofLinkClient } from '@itechsmart/prooflink' |
| 78 | + |
| 79 | +const client = new ProofLinkClient() |
| 80 | + |
| 81 | +const receipt = await client.seal({ |
| 82 | + category: 'container_restart', |
| 83 | + actor: 'system:supervisor', |
| 84 | + subject: 'suite-nginx', |
| 85 | + action: 'restarted after OOM kill', |
| 86 | + outcome: 'service healthy 12s after restart', |
| 87 | + details: { pid: 12345, oomScore: 800 }, |
| 88 | +}) |
| 89 | +console.log(receipt.hash) |
| 90 | +console.log(`https://verify.itechsmart.dev/${receipt.hash}`) |
| 91 | + |
| 92 | +const status = await client.chainStatus() |
| 93 | +// { chain_intact: true, total: 15741, breaks: 0 } |
| 94 | +``` |
| 95 | + |
| 96 | +## Receipt schema |
| 97 | + |
| 98 | +Every receipt has the same shape, regardless of language binding: |
| 99 | + |
| 100 | +```json |
| 101 | +{ |
| 102 | + "id": "437f2bbd7fb221ac", |
| 103 | + "timestamp": "2026-06-02T22:14:08.231054+00:00", |
| 104 | + "category": "container_restart", |
| 105 | + "actor": "system:supervisor", |
| 106 | + "subject": "suite-nginx", |
| 107 | + "action": "restarted after OOM kill", |
| 108 | + "outcome": "service healthy 12s after restart", |
| 109 | + "details": { "pid": 12345, "oom_score": 800 }, |
| 110 | + "hash_sha256": "437f2bbd7fb221ac7ce8ff917f84135e7607c5f5b1282354f4c4ac6e0ef8560b", |
| 111 | + "prev_hash": "<previous receipt's hash_sha256>", |
| 112 | + "tamper_detected": false, |
| 113 | + "human_input": false, |
| 114 | + "auto_resolved": true |
| 115 | +} |
| 116 | +``` |
| 117 | + |
| 118 | +`seal()` returns the short form `{ok, id, hash}`. Full receipts are returned by `verify()`. |
| 119 | + |
| 120 | +## Configuration |
| 121 | + |
| 122 | +| Param | Default | Purpose | |
| 123 | +|---|---|---| |
| 124 | +| `append_py` | `/opt/itechsmart/audit_ledger/append.py` | Path to the canonical seal CLI | |
| 125 | +| `verify_url` | `https://verify.itechsmart.dev` | Base URL of the verify API | |
| 126 | +| `python_bin` | `python3` | Python interpreter for the seal subprocess | |
| 127 | +| `timeout` | 30s | Per-seal subprocess timeout | |
| 128 | +| `no_ots` | `False` (per-call) | Skip Bitcoin anchoring (~70x faster seal; receipt still hashed and chained) | |
| 129 | + |
| 130 | +## Status of the verify API |
| 131 | + |
| 132 | +| Endpoint | Status | |
| 133 | +|---|---| |
| 134 | +| `GET /api/chain` | ✅ Live — returns `{chain_intact, total, breaks}` | |
| 135 | +| `GET /api/receipts?hash=...` | ⚠ Currently returns HTML — JSON response in progress (sprint item H3) | |
| 136 | +| `GET /api/stats` | ⚠ Same as above | |
| 137 | + |
| 138 | +Until H3 lands, `verify(hash)` may return parsed HTML scaffolding rather than the receipt JSON. `chain_status()` is the production-stable read path. |
| 139 | + |
| 140 | +## License |
| 141 | + |
| 142 | +MIT — see [LICENSE](LICENSE). |
| 143 | + |
| 144 | +## Author |
| 145 | + |
| 146 | +iTechSmart Inc. — djuane@itechsmart.dev |
0 commit comments