CDK CLI
Warning This project is in early development, it does however work with real sats! Always use amounts you don't mind losing.
A command-line Cashu wallet implementation built with the Cashu Development Kit (CDK). This tool allows you to interact with Cashu mints from the terminal, performing operations like minting, melting, and transferring ecash tokens.
Features
- Multiple Mint Support: Connect to and manage multiple Cashu mints simultaneously
- Token Operations: Mint, melt, send, and receive Cashu tokens
- Lightning Integration: Pay Lightning invoices (BOLT11, BOLT12, BIP353) and receive payments
- Payment Requests: Create and pay payment requests with various conditions (P2PK, HTLC)
- Token Transfer: Transfer tokens between different mints
- NpubCash Integration: Receive ecash via Nostr public key addresses (npub@npubx.cash)
- Multi-Currency Support: Support for different currency units (sat, usd, eur, etc.)
- Database Options: SQLite or Redb backend with optional encryption (SQLCipher)
- Tor Support: Built-in Tor transport support (when compiled with feature)
- Secure Storage: Local storage of tokens, mint configurations, and seed
Installation
Option 1: Download Pre-built Binary
Download the latest release from the GitHub releases page.
Option 2: Build from Source
# Binary will be at ./target/release/cdk-cli
Build with Optional Features
# Default build (includes npubcash)
# With Tor support
# With SQLCipher encryption
# With Redb database
# Without npubcash (if you want to exclude it)
Quick Start
1. Check Your Balance
# View your current balance across all mints
2. Mint Tokens
# Create and mint tokens from a mint (amount in sats)
# Or with a description
# The command will display a Lightning invoice to pay
# After payment, tokens are automatically minted
3. Send Tokens
# Send tokens (you'll be prompted for amount and mint selection interactively)
# Or specify options directly
4. Receive Tokens
# Receive a token from someone else
# Receive from untrusted mint with transfer to trusted mint
Global Options
The CLI supports several global options that apply to all commands:
# Use a specific database engine
# Set a custom work directory
# Set logging level
# Use a specific currency unit
# Use NIP-98 Wallet Signing Proxy
# Disable Tor (when built with Tor feature, it's on by default)
Commands Reference
Balance Operations
# Check balance across all mints
Minting Tokens
# Mint tokens with a Lightning invoice
# With options
# Using an existing quote
# Claim pending mint quotes that have been paid
Sending & Receiving Tokens
# Send tokens (interactive)
# Send with specific options
# Send with P2PK lock
# Send with HTLC (Hash Time Locked Contract)
# Send as V3 token
# Send with automatic transfer from other mints if needed
# Receive tokens
# Receive with signing key (for P2PK)
# Receive with HTLC preimage
# Receive via Nostr
Lightning Payments
# Pay a Lightning invoice (interactive - will prompt for invoice)
# Specify mint and payment method
# Pay BOLT12 offer
# Pay BIP353 address
# Multi-path payment
Payment Requests
# Create a payment request (interactive via Nostr)
# Create with specific amount
# Create with P2PK condition
# Create with HTLC
# Or use preimage instead
# Create with HTTP transport
# Create without transport (just print the request)
# Pay a payment request
# Decode a payment request
Token Transfer Between Mints
# Transfer tokens between mints (interactive)
# Transfer specific amount
# Transfer full balance from one mint to another
Mint Information & Management
# Get mint information
# Update mint URL (if mint has migrated)
# List proofs from mint
Token & Proof Management
# Decode a Cashu token
# Check pending proofs and reclaim if no longer pending
# Burn spent tokens (cleanup)
# Restore proofs from seed for a specific mint
Advanced Features
Blind Authentication (NUT-14)
# Mint blind authentication proofs
CAT (Cashu Authentication Tokens)
# Login with username/password
# Login with device code flow (OAuth-style)
NpubCash Integration
Note: Requires building with
--features npubcash(enabled by default)
NpubCash allows you to receive ecash payments via a Nostr public key address (npub@npubx.cash). The CLI automatically derives Nostr keys from your wallet seed for authentication.
# Set custom NpubCash server URL (optional, defaults to https://npubx.cash)
Show Your NpubCash Address and Keys
# Display your npub address and authentication keys
# Example output shows:
# - Your public key (npub) and npub.cash address (npub@npubx.cash)
# - Your secret key (keep this safe!)
Sync Quotes from NpubCash
# Fetch all quotes from the NpubCash server and add to wallet
List Quotes
# List all quotes
# List quotes since a specific Unix timestamp
# Output as JSON
Subscribe to Quote Updates
# Monitor for new quotes and automatically mint paid ones
# Subscribe without auto-minting (just display quotes)
The subscribe command:
- Polls the NpubCash server every 5 seconds for new quotes
- Automatically adds quotes to your wallet database
- Optionally auto-mints paid quotes into your wallet
- Press Ctrl+C to stop
Configure Mint URL on Server
# Set which mint URL the NpubCash server should use for your quotes
This tells the NpubCash server which mint to use when creating quotes for payments to your npub address.
Complete NpubCash Workflow Example
# 1. Show your NpubCash address
# Share your npub@npubx.cash address with senders
# 2. Subscribe to incoming payments
# Leave this running to automatically receive and mint payments
# 3. In another terminal, check your balance
# 4. When someone sends sats to your npub address:
# - The subscribe command will show the new quote
# - If paid, tokens are automatically minted
# - Your balance increases
Configuration
Storage Location
The CLI stores its configuration and wallet data in:
- Linux/macOS:
~/.cdk-cli/ - Windows:
%USERPROFILE%\.cdk-cli\
You can override this with the --work-dir option.
Database Options
The CLI supports multiple database backends:
SQLite (default)
SQLCipher (encrypted SQLite)
# Requires building with --features sqlcipher
Redb
# Requires building with --features redb
Seed Management
The wallet seed is automatically generated and stored in <work-dir>/seed on first run. This seed is used to derive all keys and can be used to restore your wallet.
Important: Back up your seed file securely. Anyone with access to the seed can spend your tokens.
Examples
Complete Workflow Example
# 1. Start a test mint (in another terminal)
# 2. Mint some tokens
# Pay the displayed Lightning invoice
# 3. Check balance
# 4. Send some tokens
# Follow interactive prompts
# 5. The recipient can receive with:
# 6. Pay a Lightning invoice
# Follow prompts to enter invoice
Multi-Mint Setup
# Mint from multiple mints
# Check balance (shows breakdown by mint)
# Transfer between mints
Payment Request Workflow
# Recipient creates a payment request
# Copy the payment request string
# Sender pays the request
P2PK (Pay to Public Key) Usage
# Send tokens locked to a public key
# Recipient receives with their private key
HTLC (Hash Time Locked Contract) Usage
# Create a preimage and hash (externally)
# hash = SHA256(preimage)
# Send with HTLC
# Recipient receives with preimage
Help and Documentation
# General help
# Help for specific commands
Troubleshooting
Pending Tokens
If you have pending tokens (sent but not received, or mint quotes paid but not claimed):
# Check and reclaim pending proofs
# Claim paid mint quotes
Cleaning Up
# Remove spent tokens from database
Restore from Seed
# Restore proofs from a specific mint
License
Code is under the MIT License
Contribution
All contributions are welcome.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, shall be licensed as above, without any additional terms or conditions.