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

Quickstart

Install the SDK, create a rule on an entity that expires in two minutes, and watch a worker fire it.

You need Node.js 22 or later, and a wallet key with a little test GLM on Arkiv Tiramisu. Get GLM free from the faucet.

Install

npm install arkiv-triggers @arkiv-network/sdk@0.8.1 viem

OpenTrigger's SDK and CLI are published as arkiv-triggers on npm.

viem is a peer dependency. Pin @arkiv-network/sdk to 0.8.1, the version OpenTrigger is built and tested against.

Create a client

import { createTriggers } from 'arkiv-triggers'
import { createWalletClient } from '@arkiv-network/sdk'
import { tiramisu } from '@arkiv-network/sdk/chains'
import { http } from 'viem'
import { privateKeyToAccount } from 'viem/accounts'

const wallet = createWalletClient({
  chain: tiramisu,
  transport: http(),
  account: privateKeyToAccount(process.env.WALLET_KEY as `0x${string}`),
})
const triggers = createTriggers({ wallet })

createTriggers needs only a wallet to write. To read, it needs nothing at all.

Make something that expires

import { ExpirationTime, str } from '@arkiv-network/sdk'

const { entityKey } = await wallet.createEntity({
  payload: new TextEncoder().encode('hello'),
  contentType: 'text/plain',
  attributes: { type: str('demo.note') },
  expires: ExpirationTime.fromMinutes(2),
})

Create a rule on it

const { key } = await triggers.createRule({
  name: 'Note expired',
  trigger: { on: 'expire', target: entityKey },
  action: 'receipt',
})

The rule is now an entity on Arkiv. Any public worker picks it up within about 30 seconds and fires it at the block the note expires.

Watch it fire

const stop = triggers.watch({
  rule: key,
  onReceipt: (r) => {
    console.log(r.status, r.reason, 'fired by', r.worker, 'at block', r.firedAt)
    stop()
  },
})

About two minutes later you see ok target expired fired by 0x… at block …. The receipt is itself an entity: anyone can read it with triggers.listReceipts({ rule: key }).

Next

On this page