Mycelium Network Dashboard
A web-based dashboard for managing nodes, tokens, and rewards on the Mycelium Network. Built with Rust, Axum, and Alpine.js.
Features
- Wallet Connection: Connect via Polkadot.js browser extension
- Node Management: View and manage your TFGrid nodes
- Token Migration: Migrate TFT tokens to Spore on Mycelium
- Farming Rewards: Track and claim farming rewards
- Fold Management: Manage cryptographic key containers (identities)
Architecture
hero_web_template/
├── backend/ # Rust library with OSIS schemas and services
│ ├── src/
│ │ ├── domains/ # OSchema definitions
│ │ │ └── mycelium/
│ │ │ ├── fold.oschema # Identity/wallet management
│ │ │ ├── node.oschema # Node and pricing
│ │ │ ├── token.oschema # Token migration
│ │ │ └── rewards.oschema # Farming rewards
│ │ └── services/ # Business logic
│ └── Cargo.toml
├── webcomponent/ # Axum web server + UI
│ ├── src/
│ │ └── main.rs # Routes and handlers
│ ├── templates/ # Askama HTML templates
│ │ ├── base.html # Base layout
│ │ ├── login.html # Wallet connection
│ │ └── index.html # Dashboard
│ └── Cargo.toml
└── README.md
Tech Stack
| Layer |
Technology |
| Backend |
Rust 1.92.0 |
| Web Framework |
Axum 0.8 |
| Templates |
Askama |
| Frontend |
Alpine.js 3.14 |
| UI Framework |
Bootstrap 5.3 (dark theme) |
| Database |
OSIS (OSchema) |
| Blockchain |
TFChain (Substrate) |
Getting Started
Prerequisites
Building
# Build backend library
cd backend
cargo build --release
# Build webcomponent
cd ../webcomponent
cargo build --release
Running
# From webcomponent directory
./target/release/node-dashboard
# Or with custom options
./target/release/node-dashboard --bind 0.0.0.0:8080 --db-path ./mydata
Populating Mock Data
For development/testing:
cd backend
cargo run --release --bin populate-mock-data
API Endpoints
Authentication
| Endpoint |
Method |
Description |
/login |
GET |
Login page |
/api/auth/challenge |
POST |
Generate signing challenge |
/api/auth/verify-signature |
POST |
Verify signature, create session |
/api/auth/session |
GET |
Get session info |
/api/auth/wallet-logout |
POST |
Invalidate session |
Dashboard
| Endpoint |
Method |
Description |
/api/dashboard |
GET |
All dashboard data |
/api/nodes |
GET |
List nodes |
/api/nodes/summary |
GET |
Node statistics |
/api/tokens/balance |
GET |
Token balances |
/api/rewards |
GET |
Reward history |
/api/folds |
GET |
List folds |
Actions
| Endpoint |
Method |
Description |
/api/nodes/shared |
POST |
Toggle node sharing |
/api/tokens/migrations/start |
POST |
Start token migration |
/api/rewards/claim-all |
POST |
Claim all rewards |
/api/folds/active |
POST |
Set active fold |
Authentication Flow
- User clicks "Connect Wallet" on dashboard
- Redirected to
/login page
- Polkadot.js extension detected
- User selects account from extension
- Server generates random challenge
- User signs challenge with extension
- Server verifies signature, creates session
- User redirected to dashboard with session cookie
Development
Project Structure
- OSIS Schemas (
backend/src/domains/): Define data models using OSchema language
- Services (
backend/src/services/): Business logic and TFChain integration
- Templates (
webcomponent/templates/): Askama HTML templates with Alpine.js
- Routes (
webcomponent/src/main.rs): Axum HTTP handlers
Adding New Features
- Define schema in
backend/src/domains/mycelium/*.oschema
- Rebuild backend to generate code
- Add service methods in
backend/src/services/mycelium.rs
- Add API endpoints in
webcomponent/src/main.rs
- Update UI in
webcomponent/templates/index.html
Related Projects
License
Apache-2.0