Skip to content

Configuration

Comet Engine is configured via environment variables (with .env support for local development).

Core

VariableDefaultDescription
PORT8100HTTP listen port
MONGO_URImongodb://localhost:27017MongoDB connection string
MONGO_DBcomet_engineMongoDB database name

Authentication

VariableDefaultDescription
SERVICE_TOKENS(empty)Comma-separated allowlist of X-Service-Token values
WALLET_ENCRYPTION_KEY(empty)CRITICAL — Master secret for AES-GCM sealing of user EVM private keys. Losing this loses every wallet.

Chain Configuration

Assets are auto-discovered from env vars using the pattern {CHAIN}_{SYMBOL}_CONTRACT.

Per-Chain Variables

VariableRequiredDescription
{CHAIN}_RPC_URLYesJSON-RPC endpoint
{CHAIN}_CHAIN_IDYesEVM chain ID
{CHAIN}_RELAYER_PRIVATE_KEYYesPlatform relayer private key (hex)
{CHAIN}_UNISWAP_FACTORYNoUniswapV2Factory address
{CHAIN}_UNISWAP_ROUTERNoUniswapV2Router02 address
{CHAIN}_{SYMBOL}_CONTRACTNoERC-20 contract address
{CHAIN}_{SYMBOL}_TYPENoAsset type (utility, stablecoin, airtime)
{CHAIN}_{SYMBOL}_BACKINGNoBacking type (none, fiat-reserve, airtime)

Adding a New Asset

Deploy the contract and set the env var. No code changes needed:

env
CELO_MYTOKEN_CONTRACT=0x...
CELO_MYTOKEN_DECIMALS=18

Adding a New Chain

env
CUSTOM_CHAINS=base
BASE_RPC_URL=https://mainnet.base.org
BASE_CHAIN_ID=8453
BASE_RELAYER_PRIVATE_KEY=0x...

Chain Selection

Select chain via ?chain= query parameter. Defaults to the first configured chain (typically celo).

POST /api/v1/assets/USDT/mint?chain=celo
POST /api/v1/assets/USDT/mint?chain=base

Stellar Chain

Set STELLAR_RELAYER_SEED to enable a separate, non-EVM wallet family (see Wallets API →). Absent this variable, chain=stellar requests return 400 chain "stellar" not configured — every other chain and endpoint is unaffected.

VariableDefaultDescription
STELLAR_RELAYER_SEED(empty)Required to enable Stellar. Secret seed (S...) of the relayer/issuer account — pays fees, funds every new user wallet on creation, and in phase 1 issues assets registered on this chain. This account must already be funded on-chain before Stellar wallets will work — an unfunded relayer fails wallet creation with stellar: relayer account ... is not funded.
STELLAR_HORIZON_URLhttps://horizon-testnet.stellar.orgHorizon API endpoint
STELLAR_NETWORK_PASSPHRASETest SDF Network ; September 2015Network passphrase (use the mainnet phrase in production)
STELLAR_BLOCK_EXPLORERhttps://stellar.expert/explorer/testnetExplorer base URL used in responses/UIs

Stellar assets are auto-discovered the same way EVM assets are, using the STELLAR_{SYMBOL}_CONTRACT-style pattern (asset issuer address, not a contract address).

Full setup walkthrough (generating and funding the relayer keypair) is in Setting Up Stellar →.

Every functionality this touches

Once configured, ?chain=stellar (or "chain": "stellar") works on: Create/Get Wallet, Wallet Balance, Token Balance, Mint, Send, Burn (Holder), and Register/Deregister Asset. It does not apply to Approve or Burn (Relayer) — Stellar has no allowance concept, both return 501 — or to AMM swaps/pools, which are Celo/Uniswap-specific and have no chain parameter at all.

PSP / Mobile Money Top-up

Set these to enable the PSP top-up admin endpoints (POST /api/v1/admin/topup/stk-push, /api/v1/admin/topup/transfer) and their callback receiver. Absent PSP_API_KEY/PSP_API_SECRET, those endpoints return 503 PSP integration not configured.

VariableDefaultDescription
PSP_BASE_URLhttps://payments.mamlakapsp.comPSP API base URL
PSP_MERCHANT_ID(empty)Merchant ID issued by the PSP
PSP_API_KEY(empty)Required to enable PSP top-up.
PSP_API_SECRET(empty)Required to enable PSP top-up.
PSP_CALLBACK_SECRET(empty)Shared secret used to verify the X-Mamlaka-Signature header on incoming callbacks
PSP_CALLBACK_BASE_URL(empty)This engine's own publicly-reachable base URL, used to build the callback URL sent to the PSP on each top-up/transfer request

Asset Type & Backing

TypeBackingDescription
utilitynoneStandard token (USDT, USDC)
airtimeairtimeBacked by real airtime float (IMC)

Airtime-backed assets use special journaling: mints debit the airtime inventory account, burns credit it. This keeps on-chain supply pegged to real float.

Cardano Proxy

VariableDefaultDescription
CARDANO_RPC_URL(empty)External Cardano proxy service URL
CARDANO_SERVICE_TOKEN(empty)Bearer token for the Cardano proxy

Released under the MIT License.