This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
# Build all crates in release mode
cargo build --release
# Build specific crates
cargo build -p vault-core
cargo build -p vault-cli
cargo build -p vault-node
cargo build -p vault-rpc-proxy
# Build decentralized binaries
cargo build --release --bin vault-rpc-proxy # Centralized proxy
cargo build --release --bin vault-rpc-decentralized # Decentralized proxy
# Run tests for all workspace crates
cargo test --workspace
# Run specific test suites
cargo test -p vault-core
cargo test compression_integration
cargo test --test compression_integration
# Run with debug logging
RUST_LOG=debug cargo test test_name -- --nocapture
RUST_BACKTRACE=1 cargo test test_name -- --nocapture
# Economics demo
cargo run --example economics_demo# Decentralized Network (Recommended)
./target/release/vault-rpc-decentralized # Full decentralized proxy
./target/release/vault-node # Storage node
./target/release/vault-cli compress-demo # Demo compression
# Legacy Centralized Mode
./target/release/vault-rpc-proxy # Centralized proxy (legacy)
# Light Client for Applications
./target/release/vault-light-client start --balance 100000
# Development
RUST_LOG=debug ./target/release/vault-rpc-decentralized
./demo.sh # Complete demo sequenceThe vault-node supports both a Terminal User Interface (TUI) and a Web Dashboard, driven by the same core NodeDashboardApi.
# Build with TUI only
cargo build -p vault-node --features tui --release
# Build with Web Dashboard only
cargo build -p vault-node --features dashboard --release
# Build with both TUI and Web Dashboard
cargo build -p vault-node --features full --release# Run with TUI (terminal interface)
./target/release/vault-node --tui
# Run with Web Dashboard on port 3000
./target/release/vault-node --dashboard-port 3000
# Both can run simultaneously
./target/release/vault-node --dashboard-port 3000 # Then access http://localhost:3000The web dashboard uses Vue.js + Tailwind CSS. To build:
cd crates/vault-node/dashboard-frontend
npm install
npm run buildThen rebuild vault-node with cargo build -p vault-node --features dashboard --release.
When running with --dashboard-port:
GET /api/stats- Full node statisticsGET /api/storage- Storage metrics onlyGET /api/network- Network metrics onlyGET /api/economics- Economics metrics onlyGET /api/history- Metrics history for chartsGET /api/health- Health checkWS /ws- WebSocket for real-time updates
vault-node binary
|
+---> --tui flag ---------> TUI (ratatui)
| |
+---> --dashboard-port ---> Web Dashboard (axum + Vue.js)
| |
+------------------------------+
|
NodeDashboardApi (shared in vault-core)
|
+----------+----------+
| | |
Storage Network Economics
- 4 tabs: Overview, Storage, Network, Economics
- Real-time 1-second refresh
- Keyboard navigation: Tab/Arrow keys, 1-4 number keys, q to quit
- Sparkline charts for time-series data
- Gauges for capacity visualization
- Real-time updates via WebSocket
- Responsive grid layout with Tailwind CSS
- Dark theme optimized for monitoring
- Interactive charts and gauges
SolanaVault is a fully decentralized network with economic incentives:
-
vault-core: Central library with decentralized networking
network/: Complete P2P networking stacktransport.rs: NNG-based high-performance transportdiscovery.rs: Kademlia DHT for peer discoveryconsensus.rs: Byzantine Fault Tolerant consensusdecentralized.rs: Coordinated network managerlight_client.rs: Lightweight client for non-node usersgateway.rs: Monetized network access points
compression/: Multi-stage compression (15-25:1 ratios)memory/: Advanced caching and storageeconomics/: Staking, rewards, and payment systems
-
vault-rpc-proxy: Two modes of operation
main.rs: Legacy centralized proxydecentralized_main.rs: New decentralized proxy
-
vault-cli: Network tools and demos
-
vault-node: Full network participant with storage
Transport Layer: NNG (nanomsg-next-generation) for P2P communication
- Binary message serialization (not JSON)
- Publisher/Subscriber patterns
- Direct peer connections
- Microsecond-level latency
Discovery Layer: Kademlia DHT
- Automatic peer discovery
- Content-based routing
- Bootstrap node support
- Geographic distribution
Consensus Layer: Byzantine Fault Tolerant
- Data integrity verification
- 2/3 majority requirements
- Reputation-based slashing
- Automatic conflict resolution
Economic Layer: Pay-per-use model
- Light clients pay micro-tokens
- Gateway operators earn revenue
- Network fees fund infrastructure
- Volume discounts and surge pricing
1. Light Client (Recommended for most users)
# Install and run locally
vault-light-client start --wallet-balance 50000
# Use standard Solana APIs that now connect to decentralized network2. Direct Gateway Access
# Connect directly to gateway nodes for paid access
curl -H "Authorization: Bearer vault_token" https://gateway1.solanavault.com3. Full Node Participation
# Run complete node and earn consensus rewards
./target/release/vault-node --storage-capacity 100GBCost Structure (micro-tokens):
- Base fee: 100μ per request
- Data fee: 50μ per KB
- Priority: 1.5x multiplier
- Volume discounts: Up to 25% off
Revenue Distribution:
- 95% to gateway operators
- 5% to network development fund
- Consensus rewards for storage nodes
- Reputation bonuses for reliability
The codebase has comprehensive testing including decentralized network tests:
- Integration tests:
crates/vault-core/tests/ - Network tests: P2P, consensus, and economic simulations
- Economics demo:
examples/economics_demo.rs - Real blockchain data testing
# Networking
RUST_LOG=debug # General debug
RUST_LOG=vault_core::network=debug # Network-specific
RUST_LOG=vault_core::network::consensus=debug # Consensus only
# Development
RUST_BACKTRACE=1 # Error traces
VAULT_BOOTSTRAP_NODES=tcp://node1:4040,tcp://node2:4040 # Bootstrap peers
VAULT_GATEWAY_ENDPOINT=https://gateway.solanavault.com # Gateway URL- NNG: High-performance networking transport
- Blockchain-compression: Core compression algorithms at
../blockchain-compression - Solana SDK: v1.18 for blockchain compatibility
- Tokio: Async runtime for network operations
- Serde: Message serialization
- UUID, SHA2: Cryptographic operations
- Start with
cargo run --example economics_demo - Test decentralized proxy:
./target/release/vault-rpc-decentralized - Test light client integration
- Deploy gateway nodes for production
- Test specific algorithms:
cargo test compression_integration - Benchmark:
cargo run -p vault-cli -- compress-demo - Verify integrity: Check round-trip compression
- Modify pricing in
network/gateway.rs - Test with
economics_demo.rs - Verify payment flows and incentives
Gateway Node:
./target/release/vault-rpc-decentralized \
--gateway-mode \
--pricing-config pricing.json \
--storage-capacity 1TBLight Client:
./target/release/vault-light-client \
--ipc-path /tmp/vault.sock \
--gateway tcp://gateway.solanavault.com:5050Storage Node:
./target/release/vault-node \
--storage-path /data/vault \
--consensus-participation true \
--bootstrap tcp://bootstrap.solanavault.com:4040- Network: NNG provides superior performance vs HTTP/JSON-RPC
- Compression: 15-25:1 ratios require
--releasebuilds - Economics: Micro-payments require payment channel optimization
- Consensus: Byzantine agreement adds latency but ensures integrity
- Caching: Light clients cache aggressively to minimize costs
- Drop-in Compatibility: Standard Solana RPC API works unchanged
- Economic Sustainability: Users pay for usage, operators earn revenue
- True Decentralization: No central points of failure or control
- Automatic Optimization: Intelligent routing, caching, and pricing
- Developer-Friendly: Existing tools and workflows continue to work