Skip to content

Configuration

All configuration is done via environment variables. Copy .env.example to .env and fill in the values.

Required variables

VariableDescriptionExample
VAULT_KEY32-byte hex key for encrypting your mnemonicopenssl rand -hex 32
API_KEYSecret key your backend uses to authenticate API callsopenssl rand -hex 32
DATABASE_URLPostgreSQL connection stringpostgresql://user:pass@host:5432/db
REDIS_URLRedis connection stringredis://localhost:6379
HOT_WALLET_ADDRESSTRON address where swept funds are sentTXxx...
TRON_FULL_HOSTTronGrid API endpointsee below
TRONGRID_API_KEYTronGrid API key (free tier available)from trongrid.io

Network endpoints

NetworkTRON_FULL_HOST
Mainnethttps://api.trongrid.io
Nile Testnethttps://nile.trongrid.io

Start with Nile Testnet

Use the Nile testnet during development. Get free testnet USDT from the Nile faucet.

Optional variables

VariableDefaultDescription
PORT3000HTTP server port
CONFIRMATIONS_REQUIRED19Block confirmations before order is confirmed
ORDER_EXPIRY_MINUTES60Minutes before unpaid order expires
SCAN_MODEaddressaddress or block scanning mode
WEBHOOK_TIMEOUT_MS5000Webhook delivery timeout
LOG_LEVELinfoPino log level (debug/info/warn/error)
ADMIN_PASSWORDPassword for the admin dashboard
JWT_SECRETSecret for admin session JWTs
HMAC_SECRETSecret for API key HMAC hashing

Scan modes

SCAN_MODE=address (default)

  • Polls TronGrid for transactions to each pending payment address individually
  • Works within TronGrid free tier for low volume (< 10 concurrent orders)
  • Best for: development, low-traffic production

SCAN_MODE=block

  • Scans each new block for any USDT Transfer events
  • More efficient at high volume (> 10 concurrent orders)
  • Requires Redis to track pending addresses
  • Automatically falls back to address mode after 5 consecutive failures

Admin dashboard

To enable the admin dashboard at /admin:

dotenv
ADMIN_PASSWORD=your-secure-password
JWT_SECRET=<openssl rand -hex 32>

Then visit http://localhost:3000/admin and log in with your ADMIN_PASSWORD.

Generating secure values

bash
# VAULT_KEY — most critical, back this up!
openssl rand -hex 32

# API_KEY
openssl rand -hex 32

# JWT_SECRET
openssl rand -hex 32

# HMAC_SECRET
openssl rand -hex 32

Released under the BSL 1.1 License.