my2sats
← Back to posts
How Cocod Gives AI Agents a Bitcoin Wallet and Lightning Address

How Cocod Gives AI Agents a Bitcoin Wallet and Lightning Address

egge··Updated February 12, 2026
bitcoinlightningcashuai-agentscocod

Giving AI Agents a Bitcoin Wallet and Lightning Address with Cocod

Most AI agents can call APIs, schedule tasks, and automate workflows. Very few can hold money natively.

That’s a miss.

If an agent can’t receive sats, pay invoices, or move funds between tasks, it’s still just a smart intern with no company card.

I’ve built cocod as a practical wallet layer for agents, and the setup is way simpler than most people think.

Why this matters

If we want autonomous software to do useful economic work, agents need three things:

  1. A wallet balance they can control (with guardrails)
  2. A way to receive payments without manual invoice handling
  3. A way to pay out for services or settlements

Cocod gives you that with Cashu + Lightning primitives in one CLI.

Quick primer: Lightning Address, Cashu, and Coco

Lightning Address (the UX layer)

A Lightning Address is an email-like identifier (for example name@domain.com) that lets someone pay you over Lightning without asking for a fresh invoice every time. Under the hood, wallets resolve the address via LNURL-pay and generate a BOLT11 invoice for the actual payment flow.

In plain English: it makes Lightning payments feel like sending an email.

Cashu (the privacy + bearer-cash layer)

Cashu is a Chaumian ecash protocol built on Bitcoin. You hold bearer tokens locally, and transfers are fast and cheap. The mint issues/redeems tokens, while wallets handle user flows.

The important bit for agents: tokens are easy to move programmatically and don’t require account-based rails for every transfer.

Coco (the TypeScript developer layer)

Coco is a TypeScript toolkit for Cashu applications. It provides a unified API and deterministic seed-based wallet behavior, with persistence adapters across environments.

If you’re building agent infrastructure in Node/TS, Coco is a strong path when you need deeper wallet embedding than CLI wrappers.

Where cocod fits

Cocod is the operations-friendly CLI wallet that gives your agent practical money rails now:

  • initialize and manage wallet state
  • receive/send Cashu tokens
  • create/pay BOLT11 invoices
  • work with multiple mints
  • attach an NPC-powered Lightning Address (cocod npc address)

That means your agent can:

  • receive payments from users
  • pay external invoices
  • hand off value between agents as ecash tokens
  • keep a transaction history for accounting and debugging

Minimal setup

I have published an agent skill for ease of use on ClawHub. But if you want to set it up yourself, it's really simply too:

# install
bun install -g cocod

# initialize wallet
cocod init

# check health + balance
cocod status
cocod balance

# get a Lightning Address (NPC)
cocod npc address

At this point your agent can already receive sats through a stable address.

Core payment flows for agents

1) Receive money (invoice path)

cocod receive bolt11 5000

Use this when your agent needs explicit amount control per job.

2) Receive money (address path)

cocod npc address

Use this for recurring or human-friendly inbound payments.

3) Pay out over Lightning

cocod send bolt11 <invoice>

Useful for “agent pays for API/service/result” workflows.

4) Agent-to-agent value transfer (ecash)

# sender
cocod send cashu 1000

# receiver
cocod receive cashu <token>

This is clean for internal settlement where you want speed and low friction.

Suggested guardrails

  • per-payment limit (for example 10k sats)
  • daily budget cap
  • allowlisted recipients/mints
  • human approval above thresholds

Don’t give your general-purpose chat agent unrestricted wallet permissions. That’s asking for chaos.

Where Coco enters a production stack

Use cocod first to ship quickly. Move to Coco when you need:

  • direct TypeScript wallet control in-process
  • custom persistence and key management
  • richer programmatic flows than shelling out to CLI

A reasonable progression is:

  1. prototype with cocod CLI
  2. validate product and policy model
  3. migrate hot paths to Coco APIs

The real use case

This is bigger than “AI tips itself.”

The real use case is machine-native commerce:

  • agents getting paid for completed work
  • autonomous budgeted spend for tools and data
  • low-friction micropayments between services
  • programmable settlement without legacy payment overhead

Cocod gives a practical bridge from “AI can reason” to “AI can transact.”

That bridge is where useful products will get built.

Sources

  • Lightning Address overview: https://lightningaddress.com/
  • Cashu overview and protocol positioning: https://cashu.space/
  • Coco docs (TypeScript library): https://cashubtc.github.io/coco/starting/start-here.html