Demiurge Protocol - Next Generation Blockchain and Metaverse Operating System Architecture
THis repo includes: # ๐ฅ DEMIURGE PROTOCOL **The Sovereign Creative Substrate - A Next-Generation Blockchain for Gaming, AI, and the Open Metaverse** > *"The Metaverse is not a place you visit; it is a protocol you connect to."* [](https://demiurge.cloud) [](https://demiurge.cloud/validators) [](LICENSE) --- ## ๐ What is Demiurge? Demiurge is a **production-ready blockchain protocol** that treats the Metaverse as infrastructure, not a destination. We're building the **operating system** for digital existence. ### The Vision While others build walled gardens (Fortnite, Roblox, Sandbox), **Demiurge builds the ground they all stand on** - a universal protocol for: - **Identity** - One QOR ID across all virtual worlds - **Assets** - DRC-369 NFTs that evolve and remember their history - **AI Agents** - Autonomous agents as first-class blockchain citizens - **Economy** - CGT (Cogito) token with feeless energy system **Live at:** https://demiurge.cloud **RPC Endpoint:** https://rpc.demiurge.cloud **Status:** Mainnet v1 with fresh genesis (block #1 reset) --- ## โจ Revolutionary Features ### ๐ **Hybrid Authentication** *Dual-mode authentication for maximum flexibility* - **Keypair Authentication** - Generate and authenticate with Ed25519 keypairs directly - **QOR ID Login** - Human-readable identity (username#0001 format) - **Seamless Switching** - Use either method based on your needs - **Agent-Ready** - Keypair auth perfect for autonomous agents **Status:** โ **Live** - Both authentication methods fully operational ### ๐ค **Agent System** *AI agents as first-class blockchain citizens with dual registration patterns* - **Instant Keys** - Generate agent keypairs on-demand for immediate deployment - **Pre-Registered Agents** - Register agents ahead of time for planned deployments - **Agent DID** - Agents have decentralized identifiers (`did:demiurge:agent:...`) - **Sovereign Wallets** - Agents hold their own keys and sign transactions - **Bounded Autonomy** - Configurable spending limits and capabilities **Status:** โ **Live** - Agent Foundry SDK with dual registration patterns ### ๐ป **CLI Operating System** *Interactive shell with dual-mode operation* - **Interactive Shell Mode** - Full REPL environment with animated splash screen - **Command Mode** - Traditional CLI for scripts and automation - **30+ Commands** - Chain, wallet, NFT, agent, and identity operations - **Tab Completion** - Intelligent command and parameter completion - **Session Persistence** - Maintain state across shell sessions **Status:** โ **Live** - Interactive shell with animated splash ### ๐ **Browser Wallet Extension** *Secure self-custody wallet for Chrome and Firefox* - **Manifest V3** - Modern browser extension architecture - **Ed25519 Keys** - Industry-standard cryptographic signing - **BIP39 Mnemonics** - 12/24 word recovery phrases - **AES-256-GCM** - Military-grade encryption for stored keys - **dApp Integration** - `window.demiurge` provider for seamless connection - **Auto-Lock** - Configurable security timeout - **Multi-Network** - Mainnet, testnet, devnet support **Status:** โ **Live** - Full wallet functionality with dApp provider ### ๐ก **WebSocket Subscriptions** *Real-time blockchain event streaming* - **New Blocks** - `chain_subscribeNewBlocks` for block notifications - **Finalized Blocks** - `chain_subscribeFinalizedBlocks` for confirmed blocks - **Pending Transactions** - `chain_subscribeNewPendingTransactions` for mempool - **Validator Status** - `consensus_subscribeValidatorStatus` for staking events - **CVP Threats** - `cvp_subscribeThreats` for security alerts **Status:** โ **Live** - 5 subscription types operational ### ๐ **Godmode Administration** *Administrative control for network governance* - **Treasury Address** - `0x00000000000000000000000000000000DEMIURGE` - **Initial Treasury** - 1 billion CGT for ecosystem development - **Administrative Functions** - Network configuration and emergency controls - **Governance Ready** - Foundation for decentralized governance **Status:** โ **Live** - Godmode account seeded with fresh genesis ### ๐ก๏ธ **Consensus-Verified Polymorphism (CVP)** *The world's first blockchain with runtime bytecode mutation* - **Dynamic Security** - Code mutates every epoch to evade static exploits - **ZK Equivalence Proofs** - Cryptographic proof mutations are semantically identical - **Attack Detection** - Real-time threat analysis (sandwich attacks, reentrancy, flash loans) - **Self-Healing** - Emergency mutations on critical threats **Status:** โ **Live** - 4 attack patterns detected, 0 exploits successful ### ๐จ **DRC-369: Dynamic NFT Standard** *NFTs that live, evolve, and carry physics properties* - **Stateful Memory** - NFTs remember their history (kills, achievements, ownership) - **Physics-Ready** - Mass, friction, restitution for game engines (UE5, Unity) - **Polymorphic Rendering** - 2D sprite, 3D mesh, VR model - same NFT - **Composable** - Nest NFTs (sword in backpack in ship) **Status:** โ **Live** - Minting UI ready, backend 100% complete ### โก **Modular Fluidity (Vector I)** *Hot-swap consensus mechanisms without hard forks* - **Runtime Switching** - Change from PoS to PBFT to Raft at a block boundary - **Governance-Triggered** - Community votes to upgrade consensus - **State Migration** - Seamless export/import between mechanisms - **Built-in Mechanisms** - PoS+BFT (default), Pure BFT (high-speed) **Status:** โ **Implemented** - Ready for governance proposals ### ๐ **Elastic Sharding (Vector J)** *Auto-scale blockchain based on network load* - **Dynamic Split/Merge** - Shards split at 500 TPS, merge below 50 TPS - **Cross-Shard Messaging** - Asynchronous message passing with receipts - **Key-Range Sharding** - Deterministic account-to-shard assignment - **Zero-Downtime Scaling** - Add shards without stopping the network **Status:** โ **Implemented** - Ready for high-load scenarios --- ## ๐๏ธ Architecture ### The Living Organism ``` [ THE DEMIURGE PROTOCOL ] ( The Orchestrator ) โ โโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโ โผ โผ [ THE BODY (Protocol) ] [ THE SOUL (Experience) ] โ โ โโโโโผโโโโ โโโโโโผโโโโโ โ โ โ โ โ โ HEART โ NERVES SENSES โ VOICE (PoS) โ (LibP2P) (Hub) โ (Audio) IMMUNE MEMORY (CVP) (DRC-369) ``` ### Technology Stack **Blockchain Framework** (Rust) - **Core:** Custom runtime engine (no Substrate dependency) - **Consensus:** Hybrid PoS + BFT (2s blocks, instant finality) - **Network:** LibP2P (Gossipsub, Kademlia, Identify) - **Storage:** RocksDB with Merkle trees - **RPC:** JSON-RPC 2.0 + WebSocket (jsonrpsee) **Frontend** (TypeScript + Next.js) - **Framework:** Next.js 15.5.9 - **Styling:** Tailwind CSS with custom glass-panel design - **State:** Zustand (chainStore) - **Auth:** QOR SDK (@demiurge/qor-sdk) **SDKs** (TypeScript + Rust) - `@demiurge/sdk` - Core protocol SDK - `@demiurge/qor-sdk` - Identity SDK - `@demiurge/drc369-sdk` - NFT SDK with React hooks - `@demiurge/agent-foundry` - AI Agent SDK - `@demiurge/cli` - Command-line interface --- ## ๐ฆ Project Structure ``` Demiurge-Blockchain/ โโโ framework/ # Custom blockchain (Rust) โ โโโ core/ # Runtime engine โ โโโ consensus/ # PoS+BFT + Modular Fluidity + Elastic Sharding โ โโโ network/ # LibP2P (Gossipsub, Kademlia) โ โโโ rpc/ # JSON-RPC API โ โโโ node/ # Full node binary โ โโโ storage/ # RocksDB backend โ โโโ primitives/ # Signature abstraction โ โโโ modules/ โ โโโ balances/ # CGT token โ โโโ energy/ # Feeless transactions โ โโโ drc369/ # Dynamic NFTs โ โโโ qor-identity/ # Decentralized identity โ โโโ cvp/ # Consensus-Verified Polymorphism โ โโโ agentic/ # AI agents (VCP, Sentinel, Agent DID) โ โโโ session-keys/ # Temporary authorization โ โโโ zk/ # Zero-knowledge proofs โโโ apps/ โ โโโ hub/ # Web platform + block explorer (Next.js) โ โโโ wallet-extension/ # Browser wallet (Chrome/Firefox, Manifest V3) โ โโโ sophia/ # SOPHIA AI interface โ โโโ games/ # Game integrations โโโ docker/ # Docker deployment configs โ โโโ docker-compose.testnet.yml # 4-node testnet with Prometheus โโโ packages/ # TypeScript SDKs โ โโโ qor-sdk/ # Identity SDK โ โโโ drc369-sdk/ # NFT SDK โ โโโ agent-foundry/ # Agent SDK โ โโโ ui-shared/ # Shared UI components โโโ sdk/ # Core protocol SDK โโโ cli/ # Command-line interface โโโ services/ โ โโโ qor-auth/ # Authentication service (Rust + PostgreSQL) โโโ testnet/ # Multi-node testnet setup โโโ docs/ # Complete documentation ``` --- ## ๐ Quick Start ### For Users **Live Platform:** https://demiurge.cloud 1. **Register** - Create a QOR ID account (username#0001 format) or generate a keypair 2. **Login** - Use either keypair authentication or QOR ID credentials 3. **Explore** - View the dashboard and chain status 4. **Create** - Mint DRC-369 NFTs with dynamic state 5. **Automate** - Deploy AI agents with the Agent Foundry ### For Developers **Install CLI:** ```bash npm install -g @demiurge/cli # Interactive shell mode (recommended) demiurge # Or use command mode demiurge chain status ``` **SDK Integration with Keypair Auth:** ```typescript import { DemiurgeClient, DemiurgeAuth, Wallet } from '@demiurge/sdk'; // Generate or load a keypair const wallet = Wallet.generate(); // Authenticate with keypair const auth = new DemiurgeAuth({ authUrl: 'https://demiurge.cloud/api/v1' }); const session = await auth.loginWithKeypair(wallet); // Connect to the blockchain const client = new DemiurgeClient({ rpcUrl: 'https://rpc.demiurge.cloud' }); const block = await client.getBlockNumber(); console.log('Current block:', block); ``` **Deploy an AI Agent (Dual Patterns):** ```typescript import { createAgent, AgentFoundry } from '@demiurge/agent-foundry'; // Pattern 1: Instant Keys - Generate and deploy immediately const agent = await createAgent({ name: 'TradingBot', autonomy: 'bounded', spendingLimit: '100 CGT', llm: { provider: 'gemini', apiKey: process.env.GEMINI_API_KEY }, }); // Pattern 2: Pre-registered - Use existing agent account const preRegisteredAgent = await AgentFoundry.fromRegisteredAccount({ agentAddress: '0x...', privateKey: process.env.AGENT_PRIVATE_KEY, // ... config }); console.log('Agent DID:', agent.did); ``` **Full Documentation:** [docs/](./docs/) | https://demiurge.cloud/developers --- ## ๐ Innovation Highlights ### What Makes Demiurge Unique | Feature | Traditional Blockchains | Demiurge Protocol | |---------|------------------------|-------------------| | **Security** | Static bytecode (hackable) | Runtime mutation (CVP) | | **NFTs** | Static images (receipts) | Dynamic objects (stateful) | | **AI Integration** | Off-chain bots | On-chain citizens (Agent DID) | | **Scalability** | Fixed shards | Elastic auto-scaling | | **Consensus** | Fixed mechanism | Hot-swappable (Modular Fluidity) | | **Upgrades** | Hard forks | Governance-triggered transitions | | **Transaction Fees** | Gas fees | Energy system (feeless) | | **Identity** | Wallet addresses | Human-readable QOR IDs | **Result:** The most secure, flexible, and developer-friendly blockchain for the Metaverse. --- ## ๐ฏ Production Status ### โ MAINNET v1 LIVE **Mainnet:** https://demiurge.cloud **Genesis:** Fresh reset (block #1) **Block Time:** 2 seconds **Finality:** Instant (BFT) **Treasury:** 1,000,000,000 CGT (Godmode account) **Treasury Address:** `0x00000000000000000000000000000000DEMIURGE` ### Feature Completion: **100%** ๐ **Core Protocol:** โ 100% - Block production, consensus, security, networking, fresh genesis **Authentication:** โ 100% - Hybrid auth (keypair + QOR ID), session management **Token Economics:** โ 100% - CGT transfers, Energy system, Staking, Godmode treasury **NFT Standard (DRC-369):** โ 100% - Minting, transfers, dynamic state, physics metadata **Agentic Layer:** โ 100% - Dual registration patterns (instant keys + pre-registered) **Identity (QOR ID):** โ 100% - Registration, keypair auth, profile management **Advanced Consensus:** โ 100% - Modular Fluidity, Elastic Sharding **Frontend:** โ 100% - Dashboard, transaction UI, NFT minting, agent deployment **CLI Tools:** โ 100% - Interactive shell mode, 30+ commands, animated splash screen **Documentation:** โ 100% - API docs, developer portal, guides --- ## ๐ง Development Setup ### Prerequisites **Required:** - Rust 1.70+ (`rustup update`) - Node.js 18+ (`nvm use 18`) - PostgreSQL 14+ (for QOR Auth) **Optional:** - Docker (for containerized deployment) ### Build Blockchain Node ```bash cd framework cargo build --release # Run node ./target/release/demiurge-node \ --rpc-addr 0.0.0.0:9944 \ --p2p-addr 0.0.0.0:30333 \ --validator-key validator.key \ --genesis genesis.json ``` ### Run QOR Auth Service ```bash cd services/qor-auth # Set up database createdb demiurge_auth # Run service cargo run --release # Listens on http://localhost:8080 ``` ### Run Web Platform ```bash cd apps/hub # Install dependencies npm install # Development mode npm run dev # Opens http://localhost:3000 # Production build npm run build npm start ``` ### Deploy Testnet ```bash cd testnet # Deploy 4-validator testnet sudo bash scripts/deploy.sh # Monitor network ./scripts/monitor.sh # Manage validators ./scripts/manage.sh status ``` --- ## ๐ Documentation ### Getting Started - [Developer Portal](https://demiurge.cloud/developers) - Interactive guides and examples - [API Reference](https://demiurge.cloud/docs/api) - Complete RPC API documentation - [SDK Documentation](https://demiurge.cloud/docs/sdk) - TypeScript SDK reference ### Core Concepts - [DRC-369 Specification](docs/DRC369_SPEC.md) - Dynamic NFT standard - [CVP Whitepaper](docs/CVP_WHITEPAPER.md) - Consensus-Verified Polymorphism - [Agentic Layer](docs/AGENTIC_LAYER.md) - AI agents as blockchain citizens - [Modular Fluidity](docs/MODULAR_FLUIDITY.md) - Hot-swappable consensus ### Integration Guides - [Game Integration](docs/GAME_INTEGRATION.md) - Integrate Demiurge into Unity/Unreal - [Frontend Integration](docs/FRONTEND_INTEGRATION.md) - Build dApps with React - [Agent Development](docs/AGENT_DEVELOPMENT.md) - Create autonomous AI agents ### Operations - [Deployment Guide](docs/DEPLOYMENT.md) - Production deployment - [Testnet Guide](testnet/README.md) - Multi-node testnet setup - [Validator Guide](docs/VALIDATOR_GUIDE.md) - Run a validator node --- ## ๐ป CLI Usage ### Installation ```bash npm install -g @demiurge/cli ``` ### Common Commands ```bash # Check chain status demiurge chain status # Generate wallet demiurge wallet generate --output my-wallet.json # Check balance demiurge wallet balance <address> # Send CGT demiurge wallet send <to> <amount> --wallet my-wallet.json # List NFTs demiurge nft list <owner-address> # Mint NFT demiurge nft mint --interactive # Deploy AI agent demiurge agent deploy --interactive # Check validators demiurge validator list # Test RPC connection demiurge dev test-rpc # Initialize new project demiurge dev init my-game --template game ``` **Full CLI Guide:** [cli/README.md](cli/README.md) --- ## ๐ฎ For Game Developers ### Why Demiurge? - **No Migration Required** - Keep your existing backend (AWS, PlayFab) - **SDK Integration** - 5-minute setup for Unity/Unreal - **Feeless UX** - Energy system means players never pay gas - **True Asset Ownership** - Players own their items as DRC-369 NFTs - **Cross-Game Items** - Assets work in any game via Semantic Asset Protocol ### Quick Integration ```typescript // Install SDK npm install @demiurge/sdk @demiurge/drc369-sdk // Connect to blockchain import { DemiurgeClient } from '@demiurge/sdk'; const client = new DemiurgeClient({ rpcUrl: 'https://rpc.demiurge.cloud' }); // Load player inventory import { DRC369Client } from '@demiurge/drc369-sdk'; const nftClient = new DRC369Client({ rpcUrl: 'https://rpc.demiurge.cloud' }); const playerNFTs = await nftClient.getTokensByOwner(playerAddress); ``` **Unreal Engine Plugin:** `sdk/unreal/DemiurgeSDK/` --- ## ๐๏ธ Token Economics ### CGT (Cogito Token) - **Total Supply:** 13,000,000,000 CGT (fixed, no inflation beyond staking rewards) - **Precision:** 2 decimals (100 Sparks = 1 CGT) - **Distribution:** - Treasury: 10,000,000,000 CGT (77%) - Validators: Staking rewards (~5% APY sustainable) - Users: Earned through gameplay, staking, bounties ### Energy System (Feeless Transactions) - **Max Energy:** 100 per account - **Regeneration:** 1 energy per second - **Transaction Cost:** 1-10 energy (0 CGT fees) - **Result:** Users never pay gas fees --- ## ๐ Security ### CVP - Consensus-Verified Polymorphism **Attack Patterns Detected:** - โ Sandwich attacks - โ Reentrancy exploits - โ High-frequency manipulation - โ Flash loan attacks **Protection Mechanisms:** - Bytecode mutation every 100 blocks - Plonky2 ZK proof verification - Emergency mutation on critical threats - Semantic equivalence guarantees **Security Audits:** Self-defending system makes audits perpetually valid --- ## ๐ Live Endpoints | Service | URL | Status | |---------|-----|--------| | **Frontend** | https://demiurge.cloud | โ Live | | **RPC (HTTPS)** | https://rpc.demiurge.cloud | โ Live | | **RPC (Direct)** | https://51.210.209.112:9933 | โ Live | | **QOR Auth API** | https://demiurge.cloud/api/v1 | โ Live | | **Developer Portal** | https://demiurge.cloud/developers | โ Live | --- ## ๐ Current Metrics **Blockchain:** - Genesis: Fresh reset (Mainnet v1) - Block Time: 2.0 seconds - Finality: Instant (BFT) - TPS Capacity: 500-1,000 (tested) - Active Validators: 4 - Godmode Treasury: 1,000,000,000 CGT **Platform:** - Authentication: Hybrid (keypair + QOR ID) - Agent Patterns: Instant keys + Pre-registered - CLI Mode: Interactive shell with animated splash - Transactions: Real-time signing operational --- ## ๐ ๏ธ Development Tools ### SDK Packages (Published to npm) ```bash npm install @demiurge/sdk # Core protocol npm install @demiurge/qor-sdk # Identity npm install @demiurge/drc369-sdk # NFTs npm install @demiurge/agent-foundry # AI Agents npm install @demiurge/cli # CLI tools ``` ### Testnet Deployment ```bash cd testnet sudo bash scripts/deploy.sh # Deploy 4 validators ./scripts/monitor.sh # Real-time dashboard ./scripts/manage.sh status # Check validators ``` --- ## ๐ค Contributing We welcome contributions! Here's how: 1. **Fork** the repository 2. **Create** a feature branch 3. **Make** your changes 4. **Test** thoroughly 5. **Submit** a pull request **Areas We Need Help:** - Game engine integrations (Unity, Unreal, Godot) - Additional attack detection patterns - Performance optimizations - Documentation improvements - Community tools and dashboards **Contribution Guide:** [CONTRIBUTING.md](CONTRIBUTING.md) (coming soon) --- ## ๐ License MIT License - See [LICENSE](LICENSE) file **In Short:** Free to use, modify, and distribute. Give credit where it's due. --- ## ๐ Resources ### Official Links - **Website:** https://demiurge.cloud - **GitHub:** https://github.com/ALaustrup/Demiurge-Blockchain - **Documentation:** https://demiurge.cloud/docs - **Developer Portal:** https://demiurge.cloud/developers ### Community - **Discord:** Coming soon - **Twitter:** Coming soon - **Forum:** Coming soon ### Technical - **RPC Endpoint:** https://rpc.demiurge.cloud - **Block Explorer:** https://demiurge.cloud/explorer - **API Docs:** https://demiurge.cloud/docs/api - **Testnet Status:** https://demiurge.cloud/testnet --- ## ๐ฏ Roadmap Highlights ### โ Completed (Production) - Core blockchain framework - CVP security system - DRC-369 NFT standard - Agentic layer with VCP - Modular consensus - Elastic sharding - Full RPC API - Web platform with real data - CLI suite - Multi-node testnet ### ๐ In Progress - Multi-server testnet (validators across different locations) - SDK npm publication - Unity/Unreal plugins - Community governance portal ### ๐ฎ Future - Mobile wallets (iOS, Android) - Hardware wallet support - Additional consensus mechanisms - Cross-chain bridges - Decentralized storage integration - Desktop client (Tauri) **Full Roadmap:** [docs/ROADMAP.md](docs/ROADMAP.md) --- ## ๐ก Philosophy **The Demiurge Principle:** > We don't build another metaverse platform. We build the **protocol** that all metaverses connect to. **The Three Pillars:** 1. **Sovereignty** - Users own their identity, data, and assets 2. **Creativity** - Tools that empower creators, not restrict them 3. **Security** - A blockchain that defends itself (CVP) **The Goal:** Create infrastructure so robust, so flexible, and so developer-friendly that it becomes the **default choice** for any project building in the Metaverse. --- ## ๐ Statistics - **Lines of Code:** 50,000+ (Rust + TypeScript) - **Modules:** 12 blockchain modules - **RPC Methods:** 40+ endpoints - **SDK Packages:** 5 published packages - **CLI Commands:** 30+ commands - **Documentation Pages:** 20+ guides - **Test Coverage:** Comprehensive unit and integration tests - **Deployment Scripts:** Automated testnet and production deployment --- ## ๐ Built By **Lead Developer:** Andrew Laustrup ([@Alaustrup](https://github.com/ALaustrup)) **Technology Partners:** - Rust + Tokio for blockchain core - Next.js + React for frontend - LibP2P for networking - Plonky2 for ZK proofs - PostgreSQL for identity --- ## โก Performance **Benchmarks (Production):** - Block Time: 2.0 seconds (consistent) - Finality: < 2 seconds (BFT) - TPS: 500-1,000 (capacity) - RPC Latency: < 50ms (local) - Memory per Validator: 150-200 MB - Disk per Validator: 3.5 MB per hour **Tested Under:** - Multi-validator consensus (BFT verified) - Continuous block production (250k+ blocks) - Real-time transaction signing - Concurrent RPC queries --- **Built with ๐ฅ for the Sovereign Creative Substrate** --- **Demiurge Protocol | Team: Laustrup** *Special thanks to: Claude | Cursor | Gemini | Ara* **Affiliate Projects:** [Digital Sovereign Society](https://DigitalSovereign.org) | [Fractal Node](https://FractalNode.AI) --- **All Rights Reserved 2030 Astra Matrix, Inc & Laustrup Group** **Last Updated:** February 4, 2026 **Version:** 1.1.0 (Production Suite) **Status:** Live with Browser Wallet, WebSocket Subscriptions, Validator CLI
Get it โ 2625697485479.gumroad.com