> ## 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.

# Get Contract Event Logs

Fetch recent event logs emitted by an EVM contract without any gas cost. Returns up to 25 most-recent matching events decoded against the supplied event ABI, searching back up to ~3.5 days on L2s. Ideal for: populating test-workflow event pickers, inspecting recent on-chain activity, replaying an event for dry runs.

![Get Contract Event Logs logo](https://ai-icon.b3.fun/logo/ethereum)
Catalog action EVM Onchain

Fetch recent event logs emitted by an EVM contract without any gas cost. Returns up to 25 most-recent matching events decoded against the supplied event ABI, searching back up to ~3.5 days on L2s. Ideal for: populating test-workflow event pickers, inspecting recent on-chain activity, replaying an event for dry runs.


## At a Glance

| Field | Value |
| --- | --- |
| Action ID | `evm-get-logs` |
| Category | EVM Onchain |
| Connector | Not required |
| Requires gas | No |
| Funds movement | None declared |
| Tags | `blockchain`, `evm`, `read`, `logs`, `events`, `query` |

## Payload Schema

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `chainId` | `number` | Yes | Chain ID \(1=Ethereum, 137=Polygon, 56=BSC, 8453=Base, etc.\) |
| `contractAddress` | `string` | No | Optional contract address to filter logs. If omitted, returns any log matching the event signature. |
| `eventAbi` | `object` | Yes | The event ABI to decode logs against. Must be a single event definition. |
| `limit` | `number` | No | Max number of recent logs to return \(newest first\). Default 5, max 25. |
| `maxBlocksBack` | `number` | No | How many blocks back to search at most. Default 150000 \(~3.5 days on Base/L2\). Capped at 250000 to stay within RPC and proxy timeout budgets. |

## Result Schema

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `logs` | `array` | Yes | Matching logs, newest first. Empty array if none found. |
| `latestBlock` | `number` | No | The chain's latest block at fetch time. |
| `searchedBlocks` | `number` | No | How many blocks were actually searched before returning. |
| `partialResults` | `boolean` | No | True when the search hit the server-side deadline or chunk cap before completing the full range. Callers should treat results as incomplete — consider narrowing the event or contract filter. |

## Examples

**Workflow node**

```json
{
  "type": "evm-get-logs",
  "payload": {
    "chainId": 8453,
    "eventAbi": {
      "name": "example-name",
      "inputs": []
    }
  },
  "children": []
}
```
  **Test with API**

```bash
curl -X POST "https://api.b3os.org/v1/actions/evm-get-logs/test" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "inputs": {
    "chainId": 8453,
    "eventAbi": {
      "name": "example-name",
      "inputs": []
    }
  }
}'
```

**Use expressions for dynamic values**

Payload fields can use workflow expressions such as `{{$trigger.body.amount}}`, `{{$nodes.fetch.result.price}}`, and `{{$props.asset}}` when the value should come from a trigger, prior node, or reusable workflow prop.