Skip to content

chaalpritam/carbide-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

105 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Carbide Network - Decentralized Storage Marketplace

v1.0.0 Production Release 🎉

Carbide Network transforms data storage through a working decentralized marketplace where anyone can provide storage capacity and earn rewards, while users get affordable, secure, and customizable data storage with user-defined replication factors and pricing.

🎉 Current Status

Production Ready! Carbide Network v1.0.0 is a fully functional storage provider node with:

  • Complete Backend - All Rust crates implemented and tested
  • Beautiful GUI - Tauri-based desktop application with dashboard
  • Mac Mini Optimized - Professional provider setup with 25GB allocation
  • DMG Installer - One-click installation experience
  • Auto-Start - macOS LaunchAgent for 24/7 operation
  • Live Monitoring - Real-time dashboard with earnings tracking

Running locally

Build everything once, then start the pieces in separate terminals.

# 1. build all binaries (debug is fine for dev)
cargo build --workspace

# 2. terminal A — discovery service
cargo run --bin carbide-discovery -- start --port 9090 --host 0.0.0.0

# 3. terminal B — at least one provider
cargo run --bin carbide-provider -- start \
    --name "dev-provider" \
    --port 8080 \
    --capacity-gb 25 \
    --price-per-gb-month 0.005

# 4. terminal C — drive it with the client
cargo run --bin carbide-client -- health   --endpoint http://127.0.0.1:8080
cargo run --bin carbide-client -- upload   --provider http://127.0.0.1:8080 --file ~/some/file.pdf
cargo run --bin carbide-client -- download --provider http://127.0.0.1:8080 \
    --file-id <hex-from-upload> --out /tmp/roundtrip.pdf

upload and download go straight to one provider — no discovery service or Solana payment in the path — which is the cleanest demo loop. Use quote / pay if you want to exercise the full marketplace flow against the local discovery service.

For a two-laptop demo (one provider, one client over LAN/Tailscale):

  1. On the provider laptop, install via Homebrew (see Running in production below) and edit $(brew --prefix)/etc/carbide/provider.toml so [network] advertise_address = "<lan-ip>:8080". The upload_url the provider hands clients is built from this value, so leaving it as 127.0.0.1:8080 would make uploads from another machine fail.
  2. Start the service: brew services start carbide-node.
  3. On the client laptop, run carbide-client upload --provider http://<lan-ip>:8080 --file ….

Tests, lint, formatting

cargo test --workspace
cargo clippy --workspace -- -D warnings
cargo fmt --all

Running in production

For a single Mac storage provider, the supported install path is the Homebrew tap at homebrew-carbide:

brew tap chaalpritam/carbide https://github.com/chaalpritam/homebrew-carbide
brew install --HEAD chaalpritam/carbide/carbide-node
# Edit advertise_address, max_storage_gb, price_per_gb_month in:
#   $(brew --prefix)/etc/carbide/provider.toml
brew services start carbide-node

What this gives you:

Path Purpose
$(brew --prefix)/bin/carbide-{provider,discovery,client} CLI binaries
$(brew --prefix)/etc/carbide/provider.toml Provider config (edit before starting)
$(brew --prefix)/var/carbide/storage/ Default storage root
$(brew --prefix)/var/log/carbide/{provider.out,provider.err}.log Service logs

The launchd service started by brew services keeps the provider alive across reboots and restarts on crash. To pick up config edits:

brew services restart carbide-node
tail -f "$(brew --prefix)/var/log/carbide/provider.err.log"

For the on-chain registration path, fill in [wallet] registry_address, escrow_address, and usdc_address in provider.toml (devnet or mainnet addresses from carbide-contracts) and export the wallet password to launchd:

launchctl setenv CARBIDE_WALLET_PASSWORD "<password>"
brew services restart carbide-node

The provider will then publish itself to carbide_registry on its next heartbeat.

For discovery and the web frontend, see the dedicated repos:

🚀 Vision

Democratize data storage by creating a peer-to-peer marketplace where:

  • Anyone can earn by contributing spare storage capacity ✅ Working in v1.0.0
  • Users choose their own replication factor (1-10 copies) and pricing preferences
  • Mobile-first design optimized for bandwidth and battery constraints
  • Economic incentives align provider and user interests ✅ Reputation system active

🏗️ Architecture Overview

For Storage Providers (Mac Mini)

🎉 NEW: One-Click GUI Installer!

Download and install the Carbide Provider desktop app:

# Option 1: Use the DMG installer (Recommended)
# Download CarbideProvider-Installer-1.0.0.dmg
# Double-click to mount and drag to Applications

# Option 2: Build from source
./build-gui.sh
cp -r "gui/src-tauri/target/release/bundle/macos/Carbide Provider.app" /Applications/
open "/Applications/Carbide Provider.app"

# Option 3: Command-line installation
./install.sh  # Automated setup with 25GB allocation

Or run directly with Rust:

# Build from source
cargo build --release

# Initialize a provider node
cargo run --bin carbide-provider -- init \
  --storage-path ./storage \
  --capacity 25GB \
  --tier home \
  --region northamerica

# Start the provider node
cargo run --bin carbide-provider -- start \
  --name "My Mac Mini Provider" \
  --price-per-gb-month 0.005 \
  --port 8080 \
  --tier home \
  --region northamerica \
  --capacity-gb 25

Provider Types:

  • 🏠 Home Users: Spare disk space, earn ~$0.002/GB/month
  • 🏢 Professionals: Business storage, higher uptime guarantees
  • 🏭 Enterprise: Data center grade, premium pricing
  • 🌐 GlobalCDN: High-performance edge storage

For Data Users (Mobile & Desktop Clients)

📱 Mobile App: iOS/Android app for uploading files to the provider network Status: In development - See MOBILE_APP_INTEGRATION.md for implementation roadmap

Customizable storage tiers:

# Critical files: 5 copies, enterprise providers, $0.01/GB/month
# Important files: 3 copies, mixed providers, $0.005/GB/month
# Backup files: 2 copies, home providers, $0.002/GB/month

Getting Started with Mobile Development:

# See complete integration guide
cat MOBILE_APP_INTEGRATION.md

# Key components to build:
# 1. Discovery Service (find providers worldwide)
# 2. Swift/Kotlin SDK (upload/download files)
# 3. Client-side encryption (zero-knowledge storage)

🎯 Key Features

User-Configurable Replication

Unlike fixed replication in existing solutions, users choose their own safety vs. cost trade-offs:

  • Critical data: 5+ copies across enterprise providers
  • Important data: 3 copies across mixed provider types
  • Backup data: 2 copies on cost-effective home providers

Smart Provider Selection

Automated selection based on:

  • 🏆 Reputation score (uptime, data integrity, compliance)
  • 💰 Competitive pricing within user's budget
  • 📍 Geographic distribution for redundancy
  • ⚡ Performance requirements (latency, bandwidth)

Mobile Optimizations

  • 📶 WiFi: Full replication to all selected providers
  • 📱 Cellular: Essential replication only (save bandwidth/battery)
  • ✈️ Offline: Queue uploads for optimal network conditions

Economic Incentives

  • 60-80% cheaper than centralized storage providers
  • Proof-of-Storage ensures data integrity through cryptographic verification
  • Reputation system rewards reliable providers with more customers
  • Solana programs automate payments and handle disputes via on-chain escrow

🛠️ Technology Stack

  • Language: Rust (performance, safety, concurrency)
  • Networking: HTTP/2 + WebSocket (efficient mobile protocols)
  • Cryptography: Content-addressed storage + end-to-end encryption
  • Chain: Solana — Ed25519 wallet (BIP-44 path 501), USDC SPL escrow
  • Economics: Token-based payments + reputation scoring
  • Consensus: Proof-of-Replication + Proof-of-Spacetime

Inspired by: rqbit for efficient P2P networking patterns

📁 Project Structure

carbide-node/
├── README.md                     # This file
├── ARCHITECTURE.md               # Centralized architecture (legacy)
├── DECENTRALIZED_ARCHITECTURE.md # Complete marketplace design
├── REPLICATION.md                # Multi-node replication strategies
├── IMPLEMENTATION_PLAN.md        # Detailed development roadmap
├── MOBILE_APP_INTEGRATION.md     # Mobile app → provider network integration guide
├── CLAUDE.md                     # Development guidance
├── Cargo.toml                    # Workspace configuration
├── gui/                          # Desktop GUI application (Tauri + React)
│   ├── src/                      # React frontend
│   └── src-tauri/                # Rust backend
├── services/                     # Network services
│   ├── carbide-discovery/        # Discovery service (TODO)
│   └── carbide-gateway/          # Gateway service (TODO)
└── crates/                       # Rust implementation
    ├── carbide-core/             # Core data structures and types
    ├── carbide-crypto/           # Cryptographic primitives
    ├── carbide-provider/         # Storage provider node (CLI + server)
    ├── carbide-discovery/        # Network discovery service
    ├── carbide-client/           # Client SDK and CLI
    └── carbide-reputation/       # Reputation scoring system

🚦 Getting Started

Prerequisites

  • Rust 1.70+ (install)
  • Cargo (comes with Rust)
  • Git for cloning the repository

Building the Project

# Clone the repository
git clone <repository-url>
cd carbide-node

# Build all crates
cargo build --release

# Run tests
cargo test --workspace

# Build specific binary
cargo build --release --bin carbide-provider
cargo build --release --bin carbide-discovery
cargo build --release --bin carbide-client

Quick Start Example

✅ Working Demo (Tested)

Run the complete multi-provider demo:

# Run the comprehensive test runner with multiple providers
./test_runner

# Or run the simple demo
CARGO_MANIFEST_DIR=. cargo run --manifest-path=Cargo.toml.simple

Manual Multi-Node Setup:

1. Start Discovery Service (Terminal 1):

cargo run --bin carbide-discovery -- start \
  --port 3000 \
  --host 0.0.0.0

2. Start Provider Nodes (Terminal 2, 3, 4...):

# Provider 1
cargo run --bin carbide-provider -- start \
  --name "Home Provider 1" \
  --price-per-gb-month 0.005 \
  --port 8080 \
  --tier home \
  --capacity-gb 25

# Provider 2
cargo run --bin carbide-provider -- start \
  --name "Home Provider 2" \
  --price-per-gb-month 0.005 \
  --port 8081 \
  --tier home \
  --capacity-gb 25

3. Test with Client (Terminal N):

# Check provider health
cargo run --bin carbide-client -- health \
  --endpoint http://localhost:8080

# Get provider status
cargo run --bin carbide-client -- status \
  --endpoint http://localhost:8080

# Request storage quote
cargo run --bin carbide-client -- quote \
  --file-size 1048576 \
  --replication 3 \
  --duration 12 \
  --providers http://localhost:8080,http://localhost:8081

4. Monitor with GUI Dashboard:

cd gui && npm run tauri:dev
# Opens beautiful dashboard showing provider status, earnings, and metrics

As a Storage Provider

  1. Build the provider binary: cargo build --release --bin carbide-provider
  2. Initialize storage: carbide-provider init --storage-path ./storage --capacity 1TB
  3. Start the provider: carbide-provider start --price-per-gb-month 0.002
  4. Register with discovery service to start receiving storage requests

As a Data User

  1. Build the client: cargo build --release --bin carbide-client
  2. Configure storage preferences (replication, budget, provider types)
  3. Upload files with automatic provider selection

As a Developer

  1. Read DECENTRALIZED_ARCHITECTURE.md for complete system design
  2. Review CLAUDE.md for development setup and patterns
  3. Check IMPLEMENTATION_PLAN.md for detailed roadmap
  4. Explore the modular crate structure for implementation details
  5. Run examples: cargo run --example <example-name> --package <crate-name>

🗺️ Roadmap

✅ Phase 1: Basic Marketplace (COMPLETED v1.0.0)

  • ✅ Architecture design complete
  • ✅ Rust workspace and crate structure
  • ✅ Core data structures and types
  • ✅ Provider node implementation (CLI + HTTP server)
  • ✅ Discovery service implementation
  • ✅ Client SDK and CLI tools
  • ✅ Cryptographic primitives (content hashing, encryption)
  • ✅ Reputation system implementation
  • ✅ File upload/download implementation
  • ✅ Provider registration and heartbeat
  • ✅ Multi-provider replication support
  • Desktop GUI Application (Tauri + React)
  • DMG Installer for macOS
  • Installation and monitoring scripts
  • Working multi-provider demo

Phase 2: Advanced Features (In Progress)

  • ⏳ Enhanced reputation algorithms
  • ⏳ Mobile client applications (iOS/Android)
  • ⏳ Advanced storage proofs (PoRep, PoSt)
  • ⏳ Dynamic pricing and market optimization
  • ⏳ Cross-platform provider support (Windows, Linux)
  • ⏳ Distributed file chunking and deduplication

Phase 3: Economic Infrastructure (In progress)

  • 🔄 Solana payment integration (USDC SPL token, on-chain escrow)
  • 🔄 carbide_registry / carbide_escrow programs (Anchor)
  • ⏳ Automated dispute resolution
  • ⏳ Advanced proof systems verification
  • ⏳ Staking and incentive mechanisms

Phase 4: Scale & Production (Future)

  • ⏳ Decentralized governance
  • ⏳ Cross-chain integration
  • ⏳ Enterprise features and SLAs
  • ⏳ Global provider network expansion
  • ⏳ Advanced analytics and monitoring
  • ⏳ CDN-like edge caching

🏢 Related Projects

  • Mobile Client: Carbide - iOS/Android app for data storage
  • Desktop Client: CarbideDrive - Desktop sync application

📦 Crates Overview

  • carbide-core: Core data structures, types, and network protocols
  • carbide-crypto: Cryptographic primitives (content hashing, encryption, proofs)
  • carbide-provider: Storage provider node with HTTP API and CLI
  • carbide-discovery: Provider discovery and marketplace coordination service
  • carbide-client: Client SDK and CLI for interacting with the network
  • carbide-reputation: Reputation scoring and tracking system

🤝 Contributing

This project aims to democratize data storage through economic incentives and user choice. Contributions welcome in:

  • Core Implementation: Rust networking and storage systems
  • Mobile Optimization: Battery and bandwidth efficient protocols
  • Economic Modeling: Pricing strategies and reputation algorithms
  • Security Review: Cryptographic proofs and privacy mechanisms

📚 Documentation

🔧 Development

Running Examples

Each crate includes example code demonstrating key functionality:

# Core marketplace demo
cargo run --example marketplace_demo --package carbide-core

# Networking demo
cargo run --example networking_demo --package carbide-core

# Provider demo
cargo run --example provider_demo --package carbide-provider

# Client SDK demo
cargo run --example client_sdk_demo --package carbide-client

# Crypto demo
cargo run --example crypto_demo --package carbide-crypto

Testing

# Run all tests
cargo test --workspace

# Run tests for specific crate
cargo test --package carbide-core

# Run with output
cargo test --workspace -- --nocapture

# Run integration tests
cargo test --package tests

Code Quality

# Format code
cargo fmt --all

# Lint code
cargo clippy --workspace -- -D warnings

# Check documentation
cargo doc --workspace --no-deps --open

🎖️ Competitive Advantages

Feature Carbide Network Filecoin Storj Traditional Cloud
User-Configurable Replication ✅ 1-10 copies ❌ Fixed ❌ Fixed ❌ Fixed
Mobile-Optimized ✅ Battery/bandwidth aware ❌ Desktop focus ❌ Desktop focus ❌ Desktop focus
Easy Provider Setup ✅ One-command install ❌ Complex mining ❌ Complex setup ❌ N/A
Flexible Pricing ✅ Multiple tiers ❌ Market rate only ❌ Fixed pricing ❌ Fixed pricing
Cost vs. Centralized 60-80% cheaper ~90% cheaper ~75% cheaper Baseline

Built with ❤️ for a decentralized future where data storage is affordable, secure, and user-controlled.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors