Portal into mycelium from TF
| backend | ||
| webcomponent | ||
| .gitignore | ||
| LICENSE | ||
| Makefile | ||
| README.md | ||
| run.sh | ||
Mycelium Portal
TFT to Spore migration dashboard for the Mycelium Network. Built with Rust, Axum, and Alpine.js.
Features
- Wallet Connection: Connect via Polkadot.js browser extension
- Token Migration: Migrate TFT tokens to Spore on Mycelium
- Node Management: View and manage your TFGrid nodes
- Farming Rewards: Track and claim farming rewards
- Marketplace: Buy and sell CloudSlice node capacity
- Fold Management: Manage cryptographic key containers (identities)
Quick Start
# Build and run
make
# Or step by step
make build # Build backend and webcomponent
make run # Run with HeroLedger setup
# Development
make dev # Quick debug build
make populate # Run with mock data
make fresh # Run with fresh database
Dashboard available at: http://localhost:4749
Prerequisites
- Rust 1.92.0+
- Polkadot.js Extension (for wallet connection)
- HeroLedger (local NEAR blockchain) - auto-setup on first run
Architecture
mycelium_portal/
├── Makefile # Build and run commands
├── run.sh # Main run script with HeroLedger setup
├── 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
│ │ │ └── marketplace.oschema # CloudSlice marketplace
│ │ ├── services/ # Business logic
│ │ └── code/ # Generated code from schemas
│ └── Cargo.toml
└── webcomponent/ # Axum web server + UI
├── src/
│ └── main.rs # Routes and handlers
├── templates/ # Askama HTML templates
│ ├── base.html # Base layout (dark theme)
│ ├── login.html # Wallet connection flow
│ └── index.html # Dashboard
└── Cargo.toml
Tech Stack
| Layer | Technology |
|---|---|
| Backend | Rust 1.92.0, Edition 2024 |
| 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), HeroLedger (NEAR) |
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 |
Dashboard
| Endpoint | Method | Description |
|---|---|---|
/api/dashboard |
GET | All dashboard data |
/api/nodes |
GET | List nodes |
/api/tokens/balance |
GET | Token balances |
/api/rewards |
GET | Reward history |
Actions
| Endpoint | Method | Description |
|---|---|---|
/api/tokens/migrations/start |
POST | Start TFT→Spore migration |
/api/rewards/claim-all |
POST | Claim all rewards |
/api/marketplace/orders/create |
POST | Purchase capacity |
Authentication Flow
- User visits dashboard, redirected to
/login - Polkadot.js extension detected
- User selects account and network (mainnet/testnet/devnet)
- Server generates random challenge
- User signs challenge with extension
- Server verifies signature, creates 24-hour session
- User redirected to dashboard
Development
Makefile Targets
make build - Build backend and webcomponent
make run - Run the dashboard
make populate - Run with mock data
make fresh - Run with fresh database
make dev - Development mode (debug build)
make clean - Remove build artifacts
make test - Run tests
make help - Show all commands
Adding New Features
- Define schema in
backend/src/domains/mycelium/*.oschema - Rebuild backend to generate code:
cd backend && cargo build - Add service methods in
backend/src/services/mycelium.rs - Add API endpoints in
webcomponent/src/main.rs - Update UI in
webcomponent/templates/index.html
Dependencies
Key dependencies pulled in by this project:
- herolib-osis: OSchema database with full-text search (tantivy)
- mycelium_tfchain_client: TFChain blockchain interaction
- subxt: Substrate client for Polkadot ecosystem
- herolib-vault: Cryptographic key management
License
Apache-2.0