Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.blnkfinance.com/llms.txt

Use this file to discover all available pages before exploring further.

Overview

Blnk Watch is configured with environment variables, usually through a .env file. The minimum configuration depends on how you run Watch:
  • If you run start, sync, or sync-once, add DB_URL so Watch can read transactions from Blnk Core.
Watch loads .env by default.
Minimum required .env
# If using start, sync, or sync-once
DB_URL=postgres://user:password@localhost:5432/blnk?sslmode=disable

Core connection configuration

Use these settings when Watch needs to read transactions from Blnk Core. This is required for start, sync, and sync-once. It is not required if you run watch in API-only mode and inject transactions manually.
.env
# Blnk Core database connection string
DB_URL=postgres://user:password@localhost:5432/blnk?sslmode=disable
VariableDescriptionDefaultRequired
DB_URLPostgreSQL connection string for the Blnk Core database. Watch uses this for watermark sync and historical transaction processing.NoneConditional

Rule source configuration

These settings control where Watch loads rules from. You can load rules from a local directory or point Watch at a Git repository that contains .ws rule files. If you set WATCH_SCRIPT_GIT_REPO, Watch clones the repository into WATCH_SCRIPT_DIR, processes the rules there, and keeps that local copy in sync.
.env
# Local directory only (default)
WATCH_SCRIPT_DIR=watch_scripts

# With Git-based rule loading
WATCH_SCRIPT_GIT_REPO=https://github.com/your-org/watch-rules.git
WATCH_SCRIPT_GIT_BRANCH=main
VariableDescriptionDefaultRequired
WATCH_SCRIPT_DIRLocal directory Watch reads for .ws rule files. This is also the destination directory when Git-based rule loading is enabled.watch_scriptsNo
WATCH_SCRIPT_GIT_REPOGit repository URL containing Watch rules. When set, Watch pulls rules from this repository instead of relying only on local files.NoneNo
WATCH_SCRIPT_GIT_BRANCHGit branch Watch should track when WATCH_SCRIPT_GIT_REPO is set.mainNo
Git-based rule loading requires git to be installed on the machine running Watch. For private repositories, Git authentication (e.g. SSH keys, credential helper, or personal access token) must be set up on that machine so Watch can clone and pull the repo.

Core sync configuration

These settings apply when Watch syncs transaction data from Blnk Core (e.g. with start, sync, or sync-once). They control where the initial sync starts when there is no saved sync progress yet. They do not control rule evaluation. Use SYNC_TRANSACTION_LOOKBACK when you want Watch to start from a relative window (e.g. the last 48 hours). Use SYNC_TRANSACTION_START_TIME when you want a fixed start time. If both are set, SYNC_TRANSACTION_START_TIME takes precedence.
.env
# Relative lookback (e.g. last 48 hours)
SYNC_TRANSACTION_LOOKBACK=48h

# Or fixed start time (overrides lookback when set)
SYNC_TRANSACTION_START_TIME=2026-03-11T00:00:00Z
VariableDescriptionDefaultRequired
SYNC_TRANSACTION_LOOKBACKHow far back to sync when starting (e.g. 48h, 168h). Go duration format.48hNo
SYNC_TRANSACTION_START_TIMEAbsolute starting point for the initial sync. Accepted formats are 2026-03-11T00:00:00Z, 2026-03-11 15:04:05, or 2026-03-11.NoneNo

Alert webhook configuration

These settings control alert webhook delivery when one or more rules are triggered by a transaction within Watch. Watch can send alerts to a primary webhook and fall back to secondary or backup endpoints if needed.
.env
ALERT_WEBHOOK_URL=https://your-server.com/alerts

ALERT_WEBHOOK_SECONDARY_URL=https://your-server.com/alerts-secondary
ALERT_WEBHOOK_BACKUP_URL=https://your-server.com/alerts-backup

ALERT_WEBHOOK_API_KEY=your_api_key_here

ALERT_WEBHOOK_RISK_THRESHOLD=0.5

ALERT_WEBHOOK_ENABLED=true
VariableDescriptionDefaultRequired
ALERT_WEBHOOK_URLPrimary alert webhook URL.NoneNo
ALERT_WEBHOOK_SECONDARY_URLSecondary fallback alert webhook URL. Watch uses it if the primary webhook fails.NoneNo
ALERT_WEBHOOK_BACKUP_URLFinal fallback alert webhook URL. Watch uses it if earlier webhook attempts fail.NoneNo
ALERT_WEBHOOK_API_KEYBearer token sent in the Authorization header for alert webhook requests.NoneNo
ALERT_WEBHOOK_RISK_THRESHOLDMinimum risk score that should trigger an alert.0.5No
ALERT_WEBHOOK_ENABLEDEnables or disables alert webhook delivery. Set it to false to disable.trueNo