⚠️ BETA SOFTWARE - NOT OFFICIALLY RELEASEDThis project is currently in beta and has not been officially released for production use. APIs, features, and documentation may change without notice. Use at your own risk in production environments.
Advanced wallets are a type of self-custody cryptocurrency wallet that enable passwordless transactions by integrating your own Key Management Service (KMS) or Hardware Security Module (HSM) for user and backup private keys. Advanced wallets enable isolating sensitive key generation and signing operations in a dedicated, self-hosted service within your own secure environment.
Advanced wallets operate in two modes:
- Advanced Wallet Manager Mode - A lightweight, dedicated keygen/signing server with no internet access that handles all sensitive cryptographic operations. Connects exclusively to your KMS/HSM for secure key operations. This mode includes support for wallet recoveries.
- Master Express Mode - An Express application that's the orchestrator between the Advanced Wallet Manager and BitGo APIs. This mode serves as an API gateway with integrated signing capabilities.
Key features include:
- Complete Infrastructure Control - Host and manage all components in your own secure environment.
- KMS/HSM Integration - Bring your own KMS or HSM by implementing the provided KMS API interface specification. Reference implementations available for AWS HSM and Dinamo HSM.
- Network Isolation - Advanced Wallet Manager operates in a completely isolated network segment with no external internet access.
- mTLS Security - Optional mutual TLS with client certificate validation for secure inter-service communications.
- Flexible Configuration - Environment-based setup with file or variable-based certificates.
- Architecture
- Installation
- Quick Start
- Configuration
- Container Deployment
- Docker Compose Deployment
- API Endpoints
- Production Setup
- License
- Advanced Wallet Manager (Port 3080) - An isolated signing server with no internet access that only connects to your KMS API implementation for key operations.
- Master Express (Port 3081) - An API gateway providing end-to-end wallet creation and transaction support, integrating BitGo APIs with secure communication to Advanced Wallet Manager.
- Node.js 22.1.0 or higher.
- npm or yarn package manager.
- OpenSSL for certificate generation.
- Docker and Docker Compose for containerized deployment (or you can use Podman as alternative to Docker).
- KMS API Implementation - You must implement the KMS API interface specification to connect your KMS/HSM to the Advanced Wallet Manager. Reference implementations available:
git clone <repository-url>
cd advanced-walletsnpm installnpm run build# Generate private key and certificate for testing
openssl genrsa -out demo.key 2048
openssl req -new -x509 -key demo.key -out demo.crt -days 365 -subj "/CN=localhost"For local development, you can use nodemon for automatic restarts:
# Install nodemon globally (if not already installed)
npm install -g nodemon
# Start in development mode
npm startFor containerized deployment, build the Docker images:
# Build Master Express (default port 3081)
npm run container:build:master-bitgo-express
# Build Advanced Wallet Manager (port 3080)
npm run container:build:advanced-wallet-managerFor quick testing without mTLS security, you can disable TLS entirely. This is useful for local development and testing.
TLS_MODE=disabled \
BITGO_ENV=test \
APP_MODE=advanced-wallet-manager \
ADVANCED_WALLET_MANAGER_PORT=3080 \
KMS_URL=http://localhost:3000 \
npm startRun the following in a new terminal:
TLS_MODE=disabled \
BITGO_ENV=test \
APP_MODE=master-express \
MASTER_EXPRESS_PORT=3081 \
ADVANCED_WALLET_MANAGER_URL=http://localhost:3080 \
npm start# Test Advanced Wallet Manager
curl -X POST http://localhost:3080/ping
# Test Master Express
curl -X POST http://localhost:3081/ping
# Test connection between services
curl -X POST http://localhost:3081/ping/advancedWalletManagerNote: You should only use
TLS_MODE=disabledfor local development and testing. Always use mTLS in production environments. For information about configuring mTLS in production, see the Production Setup section.
| Variable | Description | Default | Required |
|---|---|---|---|
APP_MODE |
Application mode | - | âś… advanced-wallet-manager or master-express |
BIND |
Address to bind to | localhost |
❌ |
TIMEOUT |
Request timeout (ms) | 305000 |
❌ |
NODE_ENV |
Node environment | development |
❌ |
LOG_LEVEL |
Log level | info |
❌ |
| Variable | Description | Default | Required |
|---|---|---|---|
ADVANCED_WALLET_MANAGER_PORT |
Port to listen on | 3080 |
❌ |
KMS_URL |
URL to your KMS API implementation | - | âś… |
Note: The
KMS_URLpoints to your implementation of the KMS API interface. You must implement this interface to connect your KMS/HSM. See Prerequisites for the specification and examples.
| Variable | Description | Default | Required |
|---|---|---|---|
MASTER_EXPRESS_PORT |
Port to listen on | 3081 |
❌ |
BITGO_ENV |
BitGo environment (prod, test, staging, dev, local) |
test |
❌ |
ADVANCED_WALLET_MANAGER_URL |
Advanced Wallet Manager URL | - | âś… |
BITGO_CUSTOM_ROOT_URI |
Custom BitGo API root URI (overrides BITGO_ENV) |
- | ❌ |
BITGO_DISABLE_ENV_CHECK |
Disable environment check | true |
❌ |
BITGO_AUTH_VERSION |
BitGo authentication version | 2 |
❌ |
BITGO_CUSTOM_BITCOIN_NETWORK |
Custom Bitcoin network | - | ❌ |
| Variable | Description | Default | Applies To |
|---|---|---|---|
RECOVERY_MODE |
Enable recovery mode for wallet recovery operations | false |
Both |
HTTP_LOGFILE |
Path to HTTP access log file | logs/http-access.log |
Both |
KEEP_ALIVE_TIMEOUT |
Keep-alive timeout in milliseconds | - | Both |
HEADERS_TIMEOUT |
Headers timeout in milliseconds | - | Both |
IPC |
IPC socket path (alternative to TCP port binding) | - | Both |
| Variable | Description | Default |
|---|---|---|
TLS_MODE |
TLS mode (mtls or disabled) |
mtls |
CLIENT_CERT_ALLOW_SELF_SIGNED |
Allow self-signed client certificates | false |
| Variable | Description | Format |
|---|---|---|
SERVER_TLS_KEY_PATH |
Server private key file path | File path |
SERVER_TLS_CERT_PATH |
Server certificate file path | File path |
SERVER_TLS_KEY |
Server private key (alternative) | PEM string |
SERVER_TLS_CERT |
Server certificate (alternative) | PEM string |
| Variable | Description | Format |
|---|---|---|
MTLS_ALLOWED_CLIENT_FINGERPRINTS |
Allowed client certificate fingerprints | Comma-separated list |
For Master Express → Advanced Wallet Manager:
| Variable | Description | Format |
|---|---|---|
AWM_CLIENT_TLS_KEY_PATH |
Client private key file path | File path |
AWM_CLIENT_TLS_KEY |
Client private key (alternative) | PEM string |
AWM_CLIENT_TLS_CERT_PATH |
Client certificate file path | File path |
AWM_CLIENT_TLS_CERT |
Client certificate (alternative) | PEM string |
AWM_SERVER_CA_CERT_PATH |
AWM server CA certificate file path | File path |
AWM_SERVER_CA_CERT |
AWM server CA certificate (alternative) | PEM string |
AWM_SERVER_CERT_ALLOW_SELF_SIGNED |
Allow self-signed AWM server certificates | Boolean (default: false) |
For Advanced Wallet Manager → KMS:
| Variable | Description | Format |
|---|---|---|
KMS_CLIENT_TLS_KEY_PATH |
Client private key file path | File path |
KMS_CLIENT_TLS_KEY |
Client private key (alternative) | PEM string |
KMS_CLIENT_TLS_CERT_PATH |
Client certificate file path | File path |
KMS_CLIENT_TLS_CERT |
Client certificate (alternative) | PEM string |
KMS_SERVER_CA_CERT_PATH |
KMS server CA certificate file path | File path |
KMS_SERVER_CA_CERT |
KMS server CA certificate (alternative) | PEM string |
KMS_SERVER_CERT_ALLOW_SELF_SIGNED |
Allow self-signed KMS server certificates | Boolean (default: false) |
Note: For security reasons, when
TLS_MODE=mtls, outbound client certificates are required and cannot reuse server certificates. WhenTLS_MODE=disabled, these certificates aren't required.
# For Master Express (default port 3081)
npm run container:build:master-bitgo-express
# For Advanced Wallet Manager (default port 3080)
npm run container:build:advanced-wallet-manager
# Or specify custom ports
npm run container:build:master-bitgo-express -- --build-arg PORT=3081
npm run container:build:advanced-wallet-manager -- --build-arg PORT=3082For local development, you must run both the Advanced Wallet Manager and the Master Express containers:
# Start Advanced Wallet Manager container
podman run -d \
-p 3080:3080 \
-v $(pwd)/certs:/app/certs:Z \
-e APP_MODE=advanced-wallet-manager \
-e BIND=0.0.0.0 \
-e TLS_MODE=mtls \
-e SERVER_TLS_KEY_PATH=/app/certs/advanced-wallet-manager-key.pem \
-e SERVER_TLS_CERT_PATH=/app/certs/advanced-wallet-manager-cert.pem \
-e KMS_URL=host.containers.internal:3000 \
-e NODE_ENV=development \
-e CLIENT_CERT_ALLOW_SELF_SIGNED=true \
advanced-wallet-manager
# View logs
podman logs -f <container_id>
# Test the endpoint (note: using https)
curl -k -X POST https://localhost:3080/ping
# Start Master Express container
podman run -d \
-p 3081:3081 \
-v $(pwd)/certs:/app/certs:Z \
-e APP_MODE=master-express \
-e BIND=0.0.0.0 \
-e TLS_MODE=mtls \
-e SERVER_TLS_KEY_PATH=/app/certs/test-ssl-key.pem \
-e SERVER_TLS_CERT_PATH=/app/certs/test-ssl-cert.pem \
-e ADVANCED_WALLET_MANAGER_URL=https://host.containers.internal:3080 \
-e AWM_SERVER_CA_CERT_PATH=/app/certs/advanced-wallet-manager-cert.pem \
-e CLIENT_CERT_ALLOW_SELF_SIGNED=true \
master-bitgo-express
# View logs
podman logs -f <container_id>
# Test the endpoints (note: using https and mTLS)
# For Advanced Wallet Manager
curl -k --cert certs/test-ssl-cert.pem --key certs/advanced-wallet-manager-key.pem -X POST https://localhost:3080/ping
# For Master Express
curl -k --cert certs/test-ssl-cert.pem --key certs/test-ssl-key.pem -X POST https://localhost:3081/ping
# Test the connection
curl -k -X POST https://localhost:3081/ping/advancedWalletManagerNote:
host.containers.internalis a special DNS name that resolves to the host machine from inside containers.- The
:Zoption in volume mounts is specific to SELinux-enabled systems and ensures proper volume labeling.- The logs directory is created with appropriate permissions if it doesn't already exist.
The application includes a Docker Compose configuration that runs both Advanced Wallet Manager (AWM) and Master BitGo Express (MBE) services with proper network isolation for enhanced security.
The Docker Compose setup creates two isolated services:
- Advanced Wallet Manager (AWM): Runs in an isolated internal network with no external access for maximum security.
- Master BitGo Express (MBE): Connects to both internal network (for AWM communication) and public network (for external API access).
- Network Isolation: AWM is completely isolated from external networks and only accessible through MBE.
The setup creates two distinct networks:
-
my-internal-network:
- Internal bridge network with
internal: true - Used for secure AWM isolation and MBE-to-AWM communication
- No external internet access for security
- Internal bridge network with
-
my-public-network:
- Public bridge network
- Used for external access to MBE APIs
- Connected to host networking
- Install Docker and Docker Compose
- Ensure your KMS API implementation is running on your host machine (typically on port 3000)
# Navigate to project directory
cd advanced-wallet
# Start both services in background
docker-compose up -d# Stop and remove containers
docker-compose downPOST /ping- Health check.GET /version- Version information.POST /:coin/key/independent- Generate independent keychain.
POST /ping- Health check.GET /version- Version information.POST /ping/advancedWalletManager- Test connection to Advanced Wallet Manager.POST /api/:coin/wallet/generate- Generate wallet (with Advanced Wallet Manager integration).
Master Express OpenAPI Specification
You can vew the OpenAPI specification for Master Express at masterBitgoExpress.json.
To regenerate the API documentation:
npm run generate:openapi:masterExpressThis generates or updates the masterBitgoExpress.json file with the latest API specification. You can view this file with any OpenAPI viewer such as:
- Swagger Editor
- Redoc
- VS Code OpenAPI extensions
For production deployments with proper mTLS security:
export APP_MODE=advanced-wallet-manager
export TLS_MODE=mtls
export ADVANCED_WALLET_MANAGER_PORT=3080
export KMS_URL=https://production-kms.example.com:3000
# Server certificates for incoming mTLS connections
export SERVER_TLS_KEY_PATH=/secure/certs/awm-server.key
export SERVER_TLS_CERT_PATH=/secure/certs/awm-server.crt
# Client certificates for outbound connections to KMS
export KMS_CLIENT_TLS_KEY_PATH=/secure/certs/awm-kms-client.key
export KMS_CLIENT_TLS_CERT_PATH=/secure/certs/awm-kms-client.crt
export KMS_SERVER_CA_CERT_PATH=/secure/certs/kms-ca.crt
# Security settings - production-grade
export CLIENT_CERT_ALLOW_SELF_SIGNED=false
export KMS_SERVER_CERT_ALLOW_SELF_SIGNED=false
export MTLS_ALLOWED_CLIENT_FINGERPRINTS=sha256:1a2b3c...,sha256:4d5e6f...
export BITGO_ENV=prod
npm startRun the following in a new terminal:
export APP_MODE=master-express
export TLS_MODE=mtls
export MASTER_EXPRESS_PORT=3081
export BITGO_ENV=prod
export ADVANCED_WALLET_MANAGER_URL=https://awm.internal.example.com:3080
# Server certificates for incoming mTLS connections
export SERVER_TLS_KEY_PATH=/secure/certs/mbe-server.key
export SERVER_TLS_CERT_PATH=/secure/certs/mbe-server.crt
# Client certificates for outbound connections to AWM
export AWM_CLIENT_TLS_KEY_PATH=/secure/certs/mbe-awm-client.key
export AWM_CLIENT_TLS_CERT_PATH=/secure/certs/mbe-awm-client.crt
export AWM_SERVER_CA_CERT_PATH=/secure/certs/awm-ca.crt
# Security settings - production-grade
export CLIENT_CERT_ALLOW_SELF_SIGNED=false
export AWM_SERVER_CERT_ALLOW_SELF_SIGNED=false
export MTLS_ALLOWED_CLIENT_FINGERPRINTS=sha256:7g8h9i...,sha256:0j1k2l...
npm startFor testing, you can use the IP address of the server or localhost if you're running it locally. In production deployments, configure your DNS or load balancer to point to the appropriate servers.
# Test Advanced Wallet Manager (replace localhost with your server IP/hostname)
curl --cert /path/to/client-cert.crt --key /path/to/client-key.key \
--cacert /secure/certs/awm-ca.crt \
https://localhost:3080/ping
# Test Master Express (replace localhost with your server IP/hostname)
curl --cert /path/to/client-cert.crt --key /path/to/client-key.key \
--cacert /secure/certs/mbe-ca.crt \
https://localhost:3081/ping
# Test connection between services
curl --cert /path/to/client-cert.crt --key /path/to/client-key.key \
--cacert /secure/certs/mbe-ca.crt \
https://localhost:3081/ping/advancedWalletManagerTesting with Demo Certificates:
For local testing, you can generate and use demo certificates with the self-signed configuration flags:
- Generate demo certificates:
npm run generate-test-ssl(createsdemo.keyanddemo.crt). - Set
CLIENT_CERT_ALLOW_SELF_SIGNED=true,KMS_SERVER_CERT_ALLOW_SELF_SIGNED=true, andAWM_SERVER_CERT_ALLOW_SELF_SIGNED=true. - Use the demo certificates for all certificate paths (server and client).
- Important: Demo certificates and self-signed configurations should never be used in production.
- Use CA-signed certificates instead of self-signed.
- Set
CLIENT_CERT_ALLOW_SELF_SIGNED=falseand server-specific allow self-signed flags tofalsein production. - Configure client certificate allowlisting with
MTLS_ALLOWED_CLIENT_FINGERPRINTS. - Use separate certificates for each service (server, AWM client, KMS client).
- Regularly rotate certificates.
- Secure private key storage and use appropriate file permissions.
- Always use
TLS_MODE=mtlsin production environments.
To obtain certificate fingerprints for MTLS_ALLOWED_CLIENT_FINGERPRINTS:
openssl x509 -in /path/to/client-cert.crt -noout -fingerprint -sha256 | cut -d'=' -f2The output format is: sha256:AB:CD:EF:... which you can use in the configuration.
- All certificates should be CA-signed certificates issued by your organization's PKI.
- Each service must use separate certificates (server cert, AWM client cert, KMS client cert).
- Client certificates for outbound connections must be different from server certificates.
- Store private keys in secure locations with restricted file permissions:
chmod 400 /secure/certs/*.key chown root:root /secure/certs/*.key
- Use
BIND=0.0.0.0only if the service needs to be accessible from other machines. - Regularly rotate certificates according to your security policy.
Apache License 2.0 - see LICENSE file for details.
Copyright 2025 BitGo