mirror of
https://github.com/aljazceru/cdk.git
synced 2026-01-03 13:05:19 +01:00
* Add PostgreSQL support for mint and wallet * Fixed bug to avoid empty calls `get_proofs_states` * Fixed SQL bug * Avoid redudant clone() * Add more tests for the storage layer * Minor enhacements * Add a generic function to execute db operations This function would log slow operations and log errors * Provision a postgres db for tests * Update deps for msrv * Add postgres to pipeline * feat: add psgl to example and docker * feat: db url fmt --------- Co-authored-by: thesimplekid <tsk@thesimplekid.com>
CDK Mintd
ALPHA This library is in early development, the API will change and should be used with caution.
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 and PostgreSQL
- Lightning Network Integration: Support for CLN, LND, LNbits, and test backends
- Authentication: Optional user authentication with OpenID Connect
- Management RPC: gRPC interface for mint management
- Docker Support: Ready-to-use Docker configurations
Installation
From crates.io:
cargo install cdk-mintd
From source:
cargo install --path .
Quick Start
Using SQLite (Default)
# Start with SQLite (no additional setup required)
cdk-mintd
Using PostgreSQL
# Set environment variables
export CDK_MINTD_DATABASE=postgres
export CDK_MINTD_DATABASE_URL="postgresql://postgres:password@localhost:5432/cdk_mint"
# Start the mint
cdk-mintd
Using Docker
# SQLite
docker-compose up
# PostgreSQL
docker-compose -f docker-compose.postgres.yaml up
Configuration
The mint can be configured through environment variables or a configuration file. See example.config.toml for all available options.
Database Configuration
SQLite (Default)
[database]
engine = "sqlite"
PostgreSQL
[database]
engine = "postgres"
Set CDK_MINTD_DATABASE_URL environment variable for connection string.
ReDB
[database]
engine = "redb"
Lightning Backend Configuration
[ln]
ln_backend = "fakewallet" # Options: cln, lnd, lnbits, fakewallet
Usage
# Start the mint with default configuration
cdk-mintd
# Start with custom config file
cdk-mintd --config /path/to/config.toml
# Start with specific work directory
cdk-mintd --work-dir /path/to/work/dir
# Show help
cdk-mintd --help
Environment Variables
Key environment variables:
CDK_MINTD_DATABASE: Database engine (sqlite/postgres/redb)CDK_MINTD_DATABASE_URL: PostgreSQL connection stringCDK_MINTD_LN_BACKEND: Lightning backend typeCDK_MINTD_LISTEN_HOST: Host to bind toCDK_MINTD_LISTEN_PORT: Port to bind to
Documentation
License
This project is licensed under the MIT License.