> ## Documentation Index
> Fetch the complete documentation index at: https://docs.b3os.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Smart Contract Event

Triggers when a smart contract emits an on-chain event that matches your filter criteria. Advanced — requires an event ABI.

Trigger Onchain

Triggers when a smart contract emits an on-chain event that matches your filter criteria. Advanced — requires an event ABI.

## At a Glance

| Field | Value |
| --- | --- |
| Trigger ID | `evm-log` |
| Category | Onchain |
| Tags | `evm`, `blockchain`, `event`, `log`, `smart-contract`, `on-chain`, `ethereum`, `advanced` |

## Trigger Configuration

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `chainId` | `integer` | Yes | Chain ID to subscribe to \(e.g., 1 for Ethereum, 42161 for Arbitrum\) |
| `contractAddress` | `string` | No | Single contract address to filter events from. Mutually exclusive with contractAddresses. If both are omitted, events from all contracts on the chain are matched. |
| `contractAddresses` | `array` | No | List of contract addresses to watch \(up to 20\). Mutually exclusive with contractAddress. |
| `eventAbi` | `object` | Yes | Event ABI in Etherscan/Solidity JSON format. Must include 'name', 'type', and 'inputs' fields. |
| `filter` | `object` | No | Filter DSL to match event parameters. Top level MUST be $and or $or. Supports $eq, $ne, $gt, $gte, $lt, $lte, $in, $nin operators. |
| `enrichments` | `array` | No | Additional data to include with each event. Each enrichment adds an RPC call \(and sometimes a price lookup\) per trigger. |
| `enrichmentFilter` | `object` | No | Filter applied to enrichment results. Only fires when enriched data matches. Same syntax as event filter \($and/$or with $eq, $gt, $gte, $lt, $lte, $in, etc.\). |

## Trigger Result

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `triggeredAt` | `string` | Yes | Timestamp when the event was detected \(UTC, RFC3339 format\) |
| `params` | `object` | Yes | Decoded event parameters based on eventAbi. Field names and structure match the ABI definition. |
| `raw` | `object` | Yes | Raw log data including address, topics, data, blockNumber, transactionHash, etc. |
| `enrichments` | `object` | No | Additional data from opt-in enrichments. Only populated when the corresponding enrichment is enabled. |

## Workflow Root Example

```json
{
  "nodes": {
    "root": {
      "type": "evm-log",
      "payload": {
        "chainId": 8453,
        "eventAbi": {
          "_comment": "ERC20 Transfer event ABI (matches simple filter/params example)",
          "anonymous": false,
          "inputs": [
            {
              "indexed": true,
              "internalType": "address",
              "name": "from",
              "type": "address"
            },
            {
              "indexed": true,
              "internalType": "address",
              "name": "to",
              "type": "address"
            },
            {
              "indexed": false,
              "internalType": "uint256",
              "name": "value",
              "type": "uint256"
            }
          ],
          "name": "Transfer",
          "type": "event"
        }
      },
      "children": [
        "log_event"
      ]
    },
    "log_event": {
      "type": "log",
      "payload": {
        "message": "Triggered at {{$trigger.triggeredAt}}"
      },
      "children": []
    }
  }
}
```

**Reference trigger output**

Downstream nodes can use `{{$trigger.triggeredAt}}` and any result fields listed above. Event triggers usually expose the raw source payload under a field such as `event`, `body`, `trade`, or `raw`.