CDK Payment Processor
The cdk-payment-processor is a Rust crate that provides both a binary and a library for handling payments to and from a cdk mint.
Overview
Library Components
- Payment Processor Server: Handles interaction with payment processor backend implementations
- Client: Used by mintd to query the server for payment information
- Backend Implementations: Supports CLN, LND, and a fake wallet (for testing)
Features
- Modular backend system supporting multiple payment backend implementations
- Extensible design allowing for custom backend implementations
Building from Source
Prerequisites
- Install Nix package manager
- Enter development environment (use
.#regtestfor full stack including CLN/LND):
# or for full stack:
Configuration
The server requires different environment variables depending on your chosen payment backend.
Core Settings
# Choose backend: CLN, LND, or FAKEWALLET
# Server configuration
When mintd connects with a TLS directory, the directory must contain
ca.pem, client.pem, and client.key. The CA certificate verifies the
payment processor, and the client certificate and private key authenticate
mintd to an mTLS-enabled processor. Configured TLS does not fall back to an
unauthenticated client connection when either client identity file is missing.
Mintd can explicitly opt into a plaintext connection with
[grpc_processor].allow_insecure = true, including for a non-loopback address.
This is unsafe on an untrusted network because the connection has no transport
authentication or encryption and can be intercepted or modified. Use plaintext
only on a trusted, isolated network or through a separately authenticated and
encrypted tunnel; prefer mTLS even for internal deployments.
Backend-Specific Configuration
Core Lightning (CLN)
# Path to CLN RPC socket
Lightning Network Daemon (LND)
# LND connection details
Building and Running
Build and run the binary with your chosen backend:
# For CLN backend
# For LND backend
# For fake wallet (testing only)
Development
To implement a new backend:
- Create a new module implementing the payment processor traits
- Add appropriate feature flags
- Update the binary to support the new backend
For library usage examples and API documentation, refer to the crate documentation.