Smart Workflows

Verifiable multi-step automation with cryptographic attestations. Smart contracts execute instantaneously; Smart Workflows execute temporally over arbitrary durations.

Smart Workflows compose heterogeneous verification mechanisms. Each Smart Action employs optimal cryptographic guarantees without constraining subsequent operations.

Trigger
Transfer Event
Ethereum contract 0xABC...
Step 1: Check Balance
Read onchain data
Step 2: ML Analysis
Risk prediction
🤖
Step 3: Send Alert
Email notification
📧
Step 4: Execute Trade
Onchain transaction

Example

This workflow demonstrates heterogeneous verification: onchain reads (consensus-proven), AI inference (TEE-attested), email delivery (operator-signed), and onchain writes (consensus-finalized)—all in a single automated sequence.

Workflow Steps

1
Check Balance
Ethereum contract call (onchain proof)
2
ML Analysis
Hyperbolic AI inference (TEE attestation)
3
Send Alert
Email via SendGrid (operator signature)
4
Execute Trade
Uniswap transaction (onchain proof)

Key Properties

  • Temporal execution: Steps execute over time, not atomically
  • Heterogeneous verification: Each step uses optimal proof mechanism
  • Secret management: API keys/private keys decrypted only in TEE
  • Composability: Mix onchain, offchain, AI, and external APIs
Complete YAML Specification
# Example: DeFi Risk Alert Smart Workflow
name: DeFi Risk Alert

# Authorization & Payment
authority:
  uses: w3-io/actions/authority/ed25519@v1
  with:
    pubkey: 0x892b3c5e8d1f4a7c9e2b6d8a3f5c7e9b4d6a8c1e3b5d7a9c2e4f6b8d1a3c5e7

payer:
  uses: w3-io/actions/payer/account@v1
  with:
    pubkey: 0x6d9a2c5e8f1b4d7a0c3e6b9d2f5a8c1e4b7d0a3c6e9f2b5d8a1c4e7f0b3d6a9

# Secrets (encrypted, decrypted only in TEE)
secrets:
  - HYPERBOLIC_API_KEY    # Decentralized AI inference
  - SENDGRID_API_KEY      # Email delivery
  - ALCHEMY_API_KEY       # Blockchain data
  - PRIVATE_KEY_WALLET    # Trade execution
# Encrypted at rest, only decrypted inside TEE during execution
# Authority signature required to access secrets

on:
  ethereum:
    contract: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48  # USDC
    event: Transfer

jobs:
  alert-workflow:
    runs-on: w3-io-validator-network
    # Each step below is a "Smart Action" - a verifiable computation unit
    # Note: Smart contracts can be Smart Actions (e.g., Ethereum transactions)
    steps:
      # STEP 1: Blockchain read
      - name: Check USDC balance
        uses: w3-io/actions/ethereum/contract-call@v1
        with:
          contract: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
          function_signature: balanceOf(address)
          parameters:
            - 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb2
          block: 18500123

      # STEP 2: Hyperbolic AI inference
      - name: Risk analysis with Hyperbolic AI
        uses: w3-io/actions/ai/hyperbolic@v1
        with:
          model: meta-llama/Llama-3.3-70B-Instruct
          prompt: |
            Analyze DeFi transaction risk:
            Balance: ${{ steps.check-usdc-balance.outputs.result }}
            Contract: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
            Provide risk score 0-100 with reasoning.
          api_key: ${{ secrets.HYPERBOLIC_API_KEY }}
          replicas: 3
        # 🔒 Runs on decentralized Hyperbolic GPU network, not AWS/OpenAI

      # STEP 3: External API
      - name: Send email alert
        uses: w3-io/actions/external/sendgrid@v1
        with:
          to: trader@example.com
          subject: Risk Alert
          risk_analysis: ${{ steps.risk-analysis-hyperbolic.outputs.output }}
          api_key: ${{ secrets.SENDGRID_API_KEY }}
        # 🔒 API key decrypted inside TEE, never exposed to validator

      # STEP 4: Onchain transaction
      - name: Execute hedge trade
        uses: w3-io/actions/ethereum/contract-transaction@v1
        with:
          contract: 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D  # Uniswap V2
          from: 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb2
          function_signature: swapExactTokensForTokens(uint256,uint256,address[],address,uint256)
          parameters:
            - 1000000000  # Amount in
            - 990000000   # Min amount out
            - [0xA0b8..., 0xC02a...]  # Path
            - 0x742d35Cc...  # Recipient
            - 1699999999  # Deadline
          gas_limit: 200000
          private_key: ${{ secrets.PRIVATE_KEY_WALLET }}
        # 🔒 Private key signs tx inside TEE, never exposed to validator

Core Concepts

Temporal Execution

Unlike smart contracts that execute atomically in a single block, workflows span arbitrary durations. Steps wait for external events, APIs, or human intervention.

Heterogeneous Verification

Each Smart Action selects the verification method best suited to its computation: consensus for blockchain operations, TEE attestations for secrets, economic security for external APIs.

Secret Management

Secrets (API keys, private keys) are encrypted at rest and only decrypted inside Trusted Execution Environments. Validators never see plaintext secrets.

Composability

Workflows compose arbitrary Smart Actions: read/write blockchain state, call external APIs, run AI models, send notifications, execute trades—all in a single verifiable sequence.

Smart Workflows vs Smart Contracts

Smart Contracts: Atomic, synchronous execution within a single block. All state changes finalized together. Pure onchain computation.

Smart Workflows: Temporal, asynchronous execution across multiple blocks/events. State evolves incrementally. Orchestrates onchain + offchain + AI + external APIs.

Workflow Hash

Workflows are identified by content-addressed hashes, enabling immutable logic with mutable governance.

workflow_hash = SHA256(name + version + jobs)

The hash includes workflow logic (name, version, jobs) but excludes governance (authority, payer) and configuration (triggers). This allows updating who controls or pays for a workflow without redeploying.