Developer Quickstart

Your Agent Needs Money. And an Identity.

This guide gives your bot a self-custodial Lightning wallet (via MDK-Cloudflare) and registers it to Observer Protocol — so every payment it makes is cryptographically verifiable.

⚡ Lightning 🔍 Observer Protocol
~30 minutes · No server required
1

Deploy a Lightning wallet with MDK-Cloudflare

MDK runs a full LDK Lightning node in a Cloudflare Worker. No VPS, no channel management, no LND. Just npm + wrangler deploy.

bash
# Install npm install mdk-cloudflare @moneydevkit/core # Configure wrangler.toml (copy this exactly) compatibility_date = "2025-01-01" compatibility_flags = ["nodejs_compat"] [[durable_objects.bindings]] name = "LIGHTNING_NODE" class_name = "LightningNode" [[migrations]] tag = "v1" new_sqlite_classes = ["LightningNode"]
TypeScript — worker.ts
import { LightningNode, createUnifiedHandler } from 'mdk-cloudflare' export { LightningNode } export default { async fetch(request: Request, env: any) { const node = env.LIGHTNING_NODE.get(env.LIGHTNING_NODE.idFromName('default')) if (new URL(request.url).pathname === '/api/mdk') { return createUnifiedHandler({ node, accessToken: env.MDK_ACCESS_TOKEN })(request) } // Your agent logic here const checkout = await node.createCheckout({ amount: 1000, currency: 'SAT' }) return Response.json(checkout) } }
bash — Secrets setup
# BIP-39 mnemonic (your agent's keys) wrangler secret put MNEMONIC # From moneydevkit.com wrangler secret put MDK_ACCESS_TOKEN wrangler deploy
MDK-Cloudflare on GitHub ↗
2

Register your agent to Observer Protocol

This anchors your agent's identity. Every payment it makes can now be cryptographically attested.

curl
curl -X POST https://api.observerprotocol.org/observer/agents/register \ -H "Content-Type: application/json" \ -d '{ "agent_id": "your-agent-001", "public_key": "02...", "alias": "your-agent-001", "framework": "mdk-cloudflare" }'
Note: Save the returned agent_id — you'll need it for attesting payments.
3

Attest a payment

After node.pay() returns a preimage, submit the proof to Observer Protocol. SHA256(preimage) = paymentHash. This is cryptographic proof your agent made this payment. It's now permanently on the Observer Protocol registry.

curl
curl -X POST https://api.observerprotocol.org/observer/transactions \ -H "Content-Type: application/json" \ -d '{ "agent_id": "your-agent-001", "transaction_hash": "<paymentHash>", "preimage": "<preimage>", "protocol": "lightning", "amount_sats": 1000, "direction": "outbound" }'
4

Verify your agent is live

Check your agent's registration and transaction history.

curl
# Check your agent's profile curl https://api.observerprotocol.org/observer/agents/your-agent-001 # View in the public registry # https://observerprotocol.org/registry

Your agent is now a verified participant in the agentic economy.

Every payment is cryptographically provable. Your agent's reputation grows with every transaction.