Architecture
Before we explore the overall architecture of Analog Watch, you might want to understand what a View is.
Core Components
1. Immutable Objects
Data entities like Feeds, Views, Functions, and Automations are stored as content-addressed objects using IPFS hashes. This ensures integrity and versioning:
- Feeds: Periodic data collectors (i.e., blockchain data) defined by functions.
- Views: SQL-based queries over referenced data sources.
- Functions: Self-contained operations that process or transform smart contract data.
- Automations: Trigger-action workflows that execute WASM code when feed data changes.
2. Decentralized Identity & Access
- Users/roles (
User,Role) control permissions via cryptographic identities. - The protocol enforces role-based access (users, developers, admins) for operations.
- The protocol uses
subgraphsto isolate data by user groups for multi-tenancy. You can think ofsubgraphsas organizational units that group related data and functionality.
3. Indexing Engine
- Processes data at fixed intervals (
INDEXING_INTERVAL = 30s). - Tracks blockchain data (
BlockIndex) with clock-based timestamps. - Charges fees (
INDEXING_FEE) for data writes to prevent abuse. See Fees & Rewards for more details.
4. Automation System
- Triggers WebAssembly (WASM) code when feed conditions are met.
- Limits execution depth (
AUTOMATION_DEPTH) to prevent infinite loops.
Key Workflows
- Data Ingestion:
Feeds collect smart contract data (e.g., blockchain events) using user-defined functions. Results are stored in hash-addressed tables. - Query Processing:
Views allow SQL queries across multiple immutable datasets. Queries are sanitized to prevent injections and restrict unsafe functions. - Balance Tracking:
Users have on-chain balances (balance()) and pending adjustments (unsynced_balance()), enabling microtransactions for resource usage. - Immutable Operations:
All object creations (feeds/views/automations) produce auditable metadata (ObjectMetadata) with creator IDs and timestamps.
How Analog Watch Works

- Users create immutable objects through an API. Users must be authenticated to deploy these artifacts. Check out Authentication to learn more.
- Objects are assigned unique identifiers and cryptographic hashes.
- Analog Watch indexes the referenced blockchain data at regular intervals based on the configured clock.
- Data can be queried through SQL-compatible interfaces via Watch SDK or Watch Portal .
- Automations can be triggered by data events, creating new data, or executing actions.
Analog Watch charges fees based on resource usage. You'll pay microtransactions determined by INDEXING_FEE constants and the resources your operations consume, tracked through your balance. See Fees & Rewards for more details.
pub const INDEXING_FEE: u128 = 50_000; // Per-row fee
pub struct User {
...
pub balance: u128,
pub unsynced_balance: i128,
}All data operations deduct INDEXING_FEE (50,000 units) per row processed, with fee validation occurring during query planning. User accounts track two distinct balances:
- Confirmed Balance (
balance): Settled funds - Unsynced Balance (
unsynced_balance): Pending transactions
This dual-balance system enables real-time accounting while supporting eventual consistency across the protocol.
Example Use Case
- A user defines a Feed to index NFT transfers from Ethereum.
- The system periodically indexes new transfers into an IPFS-hashed table.
- A View combines this data with pricing information from another Feed.
- An Automation triggers a WASM function to send alerts when high-value trades occur.