# 1. Install dependencies (adds nostr-tools)
npm install
# 2. Start the dev server
npm startThe app opens at http://localhost:3000.
This demo shows real Nostr protocol communication between an Advisor and a Trustee (Lawyer) across live WebSocket relay connections.
-
Open the Advisor app at
http://localhost:3000- Check the sidebar: the relay status pill shows
X/3 Relaysconnected.
- Check the sidebar: the relay status pill shows
-
Open the Trustee simulator by clicking the green "Open Trustee Demo" button in the sidebar (or go to
http://localhost:3000?trustee=truemanually). -
In the Trustee tab, copy the displayed npub (click the Copy button).
-
Back in the Advisor tab:
- Go to Audit Trail → click "Sign & Finalize" on any plan.
- Choose "Configure Inheritance Vault" (the Legacy Bridge option).
- In the Trustee/Lawyer row, paste the npub into the input field.
- Click "Orchestrate via Nostr".
-
Watch the handshake live:
- The Advisor publishes a
kind:24133event to connected Nostr relays. - The Trustee tab receives the request in real-time (you'll see it appear).
- Click "Approve" in the Trustee tab.
- The Advisor tab receives the acknowledgment and transitions to "Linked".
- The miniscript descriptor updates with the trustee's pubkey.
- The Advisor publishes a
-
Open the Event Log (toggle in sidebar) to see raw Nostr events flowing.
| Component | Real | Simulated |
|---|---|---|
| WebSocket connections to Nostr relays | ✅ | |
| Keypair generation (secp256k1 Schnorr) | ✅ | |
| Event signing (NIP-01 compliant) | ✅ | |
| kind:24133 handshake events (NIP-46) | ✅ | |
| Relay fan-out to 3 relays | ✅ | |
| NIP-05 identity resolution | ✅ (visual only) | |
| Agentic Firewall (OpenClaw) | ✅ (setTimeout) | |
| AI Agent Swarm orchestration | ✅ (setTimeout) |
src/
├── nostr.js # Complete Nostr module:
│ # - RelayManager (raw WebSocket)
│ # - Key generation & NIP-19 encoding
│ # - Event signing via nostr-tools
│ # - React Context (NostrProvider)
│ # - useHandshake() hook
│ # - useTrusteeListener() hook
├── TrusteeView.js # Standalone trustee/lawyer simulator
├── App.js # Main advisor app with Nostr integration
├── index.js # URL routing (?trustee=true)
├── index.css # Tailwind directives
└── App.css # Animation keyframes
Build fails on nostr-tools imports?
Try changing the imports in src/nostr.js from:
import { finalizeEvent, generateSecretKey, getPublicKey } from 'nostr-tools/pure'
import * as nip19 from 'nostr-tools/nip19'to:
import * as NostrTools from 'nostr-tools'
const { finalizeEvent, generateSecretKey, getPublicKey, nip19 } = NostrToolsRelays not connecting? Check browser console for WebSocket errors. Some corporate networks block WSS connections. Try a different network or use a VPN.
Handshake not received? Both tabs must be connected to at least one common relay. Check the relay status in both tabs. Relay propagation can take 1-3 seconds.
- React 19 + Tailwind CSS + lucide-react
- nostr-tools v2 (Schnorr key generation, event signing, NIP-19 encoding)
- Raw WebSocket relay management (no SimplePool dependency)
- NIP-01 (events), NIP-19 (bech32 encoding), NIP-46 (Nostr Connect)