How regolith-labs/ore-starter-app works
Purpose and Delivery Model
ORE Starter App is a browser-based mining-client template for the ORE ecosystem. It compiles Rust/Dioxus to WebAssembly, serves a single-page application, and interacts directly with Solana and ORE services from the client. The production artifact is static assets plus WASM, optionally served by a small Rust server.
Paths: src/main.rs, build.sh, serve/src/main.rs.
Application Entry, Routing, and Pages
src/main.rs initializes the Dioxus application, shared providers, and routing. Route definitions select the mining and rewards workflows, with a not-found fallback. Pages compose feature UI, hooks, gateway data, and transaction actions rather than owning RPC logic.
Paths: src/main.rs, src/route.rs, src/pages/mine.rs, src/pages/rewards.rs.
UI Composition Layer
Reusable presentation is split into layout/navigation/feedback, generic controls, token-value renderers, and wallet-specific views. This separates visual composition from application state and chain calls; pages consume these components and hooks.
Paths: src/components/layout/layouts.rs, src/components/token_value/token_value.rs, src/components/wallet/wallet_drawer_web.rs.
Gateway Boundary: Solana, ORE, and Streaming State
The gateway layer is the external-service boundary. It provides the WASM-compatible Solana RPC access, ORE and Entropy API calls, error handling, and browser WebSocket support. The compile-time ORE_RPC_URL selects the Solana RPC endpoint; its client-visible nature means it must not contain secrets.
Paths: src/gateway/mod.rs, src/gateway/solana.rs, src/gateway/ore.rs, src/gateway/entropy.rs, src/gateway/wss/web.rs.
Reactive Hooks and Data Flow
Hooks translate gateway reads and subscriptions into Dioxus state for balances, mining rounds, treasury/configuration, miner/board state, prices, and automation. WebSocket hooks form the live-update substrate; page/UI components react to their state, while RPC/API calls cover request-response operations.
Paths: src/hooks/use_gateway.rs, src/hooks/wss/use_wss.rs, src/hooks/use_miner_wss.rs, src/hooks/use_ore_balance_wss.rs, src/hooks/use_round_wss.rs.
Wallet and Transaction Pipeline
Wallet connectivity crosses a JS/WASM bridge: Rust wallet hooks and views call the generated browser adapter bundle, which integrates wallet-adapter tooling. User actions select a transaction builder (deploy, claim, reset, top-up, automate, cancel), then submit through the web submitter and observe status completion. Signing occurs through the connected browser wallet; the app submits against Solana RPC.
Paths: src/hooks/wallet/use_wallet_web.rs, src/components/wallet/wallet_adapter_web.rs, src/hooks/transaction_builders/use_claim_ore_transaction.rs, src/hooks/submit/submit_transaction_web.rs, src/hooks/transaction_status/use_transaction_status.rs.
Runtime Assets and Deployment
The web runtime uses Dioxus/Rust WASM and Tailwind CSS, with wallet JavaScript built separately by Node/Webpack and emitted to static assets. build.sh produces the release web bundle; the Warp-based server serves it on port 8080 with SPA route fallback. Render is the documented hosting target.
Paths: scripts/wallet/src/main.js, assets/wallet.js, assets/tailwind.css, build.sh, serve/src/main.rs.
Main entry points: mine.rs Mining page · rewards.rs Rewards page · submit_transaction_web.rs Web transaction submitter · use_gateway.rs Reactive data hooks
Components 21
Dioxus SPA
- App entry & providers · Initializes shared state and routing.
src/main.rs - Routes · Selects mining, rewards, and fallback views.
src/route.rs - Mining page
src/pages/mine.rs - Rewards page
src/pages/rewards.rs - Reusable UI · Layouts, token displays, and wallet views.
src/components/layout/layouts.rs
Client Data Layer
- Gateway boundary · WASM-safe boundary for RPC, ORE APIs, and streaming.
src/gateway/mod.rs - Solana RPC client · Endpoint is selected by compile-time ORE_RPC_URL.
src/gateway/solana.rs - ORE & Entropy APIs
src/gateway/ore.rs - Browser WebSocket
src/gateway/wss/web.rs - Reactive data hooks · Maps gateway reads into application state.
src/hooks/use_gateway.rs - Live mining hooks · Keeps miner, balance, and round state current.
src/hooks/use_miner_wss.rs
Wallet & Transactions
- Wallet connection
src/hooks/wallet/use_wallet_web.rs - Browser wallet adapter · Integrates browser wallet-adapter tooling.
src/components/wallet/wallet_adapter_web.rs - Transaction builders · Builds claim and other mining transactions.
src/hooks/transaction_builders/use_claim_ore_transaction.rs - Web transaction submitter · Requests wallet signing and submits transactions.
src/hooks/submit/submit_transaction_web.rs - Transaction status
src/hooks/transaction_status/use_transaction_status.rs
External Services
- Solana network
- ORE services
Build & Hosting
- Wallet JS bundle · Generated browser adapter asset.
assets/wallet.js - WASM SPA bundle · Static Dioxus/Rust WASM application with Tailwind assets.
build.sh - Warp SPA server · Serves the bundle on port 8080 with route fallback.
serve/src/main.rs
Connections 25
- App entry & providers → Routes: configures
- Routes → Mining page: renders
- Routes → Rewards page: renders
- Mining page → Reusable UI: composes
- Rewards page → Reusable UI: composes
- Mining page → Reactive data hooks: consumes
- Rewards page → Reactive data hooks: consumes
- Reactive data hooks → Gateway boundary: reads through
- Live mining hooks → Browser WebSocket: subscribes through
- Live mining hooks → Reactive data hooks: updates state for
- Gateway boundary → Solana RPC client: provides
- Gateway boundary → ORE & Entropy APIs: provides
- Solana RPC client → Solana network: RPC calls
- ORE & Entropy APIs → ORE services: API calls
- Browser WebSocket → ORE services: live updates
- Reusable UI → Wallet connection: uses
- Wallet connection → Browser wallet adapter: bridges to
- Mining page → Transaction builders: initiates actions
- Rewards page → Transaction builders: initiates claims
- Transaction builders → Web transaction submitter: builds for
- Web transaction submitter → Browser wallet adapter: requests signature
- Web transaction submitter → Solana network: submits to
- Web transaction submitter → Transaction status: reports completion
- Wallet JS bundle → WASM SPA bundle: included in
- WASM SPA bundle → Warp SPA server: served by