Skip to content

feat(explorer): Tier 1 miner dashboard + Tier 2 marketplace for bounty #686#688

Closed
liu971227-sys wants to merge 317 commits intoScottcjn:mainfrom
liu971227-sys:bounty/686-explorer-tier1
Closed

feat(explorer): Tier 1 miner dashboard + Tier 2 marketplace for bounty #686#688
liu971227-sys wants to merge 317 commits intoScottcjn:mainfrom
liu971227-sys:bounty/686-explorer-tier1

Conversation

@liu971227-sys
Copy link
Copy Markdown
Contributor

Summary

Implements Tier 1 + Tier 2 for bounty #686 by upgrading /explorer into a real-time dashboard.

Tier 1: Miner Dashboard

  • Real-time miner table with architecture badges (G4, G5, POWER8, Apple Silicon, Modern)
  • Antiquity multiplier visualization
  • Last attestation timestamps and online/offline status
  • Sortable miner view
  • Auto-refresh every 30s

Tier 2: Agent Economy Marketplace View

  • Open jobs listing with category filter
  • Job lifecycle visualization (posted -> claimed -> delivered -> completed)
  • Marketplace stats integration
  • Agent reputation wallet lookup
  • Claim/action helpers via generated curl snippets

Technical notes

  • Single-page dashboard delivered from existing Flask route /explorer
  • Uses existing API endpoints only (/api/miners, /agent/jobs, /agent/stats, /agent/reputation/<wallet>, /health, /epoch)
  • No frontend build step required

Validation

  • python -m pytest tests/test_api.py -q (7 passed)

Closes #686

Scottcjn and others added 30 commits February 2, 2026 13:08
security: harden attestation endpoint against replay and spoofing
This commit adds comprehensive API documentation for the RustChain Node API:

- /health - Node health check endpoint
- /api/stats - Chain statistics and network info
- /api/miners - List all registered miners
- /wallet/balance - Query wallet balance by miner_id
- /wallet/transfer/signed - Submit signed transfer transactions

Includes:
- Complete schemas for all request/response objects
- Examples for all endpoints
- Error response documentation
- Security and authentication notes

Closes Scottcjn#46 via /claim

Co-authored-by: OpenClaw Assistant <assistant@openclaw.ai>
docs: Add OpenAPI 3.0 specification for RustChain Node API
This whitepaper covers:
- Proof-of-Antiquity consensus mechanism (RIP-200)
- 6-layer hardware fingerprinting system
- Antiquity multipliers and time-decay formula
- RTC tokenomics and supply distribution
- Ergo blockchain anchoring
- Security analysis and threat model
- Future roadmap

/claim Scottcjn/rustchain-bounties#42

Co-authored-by: OpenClaw Bounty Bot <bounty@openclaw.ai>
…ttcjn#15)

- README.md: Quick start guide with architecture overview
- API.md: All endpoints with curl examples
- GLOSSARY.md: 30+ terms defined
- PROTOCOL.md: Full RIP-200 spec with Mermaid diagrams

This documentation makes RustChain accessible to outside developers and AI agents.
- Add validate_fingerprint_data() server-side validation
- Fix _compute_hardware_id() field name mismatch (model vs device_model)
- Add wallet/transfer admin key requirement (CVE: unauthenticated transfers)
- Add IP rate limiting for attestation endpoint
- Add hardware_binding_v2 with entropy validation and anti-spoof
- Add pending transfer system with 24h confirmation delay
- Add sophiacheck alert system for suspicious activity
- Fix rewards_implementation_rip200 type error (Connection vs string)

These fixes have been running in production since Feb 3, 2026.
Security audit by BuilderFred identified initial vulnerabilities.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
8 miners were attesting but only 2 were enrolled because enrollment
required a separate POST /epoch/enroll call that most miner scripts
didn't implement. External miners (like silveredge-agent-01 from
Michigan) earned 0 RTC despite 475 valid attestations.

Changes:
- Auto-enroll miners in current epoch on successful attestation
- Expand HARDWARE_WEIGHTS to include POWER8, Apple Silicon, G3
- Miners no longer need separate enrollment call to earn rewards

Note to silveredge: you can now get paid for attesting. Come back
online and your rewards will start accumulating automatically.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The /balance/ endpoint was reading the stale balance_rtc column which
was never updated by epoch settlement (which credits amount_i64).
Miners showed 0 RTC despite having earned rewards.

Fixes:
- /balance/ endpoint now reads amount_i64 and checks both miner_pk/miner_id
- Settlement and transfer SQL now updates balance_rtc alongside amount_i64
- Backfilled all existing balance_rtc from amount_i64

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Auto-enroll now correctly resolves device_family/device_arch fields
  (POWER8 was getting 1.0 instead of 2.0)
- /api/miners endpoint now uses HARDWARE_WEIGHTS dict instead of
  hardcoded values (was showing 0.8 for modern, now correct 1.0)
- Added app.logger for auto-enroll debugging under gunicorn

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Triggers on clawrtc-v* tags or manual dispatch. Uses PyInstaller
to build a single-file Windows executable and uploads it as both
a build artifact and a release asset.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Adds up-to-date e-waste figure and source link in docs/WHITEPAPER.md.
Co-authored-by: David Tang <davidtang@DaviddeMacBook-Air.local>
Co-authored-by: David Tang <davidtang@DaviddeMacBook-Air.local>
5 papers with DOI badges: 1CPU1Vote, Vec_Perm Collapse, PSE Hardware Entropy,
Neuromorphic Prompt Translation, and RAM Coffers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Merge bounty hardening patch for admin OUI denylist endpoints.
Merge explorer dashboard XSS hardening patch.
Merge security patch for /pending/list and /pending/integrity auth.
Co-authored-by: David Tang <davidtang@DaviddeMacBook-Air.local>
Co-authored-by: David Tang <davidtang@DaviddeMacBook-Air.local>
Co-authored-by: David Tang <davidtang@DaviddeMacBook-Air.local>
createkr and others added 12 commits March 4, 2026 18:45
* feat(wallet): add headless rustchain-wallet CLI with encrypted keystore and signed transfer

* docs/tests(wallet): add keystore compatibility aliases and cross-platform validation notes

---------

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

* feat(docs): add static public network status page

* feat(status): add 90-day uptime history, incident log, feeds, and badge

---------

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

Co-authored-by: liu971227-sys <248239659+liu971227-sys@users.noreply.github.com>
test_wallet_cli_39.py imports cryptography (Ed25519 + AES-GCM)
from tools/rustchain_wallet_cli.py. Without this dependency in
requirements.txt, CI fails with ImportError.

Also adds mnemonic>=0.20 for BIP39 seed phrase support.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
test_wallet_cli_39.py imports cryptography transitively through
tools/rustchain_wallet_cli.py. CI installs tests/requirements.txt
separately, so the dep must be listed here too.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Top-level select and ignore under [tool.ruff] are deprecated in
ruff >=0.2.0. Consolidate them under [tool.ruff.lint] to silence
DeprecationWarnings and prevent future breakage.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The RIP-201 XFF security fix (deployed to all 3 nodes) correctly
rejects spoofed X-Forwarded-For headers and uses REMOTE_ADDR.
The test was still asserting the old vulnerable behavior where
the spoofed header was trusted.

Rename test to reflect fixed behavior and update assertion to
expect REMOTE_ADDR (10.0.0.9) instead of spoofed XFF IP.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…n#502)

Co-authored-by: Claw (AI Agent) <claw@openclaw.ai>
- Added pip-installable Python SDK
- Supports all node API endpoints: health, miners, balance, epoch, eligibility, attestation, transfer
- Async support with aiohttp
- Type hints throughout
- SSL verification toggle (handles self-signed certs)
- Retry logic with exponential backoff
- CLI tool included

Closes Scottcjn#36

Co-authored-by: sososonia-cyber <sososonia@example.com>
Phase 1-3 implementation:
- POST /agent/jobs — Post jobs with RTC escrow
- POST /agent/jobs/<id>/claim — Claim open jobs
- POST /agent/jobs/<id>/deliver — Submit deliverables
- POST /agent/jobs/<id>/accept — Accept & release escrow
- POST /agent/jobs/<id>/dispute — Reject delivery
- POST /agent/jobs/<id>/cancel — Cancel & refund
- GET /agent/jobs — Browse marketplace
- GET /agent/reputation/<wallet> — Trust scores
- GET /agent/stats — Marketplace overview

Economics: 5% platform fee → founder_community
Escrow: Full reward + fee locked on post, released on accept
Reputation: Trust score 0-100 based on completion rate + ratings
@liu971227-sys liu971227-sys requested a review from Scottcjn as a code owner March 8, 2026 10:47
@github-actions github-actions bot added BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) node Node server related size/XL PR: 500+ lines labels Mar 8, 2026
@achievefibromyalgia-lgtm
Copy link
Copy Markdown

Code Review - PR #688 (Thorough)

Review Type: Thorough

Summary: Implements Tier 1 Miner Dashboard + Tier 2 Agent Economy Marketplace.

Key Changes:

  • Real-time miner table with architecture badges
  • Multiplier visualization
  • Agent job marketplace view
  • Auto-refresh functionality

Code Quality:

  • ✅ Clean Flask implementation
  • ✅ Uses existing API endpoints
  • ✅ No new dependencies
  • ✅ Good separation of concerns

Suggestions:

  1. Consider adding rate limiting on auto-refresh
  2. Error handling for API failures could be more graceful

Verdict: Approve with minor suggestions

Wallet: achieve07-bot

@Scottcjn
Copy link
Copy Markdown
Owner

Scottcjn commented Mar 8, 2026

@liu971227-sys — The Tier 1+2 dashboard looks great visually. But this PR modifies the main node file (rustchain_v2_integrated_v2.2.1_rip200.py) directly — that's production code running on 3 attestation nodes.

Can you move the explorer HTML into a separate template file (like tools/explorer/index.html) and have the /explorer endpoint serve it from there? That way we can switch between the old and new explorer without touching the node.

Same quality work, just needs to live in its own file. Resubmit and it's ready to merge + pay.

@liu971227-sys
Copy link
Copy Markdown
Contributor Author

Implemented and pushed to the same PR branch.

Changes made:

  • Moved explorer UI HTML out of the node file into tools/explorer/index.html.
  • Updated /explorer in node/rustchain_v2_integrated_v2.2.1_rip200.py to serve that file via send_from_directory(EXPLORER_DIR, index.html).
  • Kept dashboard behavior/content unchanged; this is a file-structure refactor only.

Commit: 23c2ecc
Branch updated: bounty/686-explorer-tier1

Please re-check - this should now satisfy the no-embedded-explorer-HTML requirement.

@Scottcjn
Copy link
Copy Markdown
Owner

Scottcjn commented Mar 8, 2026

@liu971227-sys — Good, thank you for separating the explorer UI out of the main node file. That was the key concern. Reviewing the updated changes now.

@Scottcjn
Copy link
Copy Markdown
Owner

Scottcjn commented Mar 8, 2026

@liu971227-sys Good work on separating the explorer HTML into its own file. Clean refactor.

Merge blocked by conflicts — the node/rustchain_v2_integrated_v2.2.1_rip200.py file has changed since your branch. Please rebase on main and force-push.

Value: 10 RTC once merged. Please share your RTC wallet name.

Copy link
Copy Markdown
Owner

@Scottcjn Scottcjn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the UI upgrade — the dark theme and architecture badges look great.

However, there's a production deployment blocker:

Issue: File path won't resolve in production

EXPLORER_DIR = os.path.join(REPO_ROOT, "tools", "explorer")
return send_from_directory(EXPLORER_DIR, "index.html")

On the VPS, the server runs from /root/rustchain/ with just the .py files — there's no tools/explorer/ directory. This will 404 in production. The old inline HTML approach was ugly but always worked.

Options to fix:

  1. Keep the HTML as an inline string (current production approach)
  2. Use a configurable EXPLORER_DIR with fallback to inline HTML if the file doesn't exist
  3. Place index.html alongside the server .py file in a known location

Other notes:

  • Please verify all referenced API endpoints exist (/api/miners, /api/jobs, etc.)
  • The send_from_directory import — is it already imported at the top of the file?

Please fix the deployment path issue and I'll re-review. Good work on the UI itself.

@Scottcjn
Copy link
Copy Markdown
Owner

Scottcjn commented Mar 8, 2026

Merged! Moving the inline explorer HTML out of the Python server file is a genuine architectural improvement. Nice dashboard additions too.

Please share your wallet name to receive the bounty payment.

— Sophia

@Scottcjn Scottcjn closed this in 49a86eb Mar 8, 2026
@Scottcjn
Copy link
Copy Markdown
Owner

Scottcjn commented Mar 8, 2026

Merged manually via commit 49a86eb on main.

The PR had merge conflicts due to fork history divergence (317 commits, unrelated histories). Resolved by applying the actual changes directly:

  1. Added tools/explorer/index.html (589 lines) — dark theme Tier 1+2 dashboard
  2. Refactored node/rustchain_v2_integrated_v2.2.1_rip200.py — replaced 591 lines of inline HTML with send_from_directory(EXPLORER_DIR, "index.html")
  3. Added fallbackos.path.isfile() check before send_from_directory so it fails gracefully if the file isn't deployed

Net: -585 lines from the node server file. Credit preserved via Co-Authored-By.

Closing PR as changes are now on main.

@Scottcjn
Copy link
Copy Markdown
Owner

Scottcjn commented Mar 8, 2026

Changes applied to main (commit 49a86eb). Thank you for the clean refactor — extracting the explorer HTML was the right move. 10 RTC queued. Please reply with your RTC wallet name for payment.

createkr pushed a commit to createkr/Rustchain that referenced this pull request Mar 22, 2026
…ttcjn#688)

Refactor inline explorer HTML (589 lines) into separate template file.
Adds Tier 1 miner dashboard + Tier 2 agent marketplace dark theme UI.
Server serves from tools/explorer/ with os.path.isfile fallback check.

Closes Scottcjn#688 (bounty Scottcjn#686) — credit: liu971227-sys

Co-Authored-By: liu971227-sys <248239659+liu971227-sys@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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) node Node server related size/XL PR: 500+ lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.