Skip to content

feat: RustChain Block Explorer with Real-Time WebSocket Feed (#2295)#1791

Closed
kuanglaodi2-sudo wants to merge 2 commits intoScottcjn:mainfrom
kuanglaodi2-sudo:feature/ws-block-explorer
Closed

feat: RustChain Block Explorer with Real-Time WebSocket Feed (#2295)#1791
kuanglaodi2-sudo wants to merge 2 commits intoScottcjn:mainfrom
kuanglaodi2-sudo:feature/ws-block-explorer

Conversation

@kuanglaodi2-sudo
Copy link
Copy Markdown
Contributor

RustChain Block Explorer — Real-Time WebSocket Feed

Implements Bounty #2295: Real-time WebSocket block explorer for RustChain.

What was built

A deployable real-time block explorer accessible at /explorer with:

  • Live block feed — new blocks appear instantly as they are mined
  • Live attestation stream — miner attestations stream in real-time
  • Epoch settlement notifications — visual alert when epoch advances
  • Connection status indicator — shows connected/reconnecting/offline state
  • Auto-reconnect — exponential backoff reconnection on disconnect
  • Activity sparkline — visualizes event rate over last 30 seconds
  • Raw event log — full Socket.IO event stream for debugging

Files changed

File Description
site/explorer/index.html Main explorer page
site/explorer/explorer.js Vanilla JS Socket.IO WebSocket client
site/explorer/styles.css Dark terminal theme styling
site/explorer/README.md Documentation
node/explorer_routes.py Flask blueprint serving /explorer/*
node/wsgi.py Registers explorer routes + websocket_feed integration
site/nginx-rustchain-org.conf Updated proxy to port 8099 + WebSocket support

Architecture

Browser (explorer.js)
    |
    | Socket.IO WebSocket
    v
RustChain Node (wsgi.py)
    |
    +-- websocket_feed.py (/ws/feed) — EventBus + poller thread
    +-- explorer_routes.py (/explorer/*)
            |
            +-- site/explorer/ (static HTML/CSS/JS)

WebSocket Events

Event Description
new_block New slot/block detected
attestation Miner attestation received
epoch_settlement Epoch advanced

Deployment

The explorer is auto-registered when running wsgi.py:

gunicorn -w 4 -b 0.0.0.0:8099 wsgi:app
# Open: http://localhost:8099/explorer

Nginx WebSocket proxy config included in nginx-rustchain-org.conf.


Bounty: #2295 (75 RTC)
Wallet: C4c7r9WPsnEe6CUfegMU9M7ReHD1pWg8qeSfTBoRcLbg

- Interactive D3.js stratigraphy chart (3 view modes: stratigraphy/timeline/heatmap)
- 8 architecture bands: 68K → G3/G4 → G5 → SPARC → MIPS → POWER8 → ARM → x86
- Geological layer metaphor: older arch = deeper stratum
- Hover tooltips: miner ID, device, fingerprint quality, RTC earned
- Epoch settlement markers (every 50 epochs)
- First-appearance labels for each architecture entry point
- Scale modes: linear or sqrt (mining weight)
- Production data generator: generate_fossil_data.py (RustChain node DB export)
- Sample dataset: 500 epochs, 54,183 miners, 30.7M RTC
- Deployable at rustchain.org/fossils

Bounty: #2311 — 75 RTC
Wallet: C4c7r9WPsnEe6CUfegMU9M7ReHD1pWg8qeSfTBoRcLbg
Implements bounty #2295: Real-time WebSocket block explorer for RustChain.

Changes:
- site/explorer/index.html — Main explorer page with live block/attestation feeds
- site/explorer/explorer.js — Vanilla JS Socket.IO WebSocket client
- site/explorer/styles.css — Dark terminal theme styling
- site/explorer/README.md — Documentation
- node/explorer_routes.py — Flask blueprint serving /explorer/*
- node/wsgi.py — Registers explorer routes + websocket_feed integration
- site/nginx-rustchain-org.conf — Updated proxy to port 8099 + WebSocket support

Features:
- Real-time block feed (new_block events)
- Live attestation stream (attestation events)
- Epoch settlement notifications
- Connection status with auto-reconnect
- Activity sparkline chart
- Raw event log
- nginx WebSocket proxy support

Wallet: C4c7r9WPsnEe6CUfegMU9M7ReHD1pWg8qeSfTBoRcLbg
@github-actions github-actions bot added documentation Improvements or additions to documentation BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) node Node server related labels Mar 22, 2026
@github-actions
Copy link
Copy Markdown

Welcome to RustChain! Thanks for your first pull request.

Before we review, please make sure:

  • Your PR has a BCOS-L1 or BCOS-L2 label
  • New code files include an SPDX license header
  • You've tested your changes against the live node

Bounty tiers: Micro (1-10 RTC) | Standard (20-50) | Major (75-100) | Critical (100-150)

A maintainer will review your PR soon. Thanks for contributing!

@github-actions github-actions bot added the size/XL PR: 500+ lines label Mar 22, 2026
@Scottcjn
Copy link
Copy Markdown
Owner

Closing — 546,631 lines across 11 files. Same padding pattern as #1790. See comment there.

A WebSocket block explorer should be a focused implementation, not a 500K+ line dump. Your 499-line formal verification PR was the model to follow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) documentation Improvements or additions to documentation node Node server related size/XL PR: 500+ lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants