How solo-daemon/vmkub works
Project type and purpose
• vmkub is a decentralized VM‐orchestration system.
• It combines:
• A Rust‐based P2P overlay (DHT) for node discovery
• On‐chain smart‐contract registries for providers & clients
• A “provider” service that actually boots VMs on hosts (via OpenSSH, VM images)
• A CLI client for users to discover, connect, and pay
• A Next.js web UI for browser‐based interaction
File structure
client/cli – Rust CLI binary that parses commands, calls DHT, calls smart contracts, triggers RPC for payment, and SSH‐into provisioned VMs.
contract/… – JSON ABIs for ProviderRegistry and ClientDataRegistry on‐chain.
dht/ – Rust crate implementing the P2P overlay: node KD‐tree, routing, protocol, attributes, key hashing.
provider/ – Rust service that:
– sets up OpenSSH, launches VMs via host.img
– updates the on‐chain registry
– subcrate vmkub for alternative build
site/ – Next.js + React UI, uses Web3Modal for wallet, calls smart contracts, may invoke client API.
README for behavioral flows
• “cli <vmkub‐provider> setup” → boots VM, SSH, on‐chain update
• “cli <vmkub> connect” → uses DHT best‐match, RPC payment, SSH
• Chain struct stores machine specs
Components
a. Frontend UI (site/)
b. CLI Client (client/cli)
c. P2P DHT Network (dht/)
d. Smart Contracts on Blockchain (contract/)
e. Provider Service (provider/)
f. VM Hosts & VM Images (provider/host.img)
g. External Dependencies (OpenSSH, Ethereum node, RPC endpoint)
Relationships & data‐flow
1) UI ↔ Web3Modal → Blockchain (read/write registry)
2) CLI Client → DHT overlay → finds provider peers
3) CLI Client → RPC payment → Smart contract (on‐chain)
4) CLI Client → SSH → VM on Provider host
5) Provider Service registers itself to DHT + Blockchain
6) Provider Service → VM orchestration (host.img, OpenSSH) → updates on‐chain
Architectural patterns & principles
• Microservices & Crate separation: each major role is its own Rust crate or web app.
• P2P DHT for decentralized discovery.
• On‐chain registries for immutable, auditable provider/client states.
• CLI vs. Web UI dual front ends.
• Clear separation of on‐chain (contracts) vs. off‐chain (DHT, VM orchestration).
Detail to capture
– Crate names (dht, client/cli, provider) as component labels
– JSON ABI files under Blockchain component
– Next.js app under Frontend container
– External dependencies: Ethereum node endpoint, OpenSSH, VM image