A //WIP// decentralized implementation of the Loom - an interface for exploring the narrative multiverse generated by probabilistic language models, with blockchain permanence.
The Loom treats language models as multiverse generators, allowing to explore the stochastic nature of AI. Rather than forcing linear narratives, weaving the Loom enables:
- Multiverse Exploration: Navigate branching realities across narrative timelines
- Selection Pressure: Apply editorial force to guide probability flows
- Evidential Carving: Construct precise realities through iterative boundary-setting
- Counterfactual Search: Explore what-if scenarios across parallel branches
- Collaborative Simulation: Human-AI co-creation of narrative possibility spaces
bLoom extends the Loom's memetic framework with:
- Permanent Multiverse: Trees and branches persist immutably on-chain
- Compositional Nodes: Each narrative node exists as an autonomous entity in a smart contract
- Token Bound Accounts: ERC6551 gives each node its own smart contract wallet
- Token=Token Economics: Content weight translates to token supply (≈1 token per 3 characters)
- Multiple Permanence Modes: Full (NFT+Tokens), Lightweight (contract storage), or IPFS (distributed storage)
- Collaborative Authorship: Narrative branches as composable multiauthor primitives
- LiteGraph.js: Interactive visual tree navigation with zoom/pan
- React: Modern UI with real-time updates via WebSocket
- Ethers.js: Blockchain wallet integration (MetaMask, etc.)
- Apollo GraphQL: Real-time blockchain event subscriptions
- Express.js: REST API server
- Socket.IO: Real-time bidirectional communication
- AI Integration: Multi-model support for text generation
- IPFS Integration: Content pinning and retrieval
- Foundry: Smart contract development and testing
- Anvil: Local Ethereum node for development
- The Graph: Blockchain event indexing and queries
- ERC Standards: ERC721 (NFTs), ERC20 (Tokens), ERC6551 (Token Bound Accounts)
The Loom's multiverse can be crystallized in three ways:
-
Full Mode - Compositional Permanence:
- Each branch becomes an ERC721 NFT entity
- Content weight manifests as ERC20 token supply
- ERC6551 Token Bound Account grants each node autonomy
-
Lightweight Mode - Direct Inscription:
- Branches carved directly into contract storage
- Minimal gas overhead for pure narrative persistence
-
IPFS Mode - Distributed Permanence:
- Content pinned to the InterPlanetary File System
- Only cryptographic hash stored on-chain
- Narrative exists in distributed memory
LoomFactory.sol: Factory for deploying tree and NFT contractsLoomTree.sol: Individual tree contract managing nodes and hierarchyLoomNodeNFT.sol: Per-tree ERC721 contract for node NFTsNodeToken.sol: ERC20 token contract for each node (when in Full mode)LoomNFTFactory.sol: Creates individual NFT contracts per tree
ERC6551Registry.sol: Registry for creating Token Bound AccountsERC6551Account.sol: Smart contract wallet implementation for each NFT
- Initial Supply: Based on content length (content.length / 3, minimum 1 token)
- Dynamic Adjustment: Tokens mint/burn when content is edited
- AI Generation: New nodes get tokens based on AI completion token count
- Token Bound Accounts: All tokens stored in NFT's own smart contract wallet
contracts/ # Solidity smart contracts & tests
├── LoomFactory.sol
├── LoomTree.sol
├── LoomNodeNFT.sol
├── NodeToken.sol
├── ERC6551Registry.sol
└── test/
frontend/ # React web application
├── src/
│ ├── components/
│ ├── hooks/
│ └── utils/
backend/ # Node.js API server
├── routes/ # REST endpoints
├── services/ # Blockchain & IPFS services
└── socketHandlers/ # WebSocket handlers
bloom-subgraph/ # The Graph indexing
├── schema.graphql
└── src/
scripts/ # Deployment & utilities
config/ # Chain configurations
- Node.js v16+
- Foundry (for smart contracts)
- MetaMask or compatible wallet
# Install all dependencies
npm run install-all
# Start local blockchain (in one terminal)
npm run anvil
# Deploy contracts (in another terminal)
npm run deploy
# Start backend server
npm run backend
# Start frontend (in another terminal)
npm run frontendVisit http://localhost:3000 and connect your wallet.
# View active chain configuration
npm run chain:info
# List all configured chains
npm run chain:list
# Switch active chain
npm run chain:use
# Deploy to specific chain
npm run deploy:toDeploy and query blockchain events via GraphQL:
# Deploy subgraph
npm run subgraph:deploy
# Quick deploy (skip codegen)
npm run subgraph:deploy:quickQuery events like TreeCreated, NodeCreated, NodeNFTMinted, TokensMinted, etc.
- Real-time Updates: WebSocket-based synchronization
- Gas Tracking: Built-in gas usage monitoring (press
R) - Keyboard Shortcuts: Full keyboard navigation (WASD, hotkeys)
- Multi-model AI: Switch between AI models on the fly
- Import/Export: Backup and restore tree structures
- Mobile Support: Responsive design with touch controls
- Connect Wallet: Click "Connect Wallet" to link MetaMask
- Create Tree: Press
Tor use "Create New Tree" - Navigate: Use WASD keys or click nodes
- Generate AI Text:
- Press
Enterto generate child branches - Press
Shift+Enterto generate siblings
- Press
- Edit Content: Press
Gon selected node - Switch Storage: Press
Lto cycle storage modes - View Modes: Press
Q(Path View) orE(Tree View)
Claude 4 Sonnet, Claude 4.1 Opus, Claude 4.5 Sonnet, one Human Dev. Inspired by the first Loom.
MIT