Skip to content

Add Cashu ecash support#14

Open
kravens wants to merge 1 commit into
mainfrom
cashu-feature
Open

Add Cashu ecash support#14
kravens wants to merge 1 commit into
mainfrom
cashu-feature

Conversation

@kravens

@kravens kravens commented Jun 21, 2026

Copy link
Copy Markdown
Owner

What changed

Adds optional Cashu ecash support to BitTipBot. Users can mint, send, and redeem bearer ecash tokens backed by an external Cashu mint, alongside the existing LNbits Lightning wallet.

New

  • internal/cashu/ — a minimal mint client (client.go), blinded-message crypto (crypto.go), token serialization (token.go), and shared types (types.go).
  • /cashu command (internal/telegram/cashu.go) with subcommands:
    • mint <amount> [memo] — pay the mint's Lightning invoice to create ecash
    • send <amount> — produce a Cashu token to hand out
    • receive / redeem / claim <token> — swap a token back into the wallet
  • Inline sharing (internal/telegram/cashu_inline.go) — share a claimable Cashu token in a group chat via inline query, with Claim / Cancel buttons.

Wiring

  • cashu config block (enabled, mint_url, unit) with validation in internal/config.go; example in config.yaml.example.
  • CashuClient added to TipBot, constructed only when enabled.
  • Handler + inline callback registration in handler.go, inline-query entry in inline_query.go.
  • Cashu-specific error types in internal/errors/types.go and English strings in translations/en.toml.

Why

Lets the bot custody and transfer value as Chaumian ecash (better privacy, instant offline-style transfers) without replacing the existing Lightning/LNbits flow.

Notes for reviewers

  • Disabled by default. With cashu.enabled: false (the default), no client is constructed and every code path is a no-op — zero impact on existing deployments.
  • Mint URL is normalized (trailing slash trimmed) and unit defaults to sat.
  • go build ./... passes.
  • Only English translations are added; other locales fall back to defaults.
  • The mint client implements the subset of NUTs needed for mint/melt/swap; it has not yet been exercised against every mint implementation — mint.minibits.cash is the example default.

🤖 Generated with Claude Code

Introduce optional Cashu ecash integration so users can mint, send, and
redeem bearer ecash tokens against an external mint, alongside the
existing LNbits Lightning wallet.

- internal/cashu: minimal mint client (NUT-00/03/04/05 style) with
  blinded-message crypto, token (de)serialization, and types
- /cashu command with mint/send/receive(redeem/claim) subcommands
- Inline query support to share claimable Cashu tokens in group chats
  (claim/cancel buttons)
- Config block (cashu.enabled/mint_url/unit) with validation; disabled
  by default and a no-op unless explicitly enabled
- Cashu-specific error types and English translations

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant