You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: make explorer realtime updates honest and broader
Drive live UI from real WebSocket events (transaction-confirmed, mempool top-N), widen query invalidation, tighten poll fallback to 4s, and improve peers/masternodes UX so the explorer stays accurate without pretending every feed is push-live.
Co-authored-by: Cursor <cursoragent@cursor.com>
Copy file name to clipboardExpand all lines: README.md
+8-3Lines changed: 8 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,10 @@
2
2
3
3
Modern, responsive block explorer for **FairCoin**. Vite + React SPA frontend with an Express API server (run with Bun) that talks JSON-RPC to a FairCoin node and caches responses in MongoDB. Real-time updates are pushed over WebSocket.
4
4
5
+
## Realtime model
6
+
7
+
WebSocket (`WS /api/ws`) pushes **change notifications** (new blocks, mempool updates, network stats, transaction confirmations). Canonical blockchain data is always loaded over **HTTP** (`GET /api/*`) via React Query: the client invalidates (and optionally paints) caches on push, then refetches the full API shape. When the socket is down, live hooks fall back to a 30s HTTP poll. In local dev, Vite proxies `/api` with `ws: true` so the browser can upgrade `/api/ws` to the API server.
-`WS /api/ws`— push of chain changes (`new-block`, `block-count`, `mempool-update` with top-N txs, `transaction-confirmed`, `network-stats`). Canonical data still comes from HTTP `/api/*`; the socket tells the client when to refetch.
92
96
93
97
## MCP server (for AI assistants)
94
98
@@ -149,5 +153,6 @@ Only key generation is done in-process (using the audited `@noble/curves` secp25
149
153
150
154
## Notes
151
155
156
+
- Realtime model: the server polls the FairCoin RPC (default every 4s) and pushes change events on `WS /api/ws`. Clients should treat HTTP `/api/*` as the source of truth and use the socket to invalidate/refetch.
152
157
- Address balances/history require a FairCoin node with `addressindex=1`; without it the explorer degrades gracefully to validation-only data.
153
-
- The MongoDB cache populates on demand; `npm run sync-db` (full historical sync) is optional.
158
+
- The MongoDB cache populates on demand; `bun run sync-db` (full historical sync) is optional.
0 commit comments