Skip to main content
Blnk Watch is currently in beta. Send us a message
Blnk Watch rules define how transactions are evaluated. Each rule describes a pattern to look for and what should happen when that pattern matches. Rules operate only on transactions. They don’t monitor balances, ledgers, or identities. If you need extra business context (e.g. KYC tier, promo code), pass it on the transaction as meta_data and reference it in the rule.

Watch scripts

Rules are written as watch scripts: plain-text files with the .ws extension. Watch loads these scripts from a designated folder (by default watch_scripts), compiles them, and turns them into the rules that run against each transaction. When you add or change a .ws file in that folder, Watch picks up the change and updates the active rule set.
Keep all watch scripts in that folder so Watch can find and load them.For easier management, name files descriptively: camelCase or snake_case both work (e.g. HighValueUSD.ws, burst_to_same_destination.ws).That way you can tell what each script does from the filename alone.

Rule anatomy

Every rule has two core parts: when (the pattern) and then (the outcome). The rest of this section walks through each piece and where to learn more. A simple, complete rule looks like this:
HighValueUSD.ws
Keep in mind: When you need information that isn’t part of the transaction payload, include it in meta_data first. A rule can use meta_data.kyc_tier or meta_data.promo_code only if your app sends those values with the transaction.

Rule syntax

First, you declare the rule. The name after rule must be a single identifier in camelCase or snake_case (e.g. HighValueUSD, burst_to_same_destination) and should describe the pattern or control so it’s clear in logs and audits.
ruleName.ws
Next, you define the condition. Aim for one goal per rule: the condition should describe a single pattern or check. If you need to flag several different cases, use a separate rule for each so evaluation and debugging stay clear.
ruleName.ws
Then, you define the verdict if the condition is triggered:
ruleName.ws
Finally, you add more information about the verdict. Score and reason are usually what the next part of your workflow uses: they tell you how serious the signal is and why the rule fired, so you know what to do with an alert from Watch.
ruleName.ws

Need help?

We are very happy to help you make the most of Blnk, regardless of whether it is your first time or you are switching from another tool. To ask questions or discuss issues, please contact us or join our Discord community.