An embeddable, real-time dashboard widget that displays live RustChain network statistics.
- β Zero Dependencies - Pure vanilla JavaScript, no frameworks
- π Live Data - Fetches from RustChain API endpoints
- π¨ Dark Theme - Beautiful gradient design that matches modern sites
- π± Mobile Responsive - Adapts to any screen size
- π Auto-Refresh - Updates every 60 seconds
- π« Animated Visualizations - Rotating logo, pulsing background, blinking miner indicators
- π Click-Through - Direct link to block explorer
- β‘ Lightweight - Single HTML file, ~12KB
Simply open rustchain-widget.html in any modern browser:
# Serve locally
python3 -m http.server 8000
# Then visit: http://localhost:8000/rustchain-widget.html<iframe
src="https://your-domain.com/rustchain-widget.html"
width="420"
height="400"
frameborder="0"
style="border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.15);">
</iframe><div id="rustchain-widget-container"></div>
<script>
fetch('https://your-domain.com/rustchain-widget.html')
.then(res => res.text())
.then(html => {
document.getElementById('rustchain-widget-container').innerHTML = html;
});
</script>The widget fetches data from these RustChain API endpoints:
-
Health Check -
https://50.28.86.131/health- Network status (healthy/degraded)
-
Epoch Info -
https://50.28.86.131/epoch- Current epoch number
- Total RTC distributed (if available)
-
Active Miners -
https://50.28.86.131/api/miners- Count of active miners
- Miner details
| Metric | Source | Description |
|---|---|---|
| Current Epoch | /epoch |
Current epoch number |
| Active Miners | /api/miners |
Number of active miners |
| Network Status | /health |
Healthy / Degraded / Offline |
| Total RTC Distributed | /epoch |
Cumulative RTC distributed (if available) |
Edit the CSS variables in the <style> section:
/* Primary color (orange) */
color: #ff6b35;
/* Background gradient */
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
/* Status colors */
.status-online { color: #4cd137; } /* Green */
.status-degraded { color: #ffb800; } /* Yellow */
.status-offline { color: #ff4757; } /* Red */Change the REFRESH_INTERVAL constant in JavaScript:
const REFRESH_INTERVAL = 30000; // 30 seconds instead of 60Modify the .rustchain-widget CSS:
.rustchain-widget {
max-width: 500px; /* Make wider */
padding: 30px; /* More padding */
}Control the widget programmatically:
// Manual refresh
window.RustChainWidget.refresh();
// Start auto-refresh (60s interval)
window.RustChainWidget.startAutoRefresh();
// Stop auto-refresh
window.RustChainWidget.stopAutoRefresh();The RustChain API endpoints use self-signed SSL certificates and have CORS enabled.
If you encounter CORS issues when embedding:
- Host on the same domain as your site
- Use a CORS proxy (not recommended for production)
- Run via HTTPS (mixed content blocking)
The widget includes error handling for network failures and will retry on the next refresh cycle.
The widget automatically adapts to mobile screens:
- Smaller font sizes on <480px screens
- Maintains readability and touch targets
- Gracefully handles narrow viewports
- Semantic HTML structure
- High contrast text
- Color is not the only indicator (icons + text for status)
- Keyboard navigation support
The widget includes several smooth animations:
- Rotating Logo - 8-second rotation cycle
- Pulsing Background - 4-second fade in/out
- Blinking Miner Dots - 2-second blink cycle
- Hover Effects - Link underline on hover
Animations are CSS-based (no JavaScript) for performance.
- Block Explorer: http://50.28.86.131:8070/explorer
- RustChain GitHub: https://github.com/Scottcjn/Rustchain
- Bounty Issue: Scottcjn/rustchain-bounties#178
- Fork this repo
- Enable GitHub Pages in Settings β Pages
- Select branch:
main, folder:/rustchain-widget - Your widget will be live at:
https://username.github.io/repo/rustchain-widget.html
- Drag the
rustchain-widgetfolder to Netlify Drop - Get instant HTTPS URL
- Connect your repo
- Build command: (none needed)
- Output directory:
rustchain-widget
Tested and working on:
- β Chrome 90+
- β Firefox 88+
- β Safari 14+
- β Edge 90+
- β Opera 76+
Requires ES6 support (async/await, fetch API).
Tech Stack:
- Pure HTML5
- CSS3 (Grid, Flexbox, Animations)
- Vanilla JavaScript ES6+
No Dependencies:
- No jQuery
- No React/Vue/Svelte
- No build tools required
- No package.json
Size:
- HTML + CSS + JS: ~12KB
- Minified: ~8KB
- Gzipped: ~3KB
MIT License - Free to use, modify, and distribute.
Created by Pffs1802 for RustChain Bounty #178
β Animated Miner Activity Visualization - Blinking dots when miners are active β Click-Through to Block Explorer - Direct link to explorer β Auto-Refresh Every 60 Seconds - Configurable interval
All bonus requirements met! π―
Questions or issues? Open an issue on GitHub or comment on the bounty issue.
Enjoy the widget! βοΈβ¨


