Skip to content

quantumos-tech/os

Repository files navigation

QuantumOS

QuantumOS is a decentralized blockchain protocol designed to simulate and verify real scientific computation tasks — especially quantum physics, gravitational fields, and spin dynamics — using a novel Proof of Useful Work (PoUW) mechanism.


What is QuantumOS?

  • PoUW Protocol: Nodes earn QOS tokens by completing verified simulations
  • Scientific Simulations: Quantum spin systems, statistical mechanics, quantum chemistry
  • Zero-Knowledge Proofs: Cryptographic verification of computational results
  • Decentralized Computing: Researchers submit jobs, miners compute, everyone earns
  • IPFS Integration: Decentralized storage for simulation outputs

Features

Phase 1 Complete (Current)

On-Chain Pallets:

  • pallet-task - Task creation, assignment, and reward distribution
  • pallet-verifier - ZKP verification, reputation system, penalties

Off-Chain Engine:

  • physics-engine - 2D Ising model Monte Carlo simulation
  • Statistical analysis (energy, magnetization, specific heat, susceptibility)
  • JSON serialization for IPFS compatibility
  • High performance (~200ms for 20x20 lattice, 10k steps)

Runtime Integration:

  • Fully integrated Substrate runtime
  • 44 passing tests across all components
  • Complete build system with WASM support

Phase 2 (In Progress)

  • Miner daemon (TaskFetcher, IPFSUploader, Submitter)
  • Actual ZK proof generation (Groth16/PLONK circuits)
  • IPFS client integration
  • Web dApp for task management

Phase 3 (Planned)

  • Additional physics models (Heisenberg, XY, Potts)
  • Quantum annealing simulations
  • GPU acceleration
  • Multi-chain deployment

Architecture

┌─────────────────────────────────────────────────────┐
│            QuantumOS Blockchain (Substrate)         │
│  ┌─────────────────┐  ┌──────────────────────────┐ │
│  │  pallet-task    │  │  pallet-verifier         │ │
│  │  • Create tasks │  │  • ZKP verification      │ │
│  │  • Assignment   │  │  • Reputation tracking   │ │
│  │  • Rewards      │  │  • Penalty enforcement   │ │
│  └─────────────────┘  └──────────────────────────┘ │
└──────────────────┬──────────────────────────────────┘
                   │ Submit (CID + Proof)
                   │
┌──────────────────┴──────────────────────────────────┐
│              Miner Node (Off-chain)                  │
│  ┌─────────────────────────────────────────────┐    │
│  │  physics-engine (Rust Library)              │    │
│  │  • Ising model simulation                   │    │
│  │  • Monte Carlo algorithms                   │    │
│  │  • Observable calculations                  │    │
│  │  • Result serialization                     │    │
│  └─────────────────────────────────────────────┘    │
│           │                    │                     │
│           ▼                    ▼                     │
│    ┌──────────┐         ┌──────────┐               │
│    │   IPFS   │         │ ZK Prover│               │
│    │ Upload   │         │ (Groth16)│               │
│    └──────────┘         └──────────┘               │
└─────────────────────────────────────────────────────┘

Quick Start

Prerequisites

curl https://sh.rustup.rs -sSf | sh

Build & Run

# Clone repository
git clone https://github.com/quantumos-tech/os
cd os

# Build entire workspace
cargo build --release

# Start development node
./target/release/quamtumos-node --dev

# In another terminal, purge chain data (optional)
./target/release/quamtumos-node purge-chain --dev

Run Physics Simulation Example

# Run Ising model demo
cargo run --release -p physics-engine --example basic_ising

Expected output:

QuantumOS Physics Engine - Ising Model Example
============================================================
Simulation Parameters:
  Lattice size: 20x20
  Temperature: T = 2.00 (Tc ≈ 2.269)
  Monte Carlo steps: 10000

RESULTS:
Computation time: 199 ms
  Average energy:      -697.00 ± 33.56
  Average |M|:         355.93 ± 16.84
  Specific heat:       C  = 0.704
  Susceptibility:      χ  = 0.354

Run Tests

# Test all components
cargo test --workspace

# Test specific pallets
cargo test -p pallet-task
cargo test -p pallet-verifier
cargo test -p physics-engine

Documentation

Key Concepts

Task Lifecycle:

  1. Create - User submits task with parameters and reward
  2. Claim - Miner picks up available task
  3. Execute - Miner runs physics simulation off-chain
  4. Upload - Results stored on IPFS, CID obtained
  5. Prove - ZK proof generated for computation
  6. Submit - CID + proof sent to blockchain
  7. Verify - On-chain verification via pallet-verifier
  8. Reward - Funds distributed to miner if proof valid

Economic Model:

  • Minimum task reward: 100 * EXISTENTIAL_DEPOSIT
  • Invalid proof penalty: 50 * EXISTENTIAL_DEPOSIT
  • Reputation: +5 for success, -10 for failure
  • Max task duration: ~2 days (28,800 blocks)

Example Workflow

1. Create a Task (On-chain)

use pallet_task::Call as TaskCall;

// Via extrinsic
api.tx.taskPallet.createTask(
    "ising_2d",                           // simulation type
    "{\"lattice_size\": 20, \"temp\": 2.0}",  // parameters (JSON)
    50,                                    // complexity
    28800,                                 // deadline (blocks)
    1000                                   // reward (tokens)
).signAndSend(alice);

2. Run Simulation (Off-chain)

use physics_engine::{IsingModel, Simulation, SimulationParams};

let params = SimulationParams {
    lattice_size: 20,
    temperature: 2.0,
    steps: 10_000,
    ..Default::default()
};

let mut model = IsingModel::new(params);
let result = model.run();

// Serialize for IPFS
let json = physics_engine::serialize_result(&result)?;

3. Submit Proof (On-chain)

// After IPFS upload and proof generation
api.tx.verifierPallet.submitProof(
    task_id,
    0,           // Groth16 proof system
    proof_data,
    public_inputs
).signAndSend(miner);

Performance

Physics Simulations:

  • 10x10 Ising: ~50ms (5k steps)
  • 20x20 Ising: ~200ms (10k steps)
  • 50x50 Ising: ~2s (20k steps)

Blockchain:

  • Block time: 6 seconds
  • Task assignment: instant
  • Proof verification: <100ms (simulated)

Supported Simulations

Current

2D Ising Model

  • Classical spin system (±1 spins)
  • Metropolis Monte Carlo
  • Phase transition at T_c ≈ 2.269
  • Observables: E, M, C, χ

Planned

  • Heisenberg Model - 3D spin vectors
  • XY Model - 2D spin vectors
  • Potts Model - q-state spins
  • Quantum Annealing - Optimization problems

Development

Project Structure

os/
├── node/                    # Substrate node binary
├── runtime/                 # Blockchain runtime
│   ├── src/
│   │   ├── lib.rs          # Runtime assembly
│   │   └── configs/        # Pallet configurations
│   └── Cargo.toml
├── pallets/
│   ├── task/               # Task management pallet
│   │   ├── src/lib.rs
│   │   ├── src/tests.rs    # 16 tests
│   │   └── Cargo.toml
│   └── verifier/           # ZKP verification pallet
│       ├── src/lib.rs
│       ├── src/tests.rs    # 14 tests
│       └── Cargo.toml
├── physics-engine/         # Off-chain simulation library
│   ├── src/
│   │   ├── lib.rs
│   │   ├── models/ising.rs
│   │   └── monte_carlo.rs
│   ├── examples/
│   └── Cargo.toml
└── docs/
    ├── architecture.md
    └── implementation-guide.md

Adding New Pallets

  1. Create pallet in pallets/
  2. Add to workspace in root Cargo.toml
  3. Configure in runtime/src/configs/mod.rs
  4. Add to runtime in runtime/src/lib.rs

Adding New Physics Models

  1. Implement in physics-engine/src/models/
  2. Implement Simulation and SpinModel traits
  3. Add tests
  4. Update documentation

Testing

# Unit tests
cargo test --lib -p pallet-task
cargo test --lib -p pallet-verifier
cargo test --lib -p physics-engine

# Integration tests
cargo test --workspace

# Benchmarks (future)
cargo bench -p physics-engine

Test Coverage:

  • pallet-task: 16 tests (passing)
  • pallet-verifier: 14 tests (passing)
  • physics-engine: 14 tests (passing)
  • Total: 44 tests, all passing

API Examples

Query Tasks via RPC

curl -H "Content-Type: application/json" \
  -d '{"id":1, "jsonrpc":"2.0", "method":"state_call",
       "params":["TaskPalletApi_pending_tasks", "0x"]}' \
  http://localhost:9944

Using Polkadot.js

import { ApiPromise, WsProvider } from '@polkadot/api';

const api = await ApiPromise.create({
  provider: new WsProvider('ws://localhost:9944')
});

// Get all tasks
const tasks = await api.query.taskPallet.tasks.entries();

// Create task
const tx = api.tx.taskPallet.createTask(
  'ising_2d',
  '{"lattice_size": 20}',
  50, 28800, 1000
);
await tx.signAndSend(alice);

Contributing

We welcome contributions! Areas of interest:

  • Additional physics models
  • ZK circuit implementations
  • Miner daemon development
  • Web UI/dApp
  • Documentation improvements
  • Performance optimization

License

This project is released into the public domain under the Unlicense.


Links


Support


Status: Phase 1 Complete - Production-ready foundation Version: 0.1.0 Last Updated: December 2025

Built using Substrate and Claude Code

About

A Decentralized Proof of Useful Work Protocol for Quantum Physics Simulations

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages