|
| 1 | +# Shelby AI Image Generation - Decentralized AI Artifact Registry |
| 2 | + |
| 3 | +This demo demonstrates how **Shelby can serve as the data and provenance layer for AI systems**. Every AI inference run produces verifiable, on-chain artifacts that are immutable, attributable, and accessible via Shelby's decentralized network. |
| 4 | + |
| 5 | +Unlike traditional cloud storage solutions, this application showcases Shelby as a **"Web3 S3" specifically designed for AI workloads** - where AI-generated content lives permanently on-chain with cryptographic provenance, not trapped in centralized systems. |
| 6 | + |
| 7 | +## 🧠 What Makes This AI-Focused |
| 8 | + |
| 9 | +This isn't just file storage - it's an **AI artifact registry** that demonstrates: |
| 10 | + |
| 11 | +### **AI Provenance & Authenticity** |
| 12 | + |
| 13 | +- Every generated image is cryptographically tied to your Aptos wallet address |
| 14 | +- Immutable storage ensures AI outputs can't be tampered with after creation |
| 15 | +- Full traceability from prompt → model → output → storage |
| 16 | + |
| 17 | +### **Decentralized AI Infrastructure** |
| 18 | + |
| 19 | +- **Compute Layer**: OpenAI DALL-E 3 (external AI service) |
| 20 | +- **Storage Layer**: Shelby protocol (decentralized, incentivized network) |
| 21 | +- **Provenance Layer**: Aptos blockchain (immutable ownership records) |
| 22 | + |
| 23 | +### **AI-Specific Metadata** |
| 24 | + |
| 25 | +Each generated image includes structured metadata stored alongside: |
| 26 | + |
| 27 | +```json |
| 28 | +{ |
| 29 | + "prompt": "A futuristic city at sunset", |
| 30 | + "engine": "openai", |
| 31 | + "model": "dall-e-3", |
| 32 | + "createdAt": 1698765432000, |
| 33 | + "creator": "0x1234...abcd", |
| 34 | + "image": { |
| 35 | + "url": "https://api.shelbynet.shelby.xyz/shelby/v1/blobs/0x745...123/images/...." |
| 36 | + }, |
| 37 | + "blobName": "images/A futuristic city at sunset_82p.png" |
| 38 | +} |
| 39 | +``` |
| 40 | + |
| 41 | +## 🏗️ Architecture: Modular Compute-Storage Separation |
| 42 | + |
| 43 | +``` |
| 44 | +┌─────────────────┐ ┌──────────────────┐ ┌─────────────────────┐ |
| 45 | +│ AI Compute │ │ Shelby Storage │ │ Aptos Blockchain │ |
| 46 | +│ (DALL-E 3) │───▶│ (Artifacts) │───▶│ (Provenance) │ |
| 47 | +│ │ │ │ │ │ |
| 48 | +│ • Image Gen │ │ • Immutable │ │ • Ownership │ |
| 49 | +│ • Model Runs │ │ • Decentralized │ │ • Commitments │ |
| 50 | +│ • Stateless │ │ • Auditable │ │ • Expiration │ |
| 51 | +└─────────────────┘ └──────────────────┘ └─────────────────────┘ |
| 52 | +``` |
| 53 | + |
| 54 | +This architecture proves that **AI models can run anywhere, but their data, artifacts, and provenance should live in a decentralized, verifiable layer**. |
| 55 | + |
| 56 | +## 🔥 Why This Matters for AI |
| 57 | + |
| 58 | +### **Verifiable AI Outputs** |
| 59 | + |
| 60 | +- Prove ownership of AI-generated content |
| 61 | +- Combat deepfakes with cryptographic authenticity |
| 62 | +- Enable model output traceability and reproducibility |
| 63 | + |
| 64 | +### **Open AI Infrastructure** |
| 65 | + |
| 66 | +- AI artifacts aren't locked in vendor silos (AWS, Google Cloud) |
| 67 | +- Decentralized storage with incentivized uptime guarantees |
| 68 | +- Permissionless access to AI-generated data |
| 69 | + |
| 70 | +### **Future-Ready for Verifiable Compute** |
| 71 | + |
| 72 | +- Today: External AI + Shelby storage |
| 73 | +- Tomorrow: Shelby-native AI compute in TEEs with zero-knowledge proofs |
| 74 | +- Same artifact storage pattern scales to fully decentralized AI pipelines |
| 75 | + |
| 76 | +## Getting Started |
| 77 | + |
| 78 | +### Prerequisites |
| 79 | + |
| 80 | +- `node` and `pnpm` |
| 81 | +- Shelby and Aptos API keys. For best performance, you are encouraged to generate an API key so your app will not hit the rate limit. |
| 82 | + - Head to [Geomi](https://geomi.dev/) |
| 83 | + - Generate an API key for `shelbynet` and add it to the `.env` file as `NEXT_PUBLIC_SHELBY_API_KEY=<my-api-key>` |
| 84 | + - Generate an API key for `devnet` and add it to the `.env` file as `NEXT_PUBLIC_APTOS_API_KEY=<my-api-key>` |
| 85 | +- OpenAI API Key. Head to [OpenAI Platform](https://platform.openai.com/api-keys) to generate an API Key and add it to the `.env` file as `OPENAI_API_KEY=<my-api-key>` |
| 86 | + |
| 87 | +Create an `.env` file by copying the `.env.example` file and fill out the required variables. |
| 88 | + |
| 89 | +```bash |
| 90 | +cp .env.example .env |
| 91 | +``` |
| 92 | + |
| 93 | +Then install dependencies and run the dapp locally |
| 94 | + |
| 95 | +```bash |
| 96 | +pnpm install |
| 97 | +pnpm run dev |
| 98 | +``` |
| 99 | + |
| 100 | +Open [http://localhost:3001](http://localhost:3001) with your browser to see the result. |
| 101 | + |
| 102 | +## 🛠️ Technical Implementation |
| 103 | + |
| 104 | +### **AI Generation Pipeline** |
| 105 | + |
| 106 | +```typescript |
| 107 | +// 1. Generate image via OpenAI API |
| 108 | +const imageBuffer = await generateImage(prompt); |
| 109 | + |
| 110 | +// 2. Create cryptographic commitments |
| 111 | +const commitments = await generateCommitments(provider, imageBuffer); |
| 112 | + |
| 113 | +// 3. Register blob on Aptos blockchain |
| 114 | +const payload = ShelbyBlobClient.createRegisterBlobPayload({ |
| 115 | + account: account.address, |
| 116 | + blobName: `images/${blobName}.png`, |
| 117 | + blobMerkleRoot: commitments.blob_merkle_root, |
| 118 | + // ... other metadata |
| 119 | +}); |
| 120 | + |
| 121 | +// 4. Upload to Shelby's decentralized network |
| 122 | +await shelbyClient.rpc.putBlob({ |
| 123 | + account: account.address, |
| 124 | + blobName: imageName, |
| 125 | + blobData: new Uint8Array(imageBuffer), |
| 126 | +}); |
| 127 | +``` |
| 128 | + |
| 129 | +### **Key Features** |
| 130 | + |
| 131 | +- **Cross-chain wallet support** (Aptos native + Solana + EVM wallets via sponsored transactions) |
| 132 | +- **Metadata co-location** (JSON metadata stored alongside each image) |
| 133 | +- **Gallery view** (All your AI artifacts in one place) |
| 134 | +- **Explorer integration** (Direct links to Shelby blob explorer) |
| 135 | + |
| 136 | +### **What You'll Experience:** |
| 137 | + |
| 138 | +1. **Connect Wallet** - Your Aptos address becomes your AI identity |
| 139 | +2. **Generate Image** - AI creates content using your prompt |
| 140 | +3. **Store on Shelby** - Image + metadata uploaded to decentralized storage |
| 141 | +4. **Verify Provenance** - View your artifacts in Shelby Explorer with full ownership proof |
| 142 | + |
| 143 | +## 🔮 What This Proves About Shelby |
| 144 | + |
| 145 | +| **Capability** | **Demonstrated** | |
| 146 | +| ------------------------------ | ------------------------------------------------------ | |
| 147 | +| **AI Artifact Storage** | ✅ Images stored & served decentralized | |
| 148 | +| **Replaces S3/IPFS for AI** | ✅ Fast reads, permanent storage, verifiable ownership | |
| 149 | +| **Compute-Storage Separation** | ✅ Model runs anywhere, results live on Shelby | |
| 150 | +| **Provenance & Authenticity** | ✅ Each blob cryptographically tied to creator | |
| 151 | +| **Future-Ready Architecture** | ✅ Same pattern works for Shelby-native compute | |
0 commit comments