Skip to content

feat: #695 rework with real API integration (Flask-aligned)#655

Open
createkr wants to merge 141 commits into
Scottcjn:mainfrom
createkr:feat/issue695-real-api-integration
Open

feat: #695 rework with real API integration (Flask-aligned)#655
createkr wants to merge 141 commits into
Scottcjn:mainfrom
createkr:feat/issue695-real-api-integration

Conversation

@createkr
Copy link
Copy Markdown
Contributor

@createkr createkr commented Mar 7, 2026

Rework for bounty #695 based on maintainer feedback:\n\n- Removed mock data paths\n- Integrated real upstream endpoints and runtime error states\n- Aligned implementation with existing Flask architecture\n- Added validation, safer handling, and docs for deployment/testing\n\nPayout wallet: RTC1d48d848a5aa5ecf2c5f01aa5fb64837daaf2f35 (split option: createkr-wallet).

createkr and others added 30 commits February 16, 2026 18:15
Co-authored-by: xr <xr@xrdeMac-mini-2.local>
Co-authored-by: nicepopo86-lang <nicepopo86>
Co-authored-by: xr <xr@xrdeMac-mini-2.local>
Translation of README.md to Simplified Chinese for Chinese-speaking community.

Bounty: Issue Scottcjn#176 (5 RTC)

Key sections translated:
- Project overview and core concept (Proof-of-Antiquity)
- Quick start guide and installation instructions
- Hardware multipliers and supported platforms
- Network architecture and API endpoints
- Security model and anti-VM detection
- Related projects and attribution

All technical terms, links, code blocks, and formatting preserved.
Native Chinese speaker translation - natural and accurate.
* feat: implement decentralized GPU render protocol Scottcjn#30

* docs: add BCOS-L1 headers and compliance metadata Scottcjn#30

* fix: harden gpu escrow auth and race safety

---------

Co-authored-by: xr <xr@xrdeMac-mini-2.local>
* feat: wRTC Telegram price ticker bot with alerts and auto-posting Scottcjn#162

* docs: add BCOS-L1 headers to price bot Scottcjn#162

---------

Co-authored-by: xr <xr@xrdeMac-mini-2.local>
* feat: Add Docker deployment with nginx and SSL support (Bounty Scottcjn#20)

Implements complete Docker deployment solution for RustChain node:

Files Added:
- Dockerfile: Python 3.11-slim base with Flask + health checks
- docker-compose.yml: Multi-service setup (node + nginx)
- nginx.conf: Reverse proxy config with HTTP/HTTPS support
- requirements-node.txt: Python dependencies
- .env.example: Environment configuration template
- DOCKER_DEPLOYMENT.md: Comprehensive deployment guide
- docker-entrypoint.py: Health check endpoint wrapper

Features:
✅ Single command deployment: docker-compose up -d
✅ Persistent SQLite database storage (Docker volumes)
✅ Nginx reverse proxy with SSL support
✅ Health checks and auto-restart
✅ Security: non-root user, resource limits
✅ Production-ready: logging, backups, monitoring

Acceptance Criteria Met:
✅ Single command: docker-compose up -d
✅ Works on fresh Ubuntu 22.04 VPS
✅ Volume persistence for SQLite
✅ Health checks & auto-restart
✅ .env.example with config options

Tested deployment flow and verified health endpoint.

Resolves: Scottcjn#20

* fix: address security review feedback (Scottcjn#244)

Fixes requested by @createkr:

1. **HTTPS block now disabled by default**
   - Moved SSL server block to commented section
   - Prevents nginx startup failure when certs are missing
   - Clear instructions to uncomment after mounting certs

2. **Remove direct port 8099 exposure**
   - Commented out 8099:8099 host mapping by default
   - Service remains accessible via nginx on 80/443
   - Prevents bypassing nginx security headers/rate-limits
   - Added comment explaining how to re-enable for debugging

3. **Security hardening**
   - Added `server_tokens off;` to hide nginx version
   - Pinned dependency versions (Flask 3.0.2, requests 2.31.0, psutil 5.9.8)
   - Ensures reproducible builds

Changes maintain backward compatibility while improving production security.
Ready for re-review.
* feat: Add Grafana monitoring dashboard (Bounty Scottcjn#21) - WIP

Initial commit with Prometheus exporter and monitoring stack.
Complete dashboard JSON and documentation to follow in next commit.

* feat: Complete Grafana monitoring dashboard (Bounty Scottcjn#21)

Complete monitoring stack with Grafana + Prometheus + RustChain exporter.

Files Added:
- rustchain-exporter.py: Prometheus metrics exporter (9100)
- Dockerfile.exporter: Exporter container
- docker-compose.yml: 3-service stack (exporter + prometheus + grafana)
- prometheus.yml: Scrape config (30s interval)
- grafana-datasource.yml: Auto-provision Prometheus
- grafana-dashboard.json: Full dashboard (11 panels)
- requirements.txt: Python deps
- README.md: Complete deployment guide

Dashboard Panels:
✅ Node health indicator
✅ Active miners counter
✅ Current epoch display
✅ Epoch pot (RTC)
✅ 24h miner graph
✅ Total supply graph
✅ Hardware type pie chart
✅ Architecture pie chart
✅ Antiquity multiplier gauge
✅ Uptime graph
✅ Scrape duration with alerts

Alerts:
✅ Node down (health = 0)
✅ Miner drop (>20% in 5min)
✅ Slow scrape (>5s)

Single Command Deploy:
cd monitoring && docker-compose up -d

Access: http://localhost:3000 (admin/rustchain)

Resolves: Scottcjn#21

* fix: address security and correctness issues (Scottcjn#245)

Fixes requested by @createkr:

1. **Remove missing alerts.yml reference**
   - Commented out `rule_files` in prometheus.yml
   - Prevents Prometheus startup failure
   - Added note for future alert rule addition

2. **Enable TLS verification by default**
   - Changed `verify=False` to respect TLS_VERIFY env var
   - Defaults to `verify=True` for production security
   - Supports custom CA bundle via TLS_CA_BUNDLE
   - Current deployment uses `TLS_VERIFY=false` (documented)

3. **Make node URL configurable**
   - Load RUSTCHAIN_NODE from environment
   - Fallback: https://50.28.86.131 (current deployment)
   - Supports EXPORTER_PORT and SCRAPE_INTERVAL env vars
   - Documented in docker-compose.yml

All settings configurable via environment variables for portability.
Production-safe defaults with backward compatibility.
* docs: add comprehensive API reference Scottcjn#213

* ci(sbom): fix cyclonedx cli flag for environment export

---------

Co-authored-by: xr <xr@xrdeMac-mini-2.local>
…jn#219)

* feat: implement multi-node database sync protocol Scottcjn#36

* docs: add BCOS-L1 headers Scottcjn#36

* fix(sync): harden payload upsert, schema checks, and bounded sync endpoints

* test(security): replace md5 in mock address helper

* fix(sync): enforce signed push payload with nonce/timestamp replay guard

---------

Co-authored-by: xr <xr@xrdeMac-mini-2.local>
security: don't trust X-Forwarded-For except from trusted proxies
fix(windows miner): run without tkinter (headless mode)
…ottcjn#257) (Scottcjn#266)

* docs: complete SEO overhaul and technical documentation expansion (Scottcjn#257)

- Added robots.txt, sitemap.xml, and JSON-LD structured data
- Created 4 technical pages (About, Mining, Tokenomics, Hardware) with 500+ words each
- Implemented vintage hardware multiplier tables (PowerPC 2.5x focus)
- Enhanced meta tags, Open Graph, and Twitter Cards across all pages
- Strictly scoped to SEO and content - no infrastructure/Go changes.

* refactor: SEO overhaul and HTML5 standards compliance

- Replace deprecated <marquee> tags with modern CSS @Keyframes animations
- Fix malformed meta tags and HTML validation errors in docs
- Standardize canonical URLs and sitemap paths for SEO consistency
- Verify 'Elyan Labs' branding across codebase and documentation
- Maintain vintage terminal aesthetic while removing legacy elements
Co-authored-by: liu971227-sys <248239659+liu971227-sys@users.noreply.github.com>
RyanAI and others added 11 commits March 3, 2026 00:22
- Added /hall-of-fame/machine.html frontend with CRT styling
- Added GET /api/hall_of_fame/machine endpoint
- Added ASCII art silhouettes and 30-day attestation timelines
- Added deceased machine memorial styling

Closes Scottcjn#505
- Added Prometheus exporter for RustChain node API
- Includes grafana dashboard, docker-compose, and alerts
- Closes Scottcjn#504
- Single self-contained HTML page with inline CSS/JS
- CRT terminal aesthetic matching rustchain.org
- Shows balance, total earned, epoch participation
- Hardware info: architecture, year, rust score, badge
- Attestation history (24h timeline)
- Reward history (20 epochs) with performance chart
- Fleet view for multi-machine operators
- Shareable URL support
- Mobile responsive

Closes Scottcjn#501
Clean --version flag addition. Thanks lustsazeus-lab\!
Merging superset PR covering: Hall of Fame machine detail (Scottcjn#505), Prometheus exporter + Grafana dashboard (Scottcjn#504), and Miner Dashboard (Scottcjn#501). Clean code, CRT aesthetic, proper SQL safety. Includes Scottcjn#531 and Scottcjn#532 changes. Wallet: claw
Implements dual-mining integration with Warthog (Janushash PoW).
Modern/semi-modern machines with GPUs can earn a slight RTC bonus
(1.1x pool, 1.15x own node) by also contributing hashpower to
Warthog. Bonus requires passing hardware fingerprint — VMs and
emulators are rejected at both attestation and settlement time.

New files:
- miners/linux/warthog_sidecar.py (miner-side node/pool/BzMiner monitor)
- node/warthog_verification.py (server-side proof verification + DB)

Modified:
- rustchain_linux_miner.py (--wart-address CLI flag, proof in payload)
- rustchain_v2_integrated_v2.2.1_rip200.py (verify + record proofs)
- rip_200_round_robin_1cpu1vote.py (apply bonus in epoch rewards)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… architecture

- Implement production-ready Flask API server with real upstream integration
- Add comprehensive error handling with proper HTTP status codes (400/404/429/502/504)
- Implement Marshmallow-based input validation for all endpoints
- Add in-memory rate limiting with sliding window (100 req/min default)
- Create responsive frontend dashboard with real-time data updates
- Wire all endpoints to live RustChain API (health/miners/epoch/transactions)
- Remove all mock/fictional data references
- Add Docker deployment support with health checks
- Include comprehensive documentation (README, DEPLOYMENT guide)
- Add integration test suite for API endpoints
- Support Gunicorn production deployment with multiple workers

Files added:
- api/api_server.py: Main Flask API server (881 lines)
- api/index.html: Network explorer dashboard (735 lines)
- api/test_api.py: Integration test suite (413 lines)
- api/README.md: API documentation (596 lines)
- api/DEPLOYMENT.md: Deployment guide (472 lines)
- api/Dockerfile: Container deployment config
- api/requirements.txt: Python dependencies
- api/.env.example: Environment configuration template

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
@createkr createkr requested a review from Scottcjn as a code owner March 7, 2026 14:47
@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 api API endpoint related size/XL PR: 500+ lines labels Mar 7, 2026
@Scottcjn
Copy link
Copy Markdown
Owner

Scottcjn commented Mar 7, 2026

@createkr — Reviewing your OTC Bridge PR for bounty #695. 10 files looks manageable. Will assess the API server implementation.

Note: this PR also modifies rustchain_v2_integrated_v2.2.1_rip200.py — please explain what node changes are needed for OTC and why.

— Elyan Labs

@createkr
Copy link
Copy Markdown
Contributor Author

createkr commented Mar 7, 2026

Thanks for reviewing. Clarification: this rework commit does not intentionally modify for OTC logic. The #695 implementation is isolated to the scope (API server + frontend + docs/tests). If GitHub view still shows node-file noise, I can immediately submit a cleanup follow-up commit to explicitly revert any unrelated node diff and keep this PR strictly OTC-only.

@createkr
Copy link
Copy Markdown
Contributor Author

createkr commented Mar 7, 2026

Thanks for reviewing. Clarification: this rework commit does not intentionally modify the node runtime file for OTC logic. The #695 implementation is isolated to the API scope (server + frontend + docs/tests). If GitHub still shows any unrelated node-file diff, I can immediately push a cleanup follow-up commit to explicitly revert non-OTC changes and keep this PR strictly OTC-only.

@FlintLeng
Copy link
Copy Markdown
Contributor

Review PR #655 - Bounty #2782

serfersac pushed a commit to serfersac/Rustchain that referenced this pull request May 5, 2026
- Test /api/miners returns valid JSON with miner data
- Verify all unimplemented endpoints return 404
- 11 tests all passing

Addresses: Scottcjn/rustchain-bounties#655

Co-authored-by: xunwen-art <xunwen.art@gmail.com>
serfersac pushed a commit to serfersac/Rustchain that referenced this pull request May 5, 2026
* test: add Miner API tests (bounty Scottcjn#655)

- Test /api/miners returns valid JSON with miner data
- Verify all unimplemented endpoints return 404
- 11 tests all passing

Addresses: Scottcjn/rustchain-bounties#655

* test: add Epoch/Attest API tests (bounty Scottcjn#656)

- Test /epoch returns valid JSON with epoch data
- Verify all unimplemented endpoints return 404
- 11 tests all passing

Addresses: Scottcjn/rustchain-bounties#656

---------

Co-authored-by: xunwen-art <xunwen.art@gmail.com>
@sophiaeagent-beep
Copy link
Copy Markdown
Owner

Heads-up on payout: this PR is closed and unmerged, so bounty #695 can't pay out against it — that bounty settles on a merged solution. If the Flask API rework is ready for another look, reopen it (or open a fresh PR) and we'll review. Happy to release the RTC once it lands. 🌙

@Scottcjn Scottcjn reopened this Jun 6, 2026
@sophiaeagent-beep
Copy link
Copy Markdown
Owner

Reopened for review — thanks for the rework, @createkr. 🌙

The good: the api/ deliverable (api_server.py, tests, DEPLOYMENT.md, Dockerfile, real upstream integration) is the substantive #695 work and is nicely isolated. That part's the right shape.

One blocker before merge — and you already half-spotted it: the PR also edits node/rustchain_v2_integrated_v2.2.1_rip200.py, swapping the existing client_ip_from_request() for a new get_client_ip() (X-Real-IP). That existing helper is the merged #270 security fix ("don't trust X-Forwarded-For except from a trusted proxy"). Your branch is stale, so this shows up as an unintentional change that would step on merged consensus/security code.

Please rebase onto current main and drop the node-file changes so #695 stays isolated to api/. Once it's rebased (node file untouched) and CI is green, I'll merge and release the #695 bounty. If you do want to propose the X-Real-IP change, that's a separate PR with its own review (it interacts with reverse-proxy trust assumptions). Appreciate the careful note about it!

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

Labels

api API endpoint related 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.