SNAPKITTYWEST commited on
Commit
fbd1b01
Β·
verified Β·
1 Parent(s): c404bdc

Sync with GitHub, license metadata from LICENSE files, commercial license notice

Browse files

metadata license: None -> mit
README: License section kept (already accurate)

Files changed (1) hide show
  1. README.md +300 -294
README.md CHANGED
@@ -1,294 +1,300 @@
1
- ```
2
- β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—
3
- β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β•β• β–ˆβ–ˆβ•”β•β•β•β•β•
4
- β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—
5
- β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β•β• β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•
6
- β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—
7
- β•šβ•β•β•β•β•β•β•β•šβ•β•β•β•β•β•β•β•šβ•β•β•β•β•β• β•šβ•β•β•β•β•β• β•šβ•β•β•β•β•β•β•
8
-
9
- Sovereign Audit Chain Β· Built in Rust Β· Open Protocol Β· MIT
10
- ```
11
-
12
- **Every event sealed. Every tamper detected. No trust required.**
13
-
14
- [![MIT License](https://img.shields.io/badge/license-MIT-00ff88?style=flat-square)](LICENSE)
15
- [![Crates.io](https://img.shields.io/crates/v/ledge?style=flat-square&color=00ff88)](https://crates.io/crates/ledge)
16
- [![npm](https://img.shields.io/npm/v/@snapkitty/ledge?style=flat-square&color=00ff88)](https://www.npmjs.com/package/@snapkitty/ledge)
17
- [![CI](https://img.shields.io/github/actions/workflow/status/SNAPKITTYWEST/ledge/ci.yml?style=flat-square&label=tests)](https://github.com/SNAPKITTYWEST/ledge/actions)
18
-
19
- ---
20
-
21
- ## The problem
22
-
23
- AI systems are making decisions worth millions of dollars. Financial platforms are processing transactions at scale. Compliance teams are asking one question:
24
-
25
- > **"Can you prove what happened β€” and that no one changed it?"**
26
-
27
- Most audit logs are mutable. A database row can be edited. A log file can be overwritten. An S3 object can be replaced. **None of that is proof.**
28
-
29
- LEDGE is proof.
30
-
31
- ---
32
-
33
- ## How it works
34
-
35
- ```
36
- Genesis: SHA256("LEDGE_GENESIS:SOVEREIGN_CHAIN_INIT")
37
-
38
- Event 0: SHA256( genesis β•‘ payload_json β•‘ timestamp_ms β•‘ 0 )
39
- Event 1: SHA256( seal_0 β•‘ payload_json β•‘ timestamp_ms β•‘ 1 )
40
- Event 2: SHA256( seal_1 β•‘ payload_json β•‘ timestamp_ms β•‘ 2 )
41
- Β·Β·Β·
42
- Merkle: SHA256 binary tree over all seals β†’ single root fingerprint
43
- ```
44
-
45
- Change one byte in any event. Every subsequent seal breaks. The Merkle root changes. **Tamper is instant, total, and mathematically provable.**
46
-
47
- ---
48
-
49
- ## Market context (VAULT analysis)
50
-
51
- ```
52
- β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
53
- β”‚ WHY THIS EXISTS NOW β”‚
54
- β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
55
- β”‚ AI audit trail search volume +340% since Q1 2026 β”‚
56
- β”‚ GDPR fines (2025) €2.1B and rising β”‚
57
- β”‚ MiCA enforcement begins Q1 2027 β”‚
58
- β”‚ SOX compliance market $4.2B 12% YoY growth β”‚
59
- β”‚ Avg cost of compliance audit fail $14.8M per incident β”‚
60
- β”‚ Enterprise AI governance market $1.2B β†’ $9.4B by 2030 β”‚
61
- β”‚ Companies with AI audit solutions < 4% of Fortune 500 β”‚
62
- β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
63
-
64
- Every enterprise deploying AI has no answer to:
65
- "How do we audit what the AI decided?"
66
-
67
- LEDGE is that answer.
68
- ```
69
-
70
- ---
71
-
72
- ## Install
73
-
74
- ```bash
75
- npm install @snapkitty/ledge
76
- ```
77
-
78
- ```toml
79
- [dependencies]
80
- ledge = "0.1"
81
- ```
82
-
83
- ---
84
-
85
- ## Usage
86
-
87
- ### TypeScript / JavaScript
88
-
89
- ```typescript
90
- import { initLedge } from '@snapkitty/ledge'
91
-
92
- const { createChain } = await initLedge()
93
- const chain = createChain()
94
-
95
- // Seal an AI decision
96
- chain.seal({
97
- agent: 'VAULT',
98
- decision: 'APPROVE_PAYMENT',
99
- amount: 50000,
100
- vendor: 'Acme Corp',
101
- reason: 'Invoice verified, funds available',
102
- })
103
-
104
- // Seal a follow-up action
105
- chain.seal({
106
- agent: 'FORGE',
107
- action: 'DEPLOY',
108
- ref: 'abc1234',
109
- env: 'production',
110
- })
111
-
112
- // Verify nothing was tampered with
113
- const result = chain.verify()
114
- // { valid: true, eventCount: 2, merkleRoot: '7f3a...', failures: [] }
115
-
116
- console.log('Chain root:', chain.merkleRoot())
117
- // One hex string that fingerprints the entire history
118
- ```
119
-
120
- ### Rust
121
-
122
- ```rust
123
- use ledge::LedgeChain;
124
- use serde_json::json;
125
-
126
- let mut chain = LedgeChain::new();
127
-
128
- chain.seal(json!({
129
- "agent": "VAULT",
130
- "decision": "APPROVE_PAYMENT",
131
- "amount": 50000,
132
- }), unix_ms());
133
-
134
- chain.seal(json!({
135
- "agent": "FORGE",
136
- "action": "DEPLOY",
137
- "ref": "abc1234",
138
- }), unix_ms());
139
-
140
- let result = chain.verify();
141
- assert!(result.valid);
142
-
143
- println!("Merkle root: {}", chain.merkle_root());
144
- ```
145
-
146
- ### Tamper detection
147
-
148
- ```rust
149
- chain.events[0].payload = json!({ "amount": 1 }); // tamper
150
-
151
- let result = chain.verify();
152
- assert!(!result.valid);
153
- assert!(result.failures.contains(&0)); // reports every broken link
154
- ```
155
-
156
- ---
157
-
158
- ## API
159
-
160
- ### Rust β€” `LedgeChain`
161
-
162
- | Method | Returns | Description |
163
- |--------|---------|-------------|
164
- | `LedgeChain::new()` | `Self` | New chain from genesis |
165
- | `.seal(payload, timestamp_ms)` | `SealedEvent` | Append and seal an event |
166
- | `.verify()` | `VerifyResult` | Verify all seals; reports all failures |
167
- | `.merkle_root()` | `String` | Hex Merkle root of the full chain |
168
- | `.genesis()` | `String` | Genesis hash (constant per protocol) |
169
- | `.events()` | `&[SealedEvent]` | Read-only event slice |
170
- | `.len()` | `usize` | Event count |
171
-
172
- ### WASM / JavaScript β€” stateless functions
173
-
174
- | Function | Description |
175
- |----------|-------------|
176
- | `ledge_genesis()` | Genesis hash hex |
177
- | `ledge_seal(prev, payload_json, ts, idx)` | Compute one seal hex |
178
- | `ledge_verify(events_json)` | JSON in β†’ `{valid, failures, merkleRoot, eventCount}` |
179
- | `ledge_merkle_root(seals_json)` | Build Merkle root from seal array |
180
-
181
- ### `SealedEvent` shape
182
-
183
- ```typescript
184
- {
185
- index: number // position in chain
186
- seal: string // 64-char hex SHA-256
187
- previousSeal: string // 64-char hex of prior seal (or genesis)
188
- payload: object // your data β€” anything JSON-serializable
189
- timestampMs: number // unix ms
190
- }
191
- ```
192
-
193
- ---
194
-
195
- ## The seal algorithm
196
-
197
- ```
198
- seal = SHA256(
199
- prev_seal_bytes // 32 bytes
200
- payload_json // UTF-8 bytes β€” canonical JSON.stringify
201
- timestamp_ms // u64 big-endian
202
- index // u64 big-endian
203
- )
204
- ```
205
-
206
- Genesis: `SHA256("LEDGE_GENESIS:SOVEREIGN_CHAIN_INIT")`
207
-
208
- Open protocol. No secrets. Any party can verify any chain independently.
209
-
210
- ---
211
-
212
- ## Security model
213
-
214
- ```
215
- β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
216
- β”‚ WHY RUST β”‚
217
- β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
218
- β”‚ Prototype pollution impossible β”‚
219
- β”‚ Timing attacks constant-time sha2 β”‚
220
- β”‚ Memory safety borrow checker β”‚
221
- β”‚ Supply chain risk 3 deps (sha2/hex/ β”‚
222
- β”‚ serde) β€” auditable β”‚
223
- β”‚ V8 non-determinism eliminated β”‚
224
- β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
225
- ```
226
-
227
- TypeScript was rejected for this library. A cryptographic audit trail written in JavaScript is a liability, not an asset.
228
-
229
- ---
230
-
231
- ## Build from source
232
-
233
- ```bash
234
- # Rust library + tests
235
- cargo build --release
236
- cargo test
237
-
238
- # WASM + JS (requires wasm-pack)
239
- cargo install wasm-pack
240
- wasm-pack build --features wasm --target bundler --out-dir pkg
241
- npm run build:js
242
- ```
243
-
244
- ---
245
-
246
- ## Use cases
247
-
248
- ```
249
- β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
250
- β”‚ AI AGENT DECISIONS Seal every AI output. Prove it wasn't β”‚
251
- β”‚ altered retroactively. SOC 2 ready. β”‚
252
- β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
253
- β”‚ FINANCIAL TRANSACTIONS Immutable payment sequence. Approval β”‚
254
- β”‚ chain proof. Audit on demand. β”‚
255
- β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
256
- β”‚ DEPLOYMENT RECORDS Cryptographic record of what shipped, β”‚
257
- β”‚ when, and who approved it. β”‚
258
- β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
259
- β”‚ COMPLIANCE EVIDENCE SOX Β· GDPR Β· MiCA Β· ISO 27001 β”‚
260
- β”‚ Tamper-evident log, Merkle verifiable. β”‚
261
- β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
262
- ```
263
-
264
- ---
265
-
266
- ## Live demo
267
-
268
- **[collectivekitty.com/labs/ledge](https://collectivekitty.com/labs/ledge)**
269
-
270
- Seal events in the browser. Verify chain integrity. Explore the Merkle tree. No account required.
271
-
272
- ---
273
-
274
- ## Part of the SnapKitty Sovereign OS
275
-
276
- LEDGE is the open protocol layer of a larger sovereign AI operating system. The chain protocol, SDK, and verification tools are MIT-licensed and open forever.
277
-
278
- The intelligence behind it β€” the agent mesh, the orchestration layer, the sovereign OS β€” runs privately on bare metal. [collectivekitty.com](https://collectivekitty.com)
279
-
280
- ---
281
-
282
- ## License
283
-
284
- MIT β€” see [LICENSE](LICENSE)
285
-
286
- ---
287
-
288
- ```
289
- Built by LOC β€” Rust kinetic agent
290
- SnapKitty Sovereign OS Β· 2026
291
- "The borrow checker is the security model."
292
- ```
293
-
294
- ![](https://sovereign-analytics.snapkittywest.workers.dev/canary/ledge)
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ tags:
4
+ - snapkitty
5
+ ---
6
+
7
+ ```
8
+ β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—
9
+ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β•β• β–ˆβ–ˆβ•”β•β•β•β•β•
10
+ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—
11
+ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β•β• β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•
12
+ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—
13
+ β•šβ•β•β•β•β•β•β•β•šβ•β•β•β•β•β•β•β•šβ•β•β•β•β•β• β•šβ•β•β•β•β•β• β•šβ•β•β•β•β•β•β•
14
+
15
+ Sovereign Audit Chain Β· Built in Rust Β· Open Protocol Β· MIT
16
+ ```
17
+
18
+ **Every event sealed. Every tamper detected. No trust required.**
19
+
20
+ [![MIT License](https://img.shields.io/badge/license-MIT-00ff88?style=flat-square)](LICENSE)
21
+ [![Crates.io](https://img.shields.io/crates/v/ledge?style=flat-square&color=00ff88)](https://crates.io/crates/ledge)
22
+ [![npm](https://img.shields.io/npm/v/@snapkitty/ledge?style=flat-square&color=00ff88)](https://www.npmjs.com/package/@snapkitty/ledge)
23
+ [![CI](https://img.shields.io/github/actions/workflow/status/SNAPKITTYWEST/ledge/ci.yml?style=flat-square&label=tests)](https://github.com/SNAPKITTYWEST/ledge/actions)
24
+
25
+ ---
26
+
27
+ ## The problem
28
+
29
+ AI systems are making decisions worth millions of dollars. Financial platforms are processing transactions at scale. Compliance teams are asking one question:
30
+
31
+ > **"Can you prove what happened β€” and that no one changed it?"**
32
+
33
+ Most audit logs are mutable. A database row can be edited. A log file can be overwritten. An S3 object can be replaced. **None of that is proof.**
34
+
35
+ LEDGE is proof.
36
+
37
+ ---
38
+
39
+ ## How it works
40
+
41
+ ```
42
+ Genesis: SHA256("LEDGE_GENESIS:SOVEREIGN_CHAIN_INIT")
43
+
44
+ Event 0: SHA256( genesis β•‘ payload_json β•‘ timestamp_ms β•‘ 0 )
45
+ Event 1: SHA256( seal_0 β•‘ payload_json β•‘ timestamp_ms β•‘ 1 )
46
+ Event 2: SHA256( seal_1 β•‘ payload_json β•‘ timestamp_ms β•‘ 2 )
47
+ Β·Β·Β·
48
+ Merkle: SHA256 binary tree over all seals β†’ single root fingerprint
49
+ ```
50
+
51
+ Change one byte in any event. Every subsequent seal breaks. The Merkle root changes. **Tamper is instant, total, and mathematically provable.**
52
+
53
+ ---
54
+
55
+ ## Market context (VAULT analysis)
56
+
57
+ ```
58
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
59
+ β”‚ WHY THIS EXISTS NOW β”‚
60
+ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
61
+ β”‚ AI audit trail search volume +340% since Q1 2026 β”‚
62
+ β”‚ GDPR fines (2025) €2.1B and rising β”‚
63
+ β”‚ MiCA enforcement begins Q1 2027 β”‚
64
+ β”‚ SOX compliance market $4.2B 12% YoY growth β”‚
65
+ β”‚ Avg cost of compliance audit fail $14.8M per incident β”‚
66
+ β”‚ Enterprise AI governance market $1.2B β†’ $9.4B by 2030 β”‚
67
+ β”‚ Companies with AI audit solutions < 4% of Fortune 500 β”‚
68
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
69
+
70
+ Every enterprise deploying AI has no answer to:
71
+ "How do we audit what the AI decided?"
72
+
73
+ LEDGE is that answer.
74
+ ```
75
+
76
+ ---
77
+
78
+ ## Install
79
+
80
+ ```bash
81
+ npm install @snapkitty/ledge
82
+ ```
83
+
84
+ ```toml
85
+ [dependencies]
86
+ ledge = "0.1"
87
+ ```
88
+
89
+ ---
90
+
91
+ ## Usage
92
+
93
+ ### TypeScript / JavaScript
94
+
95
+ ```typescript
96
+ import { initLedge } from '@snapkitty/ledge'
97
+
98
+ const { createChain } = await initLedge()
99
+ const chain = createChain()
100
+
101
+ // Seal an AI decision
102
+ chain.seal({
103
+ agent: 'VAULT',
104
+ decision: 'APPROVE_PAYMENT',
105
+ amount: 50000,
106
+ vendor: 'Acme Corp',
107
+ reason: 'Invoice verified, funds available',
108
+ })
109
+
110
+ // Seal a follow-up action
111
+ chain.seal({
112
+ agent: 'FORGE',
113
+ action: 'DEPLOY',
114
+ ref: 'abc1234',
115
+ env: 'production',
116
+ })
117
+
118
+ // Verify nothing was tampered with
119
+ const result = chain.verify()
120
+ // { valid: true, eventCount: 2, merkleRoot: '7f3a...', failures: [] }
121
+
122
+ console.log('Chain root:', chain.merkleRoot())
123
+ // One hex string that fingerprints the entire history
124
+ ```
125
+
126
+ ### Rust
127
+
128
+ ```rust
129
+ use ledge::LedgeChain;
130
+ use serde_json::json;
131
+
132
+ let mut chain = LedgeChain::new();
133
+
134
+ chain.seal(json!({
135
+ "agent": "VAULT",
136
+ "decision": "APPROVE_PAYMENT",
137
+ "amount": 50000,
138
+ }), unix_ms());
139
+
140
+ chain.seal(json!({
141
+ "agent": "FORGE",
142
+ "action": "DEPLOY",
143
+ "ref": "abc1234",
144
+ }), unix_ms());
145
+
146
+ let result = chain.verify();
147
+ assert!(result.valid);
148
+
149
+ println!("Merkle root: {}", chain.merkle_root());
150
+ ```
151
+
152
+ ### Tamper detection
153
+
154
+ ```rust
155
+ chain.events[0].payload = json!({ "amount": 1 }); // tamper
156
+
157
+ let result = chain.verify();
158
+ assert!(!result.valid);
159
+ assert!(result.failures.contains(&0)); // reports every broken link
160
+ ```
161
+
162
+ ---
163
+
164
+ ## API
165
+
166
+ ### Rust β€” `LedgeChain`
167
+
168
+ | Method | Returns | Description |
169
+ |--------|---------|-------------|
170
+ | `LedgeChain::new()` | `Self` | New chain from genesis |
171
+ | `.seal(payload, timestamp_ms)` | `SealedEvent` | Append and seal an event |
172
+ | `.verify()` | `VerifyResult` | Verify all seals; reports all failures |
173
+ | `.merkle_root()` | `String` | Hex Merkle root of the full chain |
174
+ | `.genesis()` | `String` | Genesis hash (constant per protocol) |
175
+ | `.events()` | `&[SealedEvent]` | Read-only event slice |
176
+ | `.len()` | `usize` | Event count |
177
+
178
+ ### WASM / JavaScript β€” stateless functions
179
+
180
+ | Function | Description |
181
+ |----------|-------------|
182
+ | `ledge_genesis()` | Genesis hash hex |
183
+ | `ledge_seal(prev, payload_json, ts, idx)` | Compute one seal hex |
184
+ | `ledge_verify(events_json)` | JSON in β†’ `{valid, failures, merkleRoot, eventCount}` |
185
+ | `ledge_merkle_root(seals_json)` | Build Merkle root from seal array |
186
+
187
+ ### `SealedEvent` shape
188
+
189
+ ```typescript
190
+ {
191
+ index: number // position in chain
192
+ seal: string // 64-char hex SHA-256
193
+ previousSeal: string // 64-char hex of prior seal (or genesis)
194
+ payload: object // your data β€” anything JSON-serializable
195
+ timestampMs: number // unix ms
196
+ }
197
+ ```
198
+
199
+ ---
200
+
201
+ ## The seal algorithm
202
+
203
+ ```
204
+ seal = SHA256(
205
+ prev_seal_bytes // 32 bytes
206
+ payload_json // UTF-8 bytes β€” canonical JSON.stringify
207
+ timestamp_ms // u64 big-endian
208
+ index // u64 big-endian
209
+ )
210
+ ```
211
+
212
+ Genesis: `SHA256("LEDGE_GENESIS:SOVEREIGN_CHAIN_INIT")`
213
+
214
+ Open protocol. No secrets. Any party can verify any chain independently.
215
+
216
+ ---
217
+
218
+ ## Security model
219
+
220
+ ```
221
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
222
+ β”‚ WHY RUST β”‚
223
+ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
224
+ β”‚ Prototype pollution impossible β”‚
225
+ β”‚ Timing attacks constant-time sha2 β”‚
226
+ β”‚ Memory safety borrow checker β”‚
227
+ β”‚ Supply chain risk 3 deps (sha2/hex/ β”‚
228
+ β”‚ serde) β€” auditable β”‚
229
+ β”‚ V8 non-determinism eliminated β”‚
230
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
231
+ ```
232
+
233
+ TypeScript was rejected for this library. A cryptographic audit trail written in JavaScript is a liability, not an asset.
234
+
235
+ ---
236
+
237
+ ## Build from source
238
+
239
+ ```bash
240
+ # Rust library + tests
241
+ cargo build --release
242
+ cargo test
243
+
244
+ # WASM + JS (requires wasm-pack)
245
+ cargo install wasm-pack
246
+ wasm-pack build --features wasm --target bundler --out-dir pkg
247
+ npm run build:js
248
+ ```
249
+
250
+ ---
251
+
252
+ ## Use cases
253
+
254
+ ```
255
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
256
+ β”‚ AI AGENT DECISIONS Seal every AI output. Prove it wasn't β”‚
257
+ β”‚ altered retroactively. SOC 2 ready. β”‚
258
+ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
259
+ β”‚ FINANCIAL TRANSACTIONS Immutable payment sequence. Approval β”‚
260
+ β”‚ chain proof. Audit on demand. β”‚
261
+ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
262
+ β”‚ DEPLOYMENT RECORDS Cryptographic record of what shipped, β”‚
263
+ β”‚ when, and who approved it. β”‚
264
+ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
265
+ β”‚ COMPLIANCE EVIDENCE SOX Β· GDPR Β· MiCA Β· ISO 27001 β”‚
266
+ β”‚ Tamper-evident log, Merkle verifiable. β”‚
267
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
268
+ ```
269
+
270
+ ---
271
+
272
+ ## Live demo
273
+
274
+ **[collectivekitty.com/labs/ledge](https://collectivekitty.com/labs/ledge)**
275
+
276
+ Seal events in the browser. Verify chain integrity. Explore the Merkle tree. No account required.
277
+
278
+ ---
279
+
280
+ ## Part of the SnapKitty Sovereign OS
281
+
282
+ LEDGE is the open protocol layer of a larger sovereign AI operating system. The chain protocol, SDK, and verification tools are MIT-licensed and open forever.
283
+
284
+ The intelligence behind it β€” the agent mesh, the orchestration layer, the sovereign OS β€” runs privately on bare metal. [collectivekitty.com](https://collectivekitty.com)
285
+
286
+ ---
287
+
288
+ ## License
289
+
290
+ MIT β€” see [LICENSE](LICENSE)
291
+
292
+ ---
293
+
294
+ ```
295
+ Built by LOC β€” Rust kinetic agent
296
+ SnapKitty Sovereign OS Β· 2026
297
+ "The borrow checker is the security model."
298
+ ```
299
+
300
+ ![](https://sovereign-analytics.snapkittywest.workers.dev/canary/ledge)