Testnet only (Arkiv Tiramisu). OpenTrigger 0.1 has not had an outside audit.
OpenTrigger

Create a rule

Every trigger, action and option of a rule, with the checks the SDK runs before it spends a transaction.

A rule is one call. The SDK validates it, checks the target exists, and writes one entity.

const { key, txHash, warnings } = await triggers.createRule({
  name: 'Lease reminder',
  trigger: { on: 'expire', target: leaseKey, offset: 1800n },
  action: 'webhook',
  url: 'https://example.com/hooks/arkiv',
  message: '{rule}: {entity} expires at {time}',
})

Triggers

trigger: { on: 'expire', target: '0x…', offset: 1800n }

target is an entity key (0x and 64 hex characters). The rule fires when that entity expires, or offset blocks earlier. The deadline follows the target: if someone extends the target, the rule fires later. If the target is deleted before it expires, the worker records a skipped receipt instead of firing.

The SDK reads the target before writing the rule, and throws TriggersError if it has already expired, been deleted, or never existed.

Offsets are blocks, as bigint: 15 minutes is 450n, 1 hour 1800n, 1 day 43200n.

Actions

actionNeedsWhat the worker does
telegrammessage, chat (sealed), workerSends the message from the OpenTrigger bot. See Telegram
webhookurl (https://), optional messageA signed POST. See Webhooks
receiptnothingWrites the receipt and nothing else
extendextendDaysExtends the expire target. See Keep data alive

message may use {entity}, {time} and {rule}; the worker fills them in when it fires.

Options

Prop

Type

Checks before the transaction

  • validateRule(input) throws SchemaError with a readable message: a bad entity key, an http:// URL, a Telegram rule with a plain chat ID, retries out of range, and so on. createRule runs it for you.
  • ruleWarnings(input) returns strings that do not block publishing, for example a webhook URL that looks like it contains a secret. createRule returns them as warnings.

Rules are public

Anyone can read a rule. Never put a secret, an API key or personal data in name, message or url. A Slack or Discord webhook URL is a secret.

Several rules in one transaction

const { keys } = await triggers.createRules([ruleA, ruleB])

They all land or none does. The dashboard uses this when one trigger has two actions.

Delete a rule

await triggers.deleteRule(key)

A deleted rule never fires. Receipts already written stay, and the rule's history remains in the chain.

How long a rule lives

A rule expires a week after its deadline (at least one day), so it cleans itself up and its receipts stay readable next to it for that week. See Entities.

On this page