|
| 1 | +--- |
| 2 | +title: Cashu |
| 3 | +description: Chaumian ecash for Bitcoin |
| 4 | +--- |
| 5 | + |
| 6 | +# Cashu |
| 7 | + |
| 8 | +**Ecash protocol for Bitcoin.** Private, instant, and offline-capable digital cash. |
| 9 | + |
| 10 | +## Overview |
| 11 | + |
| 12 | +Cashu is a free and open-source Chaumian ecash protocol built on Bitcoin. It enables private, instant transactions using blinded tokens that can be sent without revealing sender identity to the mint. |
| 13 | + |
| 14 | +## How It Works |
| 15 | + |
| 16 | +``` |
| 17 | +┌─────────────────────────────────────────────────────────┐ |
| 18 | +│ Cashu Flow │ |
| 19 | +├─────────────────────────────────────────────────────────┤ |
| 20 | +│ │ |
| 21 | +│ 1. Deposit │ |
| 22 | +│ User pays Lightning invoice → Receives tokens │ |
| 23 | +│ │ |
| 24 | +│ 2. Send │ |
| 25 | +│ User A sends tokens to User B (just a string!) │ |
| 26 | +│ Mint doesn't know who sent to whom │ |
| 27 | +│ │ |
| 28 | +│ 3. Receive │ |
| 29 | +│ User B redeems tokens at mint │ |
| 30 | +│ Gets new tokens (breaks linkability) │ |
| 31 | +│ │ |
| 32 | +│ 4. Withdraw │ |
| 33 | +│ User requests Lightning payout │ |
| 34 | +│ Mint pays invoice, burns tokens │ |
| 35 | +│ │ |
| 36 | +└─────────────────────────────────────────────────────────┘ |
| 37 | +``` |
| 38 | + |
| 39 | +## Key Features |
| 40 | + |
| 41 | +### Privacy |
| 42 | + |
| 43 | +``` |
| 44 | +Traditional: |
| 45 | +Alice ──► Bank ──► Bob |
| 46 | +Bank sees: Alice sent $10 to Bob |
| 47 | +
|
| 48 | +Cashu: |
| 49 | +Alice ──► Mint ──► Bob |
| 50 | +Mint sees: Someone deposited, someone withdrew |
| 51 | +Cannot link: Alice to Bob |
| 52 | +``` |
| 53 | + |
| 54 | +Blinded signatures ensure the mint cannot track token flow. |
| 55 | + |
| 56 | +### Instant & Offline |
| 57 | + |
| 58 | +| Feature | Description | |
| 59 | +|---------|-------------| |
| 60 | +| **Instant** | No blockchain confirmation | |
| 61 | +| **Offline** | Send tokens without internet | |
| 62 | +| **Free** | No transaction fees | |
| 63 | + |
| 64 | +Tokens are just strings — send via text, QR, Nostr DM. |
| 65 | + |
| 66 | +### Token Format |
| 67 | + |
| 68 | +``` |
| 69 | +cashuAeyJ0b2tlbiI6W3sicHJvb2ZzIjpbeyJpZCI6IjAwY... |
| 70 | +``` |
| 71 | + |
| 72 | +A Cashu token is a base64-encoded string containing: |
| 73 | +- Mint URL |
| 74 | +- Proofs (blinded signatures) |
| 75 | +- Amount |
| 76 | + |
| 77 | +## Protocol |
| 78 | + |
| 79 | +### Nut Specifications |
| 80 | + |
| 81 | +Cashu is defined by NUTs (Notation, Usage, and Terminology): |
| 82 | + |
| 83 | +| NUT | Feature | |
| 84 | +|-----|---------| |
| 85 | +| NUT-00 | Token format | |
| 86 | +| NUT-01 | Mint public keys | |
| 87 | +| NUT-02 | Keysets | |
| 88 | +| NUT-03 | Swap tokens | |
| 89 | +| NUT-04 | Mint tokens | |
| 90 | +| NUT-05 | Melt tokens | |
| 91 | +| NUT-06 | Mint info | |
| 92 | +| NUT-07 | Token state | |
| 93 | +| NUT-08 | Lightning payments | |
| 94 | + |
| 95 | +### API Endpoints |
| 96 | + |
| 97 | +``` |
| 98 | +POST /v1/mint/quote/bolt11 # Get minting quote |
| 99 | +POST /v1/mint/bolt11 # Mint tokens |
| 100 | +POST /v1/swap # Swap tokens |
| 101 | +POST /v1/melt/quote/bolt11 # Get melting quote |
| 102 | +POST /v1/melt/bolt11 # Melt (withdraw) |
| 103 | +GET /v1/keys # Mint public keys |
| 104 | +GET /v1/info # Mint information |
| 105 | +``` |
| 106 | + |
| 107 | +## Using Cashu |
| 108 | + |
| 109 | +### Wallets |
| 110 | + |
| 111 | +| Wallet | Platform | |
| 112 | +|--------|----------| |
| 113 | +| **Nutstash** | Web | |
| 114 | +| **eNuts** | Mobile | |
| 115 | +| **Minibits** | Mobile | |
| 116 | +| **Cashu.me** | Web | |
| 117 | +| **Nutshell** | CLI | |
| 118 | + |
| 119 | +### Nostr Integration |
| 120 | + |
| 121 | +Cashu works great with Nostr: |
| 122 | +- Send tokens via DMs (NIP-04) |
| 123 | +- Zap alternatives |
| 124 | +- Shopstr payments |
| 125 | +- Ecash tips |
| 126 | + |
| 127 | +## For Developers |
| 128 | + |
| 129 | +### JavaScript |
| 130 | + |
| 131 | +```javascript |
| 132 | +import { CashuMint, CashuWallet } from '@cashu/cashu-ts'; |
| 133 | + |
| 134 | +// Connect to mint |
| 135 | +const mint = new CashuMint('https://mint.example.com'); |
| 136 | +const wallet = new CashuWallet(mint); |
| 137 | + |
| 138 | +// Get minting quote |
| 139 | +const quote = await wallet.getMintQuote(1000); |
| 140 | + |
| 141 | +// After paying Lightning invoice... |
| 142 | +const tokens = await wallet.mintTokens(1000, quote.quote); |
| 143 | + |
| 144 | +// Send tokens (just a string) |
| 145 | +const tokenString = wallet.getEncodedToken(tokens); |
| 146 | + |
| 147 | +// Receive tokens |
| 148 | +const received = await wallet.receive(tokenString); |
| 149 | +``` |
| 150 | + |
| 151 | +### Running a Mint |
| 152 | + |
| 153 | +```bash |
| 154 | +# Using Nutshell |
| 155 | +git clone https://github.com/cashubtc/nutshell.git |
| 156 | +cd nutshell |
| 157 | + |
| 158 | +# Configure |
| 159 | +cp .env.example .env |
| 160 | +# Edit .env with your LN node details |
| 161 | + |
| 162 | +# Run |
| 163 | +docker-compose up |
| 164 | +``` |
| 165 | + |
| 166 | +### Mint Backends |
| 167 | + |
| 168 | +| Backend | Description | |
| 169 | +|---------|-------------| |
| 170 | +| **LND** | Lightning Network Daemon | |
| 171 | +| **CLN** | Core Lightning | |
| 172 | +| **LNbits** | Account system | |
| 173 | + |
| 174 | +## Trust Model |
| 175 | + |
| 176 | +``` |
| 177 | +┌─────────────────────────────────────────────────────────┐ |
| 178 | +│ Trust Model │ |
| 179 | +├─────────────────────────────────────────────────────────┤ |
| 180 | +│ │ |
| 181 | +│ What mint CAN do: │ |
| 182 | +│ ├── Refuse to honor tokens (rug pull) │ |
| 183 | +│ └── Inflate supply (print fake tokens) │ |
| 184 | +│ │ |
| 185 | +│ What mint CANNOT do: │ |
| 186 | +│ ├── See who sent to whom │ |
| 187 | +│ ├── Link deposits to withdrawals │ |
| 188 | +│ └── Censor specific users │ |
| 189 | +│ │ |
| 190 | +│ Mitigations: │ |
| 191 | +│ ├── Use reputable mints │ |
| 192 | +│ ├── Don't hold large balances │ |
| 193 | +│ └── Use multiple mints │ |
| 194 | +│ │ |
| 195 | +└─────────────────────────────────────────────────────────┘ |
| 196 | +``` |
| 197 | + |
| 198 | +## Comparison |
| 199 | + |
| 200 | +| Feature | Cashu | Lightning | On-chain | |
| 201 | +|---------|-------|-----------|----------| |
| 202 | +| Privacy | High | Medium | Low | |
| 203 | +| Speed | Instant | Instant | ~10min | |
| 204 | +| Offline | Yes | No | No | |
| 205 | +| Trust | Mint | Routing | Miners | |
| 206 | +| Fees | None | Small | Variable | |
| 207 | + |
| 208 | +## Use Cases |
| 209 | + |
| 210 | +### Private Payments |
| 211 | + |
| 212 | +Send money without revealing your identity. |
| 213 | + |
| 214 | +### Nostr Tipping |
| 215 | + |
| 216 | +Tip content creators privately via DMs. |
| 217 | + |
| 218 | +### Marketplaces |
| 219 | + |
| 220 | +Shopstr uses Cashu for private commerce. |
| 221 | + |
| 222 | +### Gift Cards |
| 223 | + |
| 224 | +Send digital cash to anyone with a link. |
| 225 | + |
| 226 | +## Links |
| 227 | + |
| 228 | +- **Website:** [cashu.space](https://cashu.space/) |
| 229 | +- **Protocol:** [github.com/cashubtc/nuts](https://github.com/cashubtc/nuts) |
| 230 | +- **Nutshell:** [github.com/cashubtc/nutshell](https://github.com/cashubtc/nutshell) |
| 231 | +- **cashu-ts:** [github.com/cashubtc/cashu-ts](https://github.com/cashubtc/cashu-ts) |
| 232 | + |
| 233 | +## See Also |
| 234 | + |
| 235 | +- [Nostr Protocol](/protocols/nostr) — The protocol |
| 236 | +- [Shopstr](/projects/shopstr) — Marketplace using Cashu |
| 237 | +- [Alby](/projects/alby) — Lightning wallet |
| 238 | +- [Amber](/projects/amber) — Nostr signing |
0 commit comments