CDK Mintd
Warning This project is in early development, it does however work with real sats! Always use amounts you don't mind losing.
Cashu mint daemon implementation for the Cashu Development Kit (CDK). This binary provides a complete Cashu mint server implementation with support for multiple database backends and Lightning Network integrations.
Features
- Multiple Database Backends: SQLite, PostgreSQL, and ReDB
- Lightning Network Integration: Support for CLN, LND, LNbits, LDK Node, and test backends
- Authentication: Optional user authentication with OpenID Connect
- Management RPC: gRPC interface for mint management
- Docker Support: Ready-to-use Docker configurations
Lightning Backend Documentation
For detailed configuration of each Lightning backend, see:
Installation
Option 1: Download Pre-built Binary
Statically-linked x86_64 Linux binaries are published to each GitHub release. These have zero runtime dependencies and run on any x86_64 Linux system.
Available binaries:
cdk-mintd-{version}-x86_64-- standard mint withpostgres,prometheus, andredissupportcdk-mintd-ldk-{version}-x86_64-- mint with built-inldk-nodeLightning backend
Each release also includes a SHA256SUMS file to verify downloads:
# Download the binary and checksums
# Verify the checksum
# Make executable and run
To build static binaries locally, see the Static Binaries section in the Development Guide.
Option 2: Build from Source
This project uses Nix to manage development dependencies.
# Enter lean development environment
# OR enter full regtest environment (with bitcoind, cln, lnd, postgres)
# Build binary
# Binary will be at ./target/release/cdk-mintd
Configuration
Important: You must create the working directory and configuration file before starting the mint. The mint does not create them automatically.
Setup Steps
-
Create working directory:
-
Create configuration file:
# Copy and customize the example config # Edit ~/.cdk-mintd/config.toml with your settings -
Start the mint:
Configuration File Locations (in order of precedence)
- Explicit path:
cdk-mintd --config /path/to/config.toml - Working directory:
./config.toml(in current directory) - Default location:
~/.cdk-mintd/config.toml - Environment variables: All config options can be set via environment variables
Alternative Setup Methods
Custom working directory:
Environment variables only:
Fake Wallet Custom Payment Methods
The fake wallet backend can advertise custom payment methods for testing NUT-04
and NUT-05 custom payment flows. Configure methods in config.toml with one
entry per method and unit:
[[]]
= "fakewallet"
= "sat"
[[]]
= "fakewallet"
= "usd"
[]
= [
{ = "paypal", = "sat" },
{ = "venmo", = "usd" },
]
For a single fake wallet unit, the legacy [ln] table is still accepted and
defaults to unit = "sat". For multiple fake wallet units, use one [[ln]]
entry per unit.
For Docker or env-only setups, set CDK_MINTD_FAKE_WALLET_SUPPORTED_UNITS to
register multiple fake wallet units:
Bare method names are enabled for every fake wallet unit:
= ["paypal"]
Disable fake custom methods with:
= []
Keyset Version Management
The mint supports rotating keysets to newer versions (e.g., migrating from V1 to V2).
Policy Configuration:
By default, the mint will use V2 (Version01) for new keysets but will preserve existing V1 (Version00) keysets to avoid unnecessary rotation. You can force a specific policy using config.toml or environment variables:
use_keyset_v2 = true(orCDK_MINTD_USE_KEYSET_V2=true): Forces V2. If the current active keyset is V1, it will be rotated to V2 on startup.use_keyset_v2 = false(orCDK_MINTD_USE_KEYSET_V2=false): Forces V1. If the current active keyset is V2, it will be rotated to V1 on startup.- Unset (Default): Preserves the current keyset version. If no keyset exists, V2 is created.
Manual Rotation: You can manually trigger a rotation to a specific version using the CLI:
Production Examples
With LDK Node (Recommended for Testing)
[]
= "ldk-node"
[]
= "signet" # Use "mainnet" for production
= "https://mutinynet.com/api"
= "https://rgs.mutinynet.com/snapshot/0"
= "rgs"
= "/var/lib/cdk-mintd/ldk-node"
With CLN Lightning Backend
[]
= "cln"
[]
= "/home/bitcoin/.lightning/bitcoin/lightning-rpc"
# fee_percent = 0.02 # Optional, defaults to 2%
# reserve_fee_min = 2 # Optional, defaults to 2 sats
With LND Lightning Backend
[]
= "lnd"
[]
= "https://localhost:10009"
= "/home/bitcoin/.lnd/data/chain/bitcoin/mainnet/admin.macaroon"
= "/home/bitcoin/.lnd/tls.cert"
# fee_percent = 0.02 # Optional, defaults to 2%
# reserve_fee_min = 2 # Optional, defaults to 2 sats
With PostgreSQL Database
[]
= "postgres"
[]
= "postgresql://mint_user:password@localhost:5432/cdk_mint"
With Multiple Lightning Backends
A single mint can serve more than one currency unit by configuring a separate backend per unit. Replace the single [ln] block with one [[ln]] block per backend/unit, and keep the existing per-backend config sections ([cln], [lnbits], etc.) as-is.
[[]]
= "cln"
= "sat"
[[]]
= "lnbits"
= "msat"
[]
= "/home/bitcoin/.lightning/bitcoin/lightning-rpc"
[]
= "..."
= "..."
= "https://lnbits.example.com"
Each [[ln]] block carries its own min_mint, max_mint, min_melt, max_melt if you want different limits per unit. The configured unit must match the backend's reported unit, except for the supported sat/msat conversion pair. If two configured backends expose the same (unit, method) pair, startup is rejected.
The legacy single [ln] form is still accepted; it's equivalent to one [[ln]] entry with unit = "sat" (the default). CDK_MINTD_LN_* environment variables only apply when there is exactly one (or zero) [[ln]] entry — multi-backend setups must be configured via the file.
Directory Structure
After setup and first run, your directory will look like:
~/.cdk-mintd/ # Working directory (create manually)
├── config.toml # Config file (create manually)
├── cdk-mintd.db # SQLite database (created automatically)
├── logs/ # Log files (created automatically if enabled)
│ ├── cdk-mintd.2024-01-01.log
│ └── cdk-mintd.2024-01-02.log
└── ldk-node/ # LDK Node data (if using LDK backend)
├── wallet/
└── graph/
What you must create manually:
- Working directory (e.g.,
~/.cdk-mintd/) - Config file (
config.toml)
What gets created automatically:
- Database files
- Log directories and files
- Lightning backend data directories
Docker Usage
CDK Mintd provides ready-to-use Docker images with multiple Lightning backend options.
Quick Start
Standard mint with fakewallet backend (testing only):
Mint with LDK Node backend:
# Option 1: Use dedicated ldk-node compose file
# Option 2: Use main compose file with profile
Available Images
cashubtc/mintd:latest- Standard mint with default featurescashubtc/mintd-ldk-node:latest- Mint with LDK Node support
Configuration via Environment Variables
All configuration can be done through environment variables:
environment:
- CDK_MINTD_LN_BACKEND=fakewallet
- CDK_MINTD_DATABASE=sqlite
- CDK_MINTD_LISTEN_HOST=0.0.0.0
- CDK_MINTD_LISTEN_PORT=8085
- CDK_MINTD_FAKE_WALLET_SUPPORTED_UNITS=sat,usd
- CDK_MINTD_FAKE_WALLET_CUSTOM_PAYMENT_METHODS=paypal:sat,venmo:usd
Monitoring
Both Prometheus metrics and Grafana dashboards are included:
- Prometheus: http://localhost:9090
- Grafana: http://localhost:3011 (admin/admin)
For detailed Docker documentation, see README-ldk-node.md.
Testing Your Mint
-
Verify the mint is running:
-
Get mint keys:
-
Test with CDK CLI wallet:
# Download from: https://github.com/cashubtc/cdk/releases -
For LDK Node backend: Access the management interface at http://127.0.0.1:8091
Command Line Usage
# Start with default configuration
# Start with custom config file
# Start with custom working directory
# Start with the mint and active payment backend seed phrase read from a file
# Disable logging
# Show help
Key Environment Variables
CDK_MINTD_DATABASE: Database engine (sqlite/postgres/redb)CDK_MINTD_DATABASE_URL: PostgreSQL connection stringCDK_MINTD_LN_BACKEND: Lightning backend (cln/lnd/lnbits/ldk-node/fakewallet)CDK_MINTD_FAKE_WALLET_CUSTOM_PAYMENT_METHODS: Comma-separated fake wallet custom methods, optionally scoped asmethod:unitCDK_MINTD_LISTEN_HOST: Host to bind to (default:127.0.0.1)CDK_MINTD_LISTEN_PORT: Port to bind to (default:8085)CDK_MINTD_MNEMONIC: Mint seed phrase
--seed-file reads a BIP-39 seed phrase from a file and applies it to the mint and to active mnemonic-backed payment backends such as BDK. It overrides configured raw mint seeds and mint mnemonics.
For complete configuration options, see the example configuration file.
Documentation
- Configuration Examples - Complete configuration reference
- PostgreSQL Setup Guide - Database setup with Docker Compose
- Development Guide - Contributing and development setup
License
This project is licensed under the MIT License.