Offline demo
Working educational example · v0.1.0 · Node.js 22+ · synthetic evidence only. This is not the production P21 SDK or a live blockchain verifier.
Download and run
On the built website, open /demo/, download proof21-demo.mjs, and inspect it. From the directory containing that file:
node proof21-demo.mjs
No npm install, API key, wallet, network call, or file write is needed. Use --json for structured output. From a repository checkout containing this example, npm run demo works at the repository root without installing dependencies.
The point of the demonstration
A consumer checks a compact JWS signature using a pinned example Ed25519 public key, then compares the signed synthetic observation with a separate local instruction. It does not accept a key or policy chosen by the receipt itself.
| Input | Signature | Comparison | Consumer decision |
|---|---|---|---|
| Matching sample | VALID | PASS | REVIEW |
| Wrong recipient, honestly signed | VALID | FAIL | REJECT |
| Missing payment evidence | VALID | INDETERMINATE | REVIEW |
| Payload changed after signing | INVALID | INDETERMINATE | REJECT |
The second row is the central lesson: a valid signature does not make the action correct. The first row still requires REVIEW because synthetic evidence cannot establish a real payment.
Exact scope
The code uses Node's built-in Ed25519 verification and JWS compact signing-input rules. The deliberately limited parser supports only this example's fixed header, schema, source type and compact JSON encoding. It rejects other formats rather than approximating them. It is not a general-purpose JOSE library, an implementation of canonical JSON, or the final P21 report format.
The evidence is fictional, the payment asset is fictional, and freshness is compared against a fixed demonstration clock. No Bitcoin or EVM node is contacted. The demo includes no durable replay protection, key discovery/revocation, transaction finality, DMT/TAP derivation, entropy, x402/B402 settlement or MCP runtime. Re-running the examples is intentionally permitted.
Safe use
Inspect downloaded source before execution. Do not install an unverified similarly named npm package. A checksum beside a file detects accidental changes, but does not independently authenticate a compromised publisher. A production installer will need its own review and release-verification process.
The example has no signing private key. Synthetic fixtures were signed once during development; the bundled consumer contains the public key and signed data only. It produces console output without taking an action on a wallet.
Tests
Run npm run test:demo in the repository. Tests cover the four public examples, mismatched fields, unsupported inputs, invalid signatures, replacement keys, malformed encodings, fixed-clock failures, and an independent CLI process. Passing these tests is not a cryptographic audit or evidence of production readiness.