Workflows for processing new blocks and transactions using block-triggered webhooks (from Alchemy Notify) and matching against watched addresses. These workflows demonstrate the block trigger pattern where the workflow reacts to incoming block data and extracts relevant transactions.
Directory Structure
- block-trigger-go/ (Go): main.go, config.staging.json, config.production.json, workflow.yaml, README.md
- block-trigger-ts/ (TypeScript): main.ts, package.json, config.staging.json, workflow.yaml, README.md
Overview
- React to block events via HTTP webhook triggers (Alchemy Notify)
- Match transactions to a list of watched addresses
- Process and return JSON-formatted block and transaction data
- Implement the same logic in both Go and TypeScript
Workflows extract: block number, hash, timestamp; all transactions; transactions where to address matches watched addresses.
Go: cd block-trigger-go, cre workflow simulate workflow --non-interactive --trigger-index 0 --http-payload test-block.json --target staging-settings
TypeScript: cd block-trigger-ts/workflow, bun install, cre workflow simulate workflow --non-interactive --trigger-index 0 --http-payload test-block.json --target staging-settings
Setup: CRE CLI, cre login; Go or Bun/Node for TS. Alchemy: sign up, create app, Webhooks > Real-time Notifications > Custom webhook for new blocks, set webhook URL.
Example use cases: monitoring high-value addresses, contract interaction tracking, block-level analytics.
Reference: CRE docs, Alchemy custom webhook docs.