Not an API. Not an oracle. Not a wrapper. A real neural network, running on-chain, verified by every node.
This has never been done before. Not on Bitcoin. Not on Ethereum. Not on Solana. Not anywhere.
Bob is a degen. Bob lives on Bitcoin. Bob doesn't call ChatGPT. Bob is the AI.
He's a 1-million parameter transformer language model compiled into a single smart contract on OPNet, Bitcoin's Layer 1 smart contract platform. When you talk to Bob, your message goes into a Bitcoin transaction, the neural network runs inside the virtual machine on every node, and Bob's response comes back. Deterministic, verifiable, unstoppable.
Bob was trained on crypto conversations, degen slang, math, and OPNet lore. He's not GPT-4. He's not trying to be. He's a small, fast, opinionated AI that exists entirely on the most secure blockchain in the world. He's the proof that real on-chain AI is possible. Not tomorrow, not with some future L2, but right now, on Bitcoin L1.
Let's be honest. Here's what "AI + crypto" has looked like until now:
- A token with a chatbot on a website
- An oracle posting GPT answers on-chain
- A "decentralized inference network" that's just servers with extra steps
- A governance token for someone else's API
None of that is on-chain AI. That's off-chain AI with a token attached.
The weights are in the bytecode. The matrix multiplications happen in the VM. The tokenizer, the attention mechanism, the sampling, all of it executes on-chain. Every node runs the same forward pass and gets the same answer. You don't trust a server. You verify.
This is the first real case study of decentralized AI.
Not decentralized hosting. Not decentralized fine-tuning. Decentralized intelligence, a neural network whose entire inference is verified by Bitcoin consensus.
That's it. No servers. No APIs. No middlemen. Just math on Bitcoin.
For the builders, researchers, and anyone who wants to understand how you actually fit a transformer into a smart contract.
Inside each transformer layer: RMSNorm → i8 QKV projection (4x unrolled, raw WASM memory loads) → RoPE (precomputed sin/cos) → KV-Cache (right-sized) → multi-head attention → softmax (exp LUT) → output projection + residual → RMSNorm → FFN (128 → 256 → 128, ReLU) + residual.
Smart contracts don't have floating point. MiniBob does everything in integer arithmetic:
| What | Format | How |
|---|---|---|
| Weights | Int8 (8-bit) | Per-matrix abs_max quantization |
| Activations | Q16.16 (32-bit) | 16 integer bits + 16 fractional bits |
| Logits | i32 | Direct matmul output, no i64 intermediary |
| RMSNorm scales | Q8.8 (i16) | Raw load<i16> instead of 2x byte + shift |
| RoPE tables | Q1.15 (i16) | Raw load<i16> precomputed sin/cos |
| Exp / InvSqrt | StaticArray<i32> (256 entries) | Native i32 LUTs, zero runtime parsing |
The int8 quantized model produces identical top-5 predictions to the float32 original.
Without KV-Cache, generating 10 tokens means running the full attention over all previous tokens 10 times. With it, each new token only processes itself against the cache. The cache is right-sized to min(inputLen + maxNewTokens, 512), no wasted memory. Massive gas savings.
The full journey of how Bob's brain gets built and deployed:
Running AI on-chain isn't just "deploy a model." Here's what makes it borderline insane:
MiniBob solves all of them. That's why it took this long. That's why nobody else has done it.
| Parameters | 1,049,728 (~1M) |
| Vocabulary | 4,096 tokens (BPE) |
| Embedding Dim | 128 |
| Layers | 4 transformer blocks |
| Attention Heads | 4 (32-dim each) |
| FFN Hidden Dim | 256 |
| Max Context | 512 tokens |
| Quantization | Int8 weights, Q16.16 fixed-point |
| Output Vocab | 2,048 tokens (dedicated output embedding) |
| WASM Size | ~1.4 MB |
| Personality | Full degen crypto bro |
| Blockchain | Bitcoin L1 via OPNet |
| Trust Assumptions | Zero. Verified by consensus. |
Every gas unit matters when you're running a transformer on-chain. Here's how Bob stays efficient:
Three methods. That's all you need.
Talk to Bob. Send UTF-8 text, get a response.
Input: prompt (bytes) - Your message as UTF-8
maxTokens (u16) - How many tokens Bob should generate (1-512)
contextSize (u16) - Context window (128-512)
Output: response (bytes) - Bob's UTF-8 response
See how Bob breaks text into tokens.
Input: text (bytes) - UTF-8 text
Output: tokenIds (bytes) - Token IDs (u16, big-endian)
Get Bob's brain specs.
Output: vocabSize, embedDim, numLayers, maxSeqLen, paramCount
- Node.js & npm
- Python 3.10+ with PyTorch & CUDA (for training only)
npm install # Install dependencies
npm run build:minibob # Compile the contract to WASM (~1.4 MB)
npm run test # Run all tests# Train from scratch
npm run train:tokenizer # Train the BPE tokenizer
npm run train:model # Train the transformer (GPU required)
# Export & verify
npm run export:weights # Quantize to int8 & generate weight files
npm run verify # Verify int8 matches float inference
# Build & test
npm run build:minibob # Compile to WASM (~1.4 MB)
npm run test # Run all unit tests
# Preview locally
cd training && python3 preview.pyThe box Bob has to fit in:
| Resource | Limit |
|---|---|
| WASM binary (compressed) | 512 KB |
| WASM binary (decompressed) | 1.5 MB |
| Runtime memory | 32 MB |
| Gas per transaction | 150 billion |
| Max context window | 512 tokens |
| Layer | Tech |
|---|---|
| Blockchain | Bitcoin L1 |
| Smart Contracts | OPNet |
| Contract Language | AssemblyScript |
| Compilation | WebAssembly |
| Training | PyTorch (CUDA) |
| Quantization | Custom int8 + Q16.16 |
| Tokenizer | BPE (GPT-2 byte encoding) |
This isn't a whitepaper. This isn't a roadmap. This isn't a promise.
This is a working neural network on Bitcoin. The code is here. The weights are here. The contract compiles, deploys, and generates text, verified by every node in the network.
1 million parameters. 4 transformer layers. Integer-only arithmetic. Zero trust assumptions.
The first real on-chain AI. Built on Bitcoin. His name is Bob.
Bob lives on-chain, but his creators run on caffeine and ramen.
If MiniBob made your jaw drop, consider dropping some sats.
bc1p9q5jk57r2lg2cjnlzcf79te4qtunx4nqn7t69rhrwfhh06hsecfqw55ua4
0xd29ccBFA1E0CB0B3190724100eEcdA5aaC0A4AAA
GEd5iMHy6h8o49KKo3sS6TSdFMiJZuern9E2wWhYudpD
Bob was born on Bitcoin, but he won't judge your chain of choice.
Apache2.0