Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

CLI configuration and usage

This guide shows the available commands and their configuration options to run with the Miden Faucet CLI.

Available Commands

CommandDescription
initCreate the faucet account and initialize the client
startStart the faucet server
create-api-keyGenerate an API key for authentication
helpShow help information

Configuration Methods

The Miden Faucet can be configured using:

  1. Command-line arguments
  2. Environment variables

Command-Line Arguments

Basic Configuration

miden-faucet init \
  --token-symbol <SYMBOL> \
  --decimals <U8> \
  --max-supply <U64> \
  --node-url <URL> \
  --network <NETWORK>
miden-faucet start \
  --api-url <URL> \
  --frontend-url <URL> \
  --node-url <URL> \
  --network <NETWORK>

init Configuration

Basic Configuration

OptionDescriptionDefaultRequired
--token-symbolSymbol of the new token (e.g. “MIDEN”, “ETH”)-Yes (unless import is set)
--decimalsNumber of decimals of the new token-Yes (unless import is set)
--max-supplyMax supply of the new token (in base units)-Yes (unless import is set)
--importPath to the account file-No
--deployWhether to make an empty transaction to deploy the accountfalseNo
--node-urlMiden node RPC endpoint. If not set, it will be derived from the network-No
--timeoutRPC request timeout5sNo
--networkNetwork configurationlocalhostNo
--storeSQLite store pathfaucet_client_store.sqlite3No

Advanced Configuration

| --remote-tx-prover-url | Remote transaction prover. Only relevant if deploy is set. | - | No |

serve Configuration

Basic Configuration

OptionDescriptionDefaultRequired
--api-bind-urlURL to serve the faucet API-Yes
--api-public-urlPublic URL to access the faucet API. If not set, the bind url will be used.-No
--frontend-urlURL to serve the Frontend API-No
--node-urlMiden node RPC endpoint. If not set, it will be derived from the network-No
--networkNetwork configurationlocalhostNo
--timeoutRPC request timeout5sNo
--max-claimable-amountMax claimable base units per request1000000000No
--storeSQLite store pathfaucet_client_store.sqlite3No
--explorer-urlMidenscan URL-No
--base-amountToken amount (in base units) at which the difficulty of the challenge starts to increase.100000000No

Proof of Work Configuration

OptionDescriptionDefaultRequired
--pow-secretSecret to sign PoW challenges. This should NOT be shared“”No
--pow-baselineBase PoW difficulty (0-32). It’s the starting difficulty when no requests are pending12No
--pow-challenge-lifetimeChallenge validity duration, i.e. how long challenges remain valid. This affects the rate limiting, since it works by rejecting new submissions while the previous submitted challenge is still valid30sNo
--pow-cleanup-intervalCache cleanup interval, i.e. how often expired challenges are removed2sNo
--pow-growth-rateDifficulty growth rate, i.e. how quickly difficulty increases with load.0.1No

Advanced Configuration

OptionDescriptionDefaultRequired
--remote-tx-prover-urlRemote transaction prover-No
--api-keysComma-separated API keys-No
--enable-otelEnable OpenTelemetryfalseNo
--batch-sizeMaximum number of P2ID notes to create per transaction32No

Environment Variables

All configuration options can be set using environment variables:

# Faucet Account Configuration
export MIDEN_FAUCET_IMPORT_ACCOUNT_PATH=faucet.mac
export MIDEN_FAUCET_DEPLOY=
export MIDEN_FAUCET_TOKEN_SYMBOL=
export MIDEN_FAUCET_DECIMALS=
export MIDEN_FAUCET_MAX_SUPPLY=

# Faucet Service Configuration
export MIDEN_FAUCET_FRONTEND_URL=http://localhost:8080
export MIDEN_FAUCET_API_BIND_URL=http://localhost:8000
export MIDEN_FAUCET_API_PUBLIC_URL=http://localhost:8000
export MIDEN_FAUCET_MAX_CLAIMABLE_AMOUNT=1000000000
export MIDEN_FAUCET_ENABLE_OTEL=true
export MIDEN_FAUCET_BASE_AMOUNT=100000000

# Network & Node Configuration
export MIDEN_FAUCET_NODE_URL=https://rpc.testnet.miden.io
export MIDEN_FAUCET_NETWORK=testnet
export MIDEN_FAUCET_TIMEOUT=10s
export MIDEN_FAUCET_EXPLORER_URL=https://testnet.midenscan.com
export MIDEN_FAUCET_ACCOUNT_PATH=./faucet.mac

# Faucet Client Configuration
export MIDEN_FAUCET_STORE=faucet_client_store.sqlite3
export MIDEN_FAUCET_REMOTE_TX_PROVER_URL=https://tx-prover.devnet.miden.io
export MIDEN_FAUCET_BATCH_SIZE=32

# Rate Limiting Configuration
export MIDEN_FAUCET_POW_SECRET=your-secret-here
export MIDEN_FAUCET_POW_BASELINE=12
export MIDEN_FAUCET_POW_CHALLENGE_LIFETIME=30s
export MIDEN_FAUCET_POW_CLEANUP_INTERVAL=2s
export MIDEN_FAUCET_POW_GROWTH_RATE=0.1
export MIDEN_FAUCET_API_KEYS=key1,key2,key3

Network Configurations

Predefined Networks

Localhost

--network localhost
  • Explorer URL: Not available
  • Address Display: mlcl
  • Use Case: Local development

Devnet

--network devnet
  • Explorer URL: Not available
  • Address Display: mdev
  • Use Case: Development testing

Testnet

--network testnet
  • Explorer URL: https://testnet.midenscan.com/
  • Address Display: mtst
  • Use Case: Integration testing

Custom Network

--network custom
  • Explorer URL: Not available
  • Address Display: mcst
  • Use Case: Run your custom network

API Key Configuration

Generate API Keys

miden-faucet create-api-key

This generates an API key that can be used for authentication. It is printed to stdout.

API Key Benefits

  • Rate Limiting: Separate rate limits per API key
  • Access Control: Distribute keys to different users/teams

Store Configuration

SQLite Store

This is the store that is used by the Miden Client to store all the faucet account state. Default is SQLite:

--store ./faucet_client_store.sqlite3.sqlite3

Monitoring Configuration

OpenTelemetry

Enable OpenTelemetry for production monitoring:

--enable-otel

Configuration Example

miden-faucet init \
  --token-symbol MIDEN \
  --decimals 6 \
  --max-supply 100000000000000000 \
  --node-url http://localhost:57291

miden-faucet start \
  --frontend-url http://localhost:8080 \
  --api-url http://localhost:8000 \
  --node-url http://localhost:57291 \
  --network localhost

For detailed options, run miden-faucet [COMMAND] --help.