Skip to content

Configuration

walletrs is configured entirely through environment variables — there is no config file. This page lists every knob, then drills into the storage-backend variants.

VariableDefaultRequired whenNotes
WALLETRS_HOST127.0.0.1alwaysBind host shared by gRPC + HTTP. Use 0.0.0.0 inside containers.
WALLETRS_PORT50051alwaysgRPC port
WALLETRS_HTTP_PORT8080alwaysHTTP / JSON port
BITCOIN_NETWORKregtestalwaysmainnet / testnet / signet / regtest
ELECTRS_URLtcp://127.0.0.1:60401alwaysElectrum-Rust server URL
WALLETRS_STORAGE_KINDlocalalwayslocal or s3
WALLETRS_STORAGE_PATH./datalocal-onlyFilesystem root for wallet data
WALLETRS_S3_ENDPOINTs3Leave unset for AWS S3, set for R2 / MinIO
WALLETRS_S3_BUCKETs3
WALLETRS_S3_REGIONautos3R2 takes auto; AWS takes the actual region name
WALLETRS_S3_ACCESS_KEY_IDs3
WALLETRS_S3_SECRET_ACCESS_KEYs3
WALLETRS_S3_PREFIXs3Object-key namespace inside the bucket
WALLETRS_S3_FORCE_PATH_STYLEtrues3Required for MinIO; safe for R2
WALLETRS_KEKsystem-keysBase64-encoded 32-byte envelope KEK
WALLETRS_AUTH_TOKENoptionalBearer token for gRPC + HTTP; auto-generated when unset
WALLETRS_AUTH_DISABLED0optionalDisables auth on both surfaces
WALLETRS_SIGVAULT_TOKENBYO walletrsOne-shot pairing token from sigvault — only needed on the first start of a BYO walletrs
WALLETRS_SIGVAULT_ENDPOINThttps://api.sigvault.orgBYO walletrsOverride only when self-hosting sigvault
WALLETRS_SIGVAULT_DISABLED0optionalDisables the sigvault agent even with paired credentials on disk
RUST_LOGinfo,walletrs=debugoptionalStandard env_logger directive

BITCOIN_NETWORK selects the chain walletrs operates on:

  • mainnet (alias: bitcoin) — production. Pair with a real ELECTRS_URL and a hardened deployment.
  • testnet — long-running test chain. Useful when you need the exact mainnet address format with throwaway coins.
  • signet — the modern, controllable test chain. Cleaner reorgs and a more reliable faucet network than testnet.
  • regtest — local development. Pair with a regtest bitcoind and electrs. The bundled Docker Compose stack defaults here.

The descriptor compiler uses the network to pick address prefixes (bcrt1..., tb1..., bc1...).

Two backends ship in-tree; both implement the same StorageBackend trait so the rest of the system doesn’t care.

WALLETRS_STORAGE_KIND=local plus WALLETRS_STORAGE_PATH=/some/dir.

Wallet state, managed keys, and PSBTs all live under that directory. The path is created on first start. Back this directory up — losing it means losing the wallet.

WALLETRS_STORAGE_KIND=s3 plus the WALLETRS_S3_* family. Two reasons to prefer this in production:

  • The R2BackedStore uploads the BDK file_store on every wallet.persist(), so a container can be ephemeral — restart, pull state from object storage, keep going.
  • Encrypted blobs at rest: even if an attacker exfiltrates the bucket, they need WALLETRS_KEK to read system-managed key material.

Cloudflare R2 example:

Terminal window
WALLETRS_STORAGE_KIND=s3
WALLETRS_S3_ENDPOINT=https://<account-id>.r2.cloudflarestorage.com
WALLETRS_S3_BUCKET=walletrs-prod
WALLETRS_S3_REGION=auto
WALLETRS_S3_ACCESS_KEY_ID=...
WALLETRS_S3_SECRET_ACCESS_KEY=...
WALLETRS_S3_PREFIX=mainnet
WALLETRS_S3_FORCE_PATH_STYLE=true

The pinned BehaviorVersion in crates/server/src/storage/s3.rs works around an AWS SDK regression where x-amz-checksum-* headers got added to mutating requests, breaking R2 / MinIO compatibility. Don’t downgrade the AWS SDK without re-validating.

WALLETRS_KEK is a base64-encoded 32-byte key that wraps system-managed private key material. Customer keys (xpub-only) don’t use the KEK.

Generate one with:

Terminal window
openssl rand -base64 32

There is no built-in rotation flow today. The pragmatic procedure:

  1. Stop walletrs.
  2. Decrypt every StoredManagedKey blob with the old KEK (e.g. via a one-off script using crates/server/src/storage/crypto.rs).
  3. Re-encrypt under the new KEK.
  4. Set the new WALLETRS_KEK and start.

If you lose the KEK, system-managed private material is unrecoverable — wallets remain valid for receive-only use, but signing requires re-creating new system keys and migrating funds.

RUST_LOG=info,walletrs=debug is the default. Crank to walletrs=trace for verbose PSBT and BDK logs while debugging signing flows. Output is human-readable env_logger format; structured / JSON logs are on the roadmap.