# accountAbstractionOperations - EVM Data Stream

> Stream decoded ERC-4337 EntryPoint events: UserOperation results, account deployments, and revert reasons. Complete guide on how to use the accountAbstractionOperations topic in GetBlock EVM Data Stre

The `accountAbstractionOperations` topic decodes the events of the canonical [ERC-4337](https://eips.ethereum.org/EIPS/eip-4337) EntryPoint contracts. It tells you when a smart account's UserOperation executed and whether it succeeded, when a new smart account was deployed, and why an operation reverted.

> **Warning:** **WebSocket-only topic.** Subscribe with [`getblock_subscribe`](/evm-data-stream/api-reference/getblock_subscribe-evm-data-stream/) on any [network endpoint](/evm-data-stream/api-reference/#endpoints).

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `filters.entryPoint` | string | No | EntryPoint contract address. Omit to receive every canonical EntryPoint version. |
| `filters.sender` | string | No | Smart account (UserOperation `sender`). |
| `filters.paymaster` | string | No | Paymaster that sponsored the operation. |
| `filters.userOpHash` | string | No | One UserOperation hash. |
| `filters.eventType` | string | No | One of `userOperation`, `accountDeployed`, `revertReason`, or `beforeExecution`. |
| `filters.success` | boolean | No | Filter `userOperation` events by execution result. |

`eventType` values map to the EntryPoint events:

| `eventType` | EntryPoint event | When it fires |
| --- | --- | --- |
| `userOperation` | `UserOperationEvent` | Once per UserOperation, after execution, with its result and gas cost. |
| `accountDeployed` | `AccountDeployed` | When a UserOperation deploys its smart account. |
| `revertReason` | `UserOperationRevertReason` | When a UserOperation's call reverted, with the revert data. |
| `beforeExecution` | `BeforeExecution` | Once per bundle, before the operations in it execute. |

## Request Example

#### wscat

```bash
# WebSocket-only. Connect first:
wscat -c 'wss://stream.eu-central-1.getblock.io/v1/eth-mainnet/stream' -H 'Authorization: Bearer <API-KEY>'

# Then send:
{"jsonrpc":"2.0","id":1,"method":"getblock_subscribe","params":[{"topic":"accountAbstractionOperations","filters":{"eventType":"userOperation","sender":"0xe21db522d0e27db4044486f656b6d26934c77645"}}]}
```

#### JavaScript

```javascript
// npm install ws
import WebSocket from 'ws';

const ws = new WebSocket('wss://stream.eu-central-1.getblock.io/v1/eth-mainnet/stream', {
  headers: { Authorization: 'Bearer <API-KEY>' }
});

ws.on('open', () => {
  ws.send(JSON.stringify({
    jsonrpc: '2.0',
    id: 1,
    method: 'getblock_subscribe',
    params: [{
      topic: 'accountAbstractionOperations',
      filters: {
        eventType: 'userOperation',
        sender: '0xe21db522d0e27db4044486f656b6d26934c77645'
      }
    }]
  }));
});

ws.on('message', (raw) => {
  const msg = JSON.parse(raw);

  // First reply is the subscription ID (or an error)
  if (msg.id !== undefined) {
    console.log(msg.error ?? `Subscribed: ${msg.result}`);
    return;
  }

  const { removed, data } = msg.params.result;
  if (data.eventType === 'userOperation') {
    console.log(removed ? 'REVERTED' : data.success ? 'userOp ok' : 'userOp FAILED', data.userOpHash, 'cost', BigInt(data.actualGasCost));
  }
});
```

#### Python

```python
# pip install "websockets>=14"
import asyncio, json, websockets

URL = "wss://stream.eu-central-1.getblock.io/v1/eth-mainnet/stream"
HEADERS = {"Authorization": "Bearer <API-KEY>"}

async def main():
    # ping_interval=None: the server sends its own keepalive pings (see Connection keepalive)
    async with websockets.connect(URL, additional_headers=HEADERS, ping_interval=None) as ws:
        await ws.send(json.dumps({
            "jsonrpc": "2.0",
            "id": 1,
            "method": "getblock_subscribe",
            "params": [{
                "topic": "accountAbstractionOperations",
                "filters": {
                    "eventType": "userOperation",
                    "sender": "0xe21db522d0e27db4044486f656b6d26934c77645"
                }
            }]
        }))

        async for message in ws:
            msg = json.loads(message)

            # First reply is the subscription ID (or an error)
            if "id" in msg:
                print(msg.get("error") or f"Subscribed: {msg['result']}")
                continue

            event = msg["params"]["result"]
            removed, data = event["removed"], event["data"]
            if data['eventType'] == 'userOperation':
                print('REVERTED' if removed else 'userOp ok' if data['success'] else 'userOp FAILED', data['userOpHash'], 'cost', int(data['actualGasCost'], 16))

asyncio.run(main())
```

## Response Example

The first reply is the subscription ID:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0xd83568be1b45519333164dbc949327bb"
}
```

Every later message is an event notification (a `userOperation` event):

```json
{
  "jsonrpc": "2.0",
  "method": "getblock_subscribe",
  "params": {
    "subscription": "0xd83568be1b45519333164dbc949327bb",
    "result": {
      "eventId": "eth:mainnet:receipts:0x830b6a483c183023519b834acfac62e7392ab7918c8…",
      "removed": false,
      "revision": 116877272,
      "data": {
        "eventType": "userOperation",
        "entryPoint": "0x4337084d9e255ff0702461cf8895ce9e3b5ff108",
        "userOpHash": "0x8657eaa065d117c15340470360d2b6e62160d1c5dca8f11ba978dc66f6f7a6ab",
        "sender": "0xe21db522d0e27db4044486f656b6d26934c77645",
        "paymaster": "0x888888888888ec68a58ab8094cc1ad20ba3d2402",
        "nonce": "0x1a0c3a931210000000000000000",
        "success": true,
        "actualGasCost": "0x1080d4b3292d0",
        "actualGasUsed": "0x5ebc6",
        "address": "0x4337084d9e255ff0702461cf8895ce9e3b5ff108",
        "blockNumber": "0x18d1e1f",
        "transactionHash": "0x54ebb6d71346068b99441bb55ddf2e8884175cf364eecbccc0a57ed297d6d770",
        "transactionIndex": "0x1ad",
        "blockHash": "0x830b6a483c183023519b834acfac62e7392ab7918c8f31b8d4188293e364d38f",
        "blockTimestamp": "0x6ab110cf",
        "logIndex": "0x252",
        "removed": false
      }
    }
  }
}
```

A `beforeExecution` event carries only the EntryPoint and log context:

```json
{
  "data": {
    "eventType": "beforeExecution",
    "entryPoint": "0x4337084d9e255ff0702461cf8895ce9e3b5ff108",
    "address": "0x4337084d9e255ff0702461cf8895ce9e3b5ff108",
    "blockNumber": "0x18d1e1f",
    "transactionHash": "0x54ebb6d71346068b99441bb55ddf2e8884175cf364eecbccc0a57ed297d6d770",
    "transactionIndex": "0x1ad",
    "blockHash": "0x830b6a483c183023519b834acfac62e7392ab7918c8f31b8d4188293e364d38f",
    "blockTimestamp": "0x6ab110cf",
    "logIndex": "0x248",
    "removed": false
  }
}
```

## Response Parameters

The `result` object contains the event envelope and the payload in `data`.

| Field | Type | Description |
| --- | --- | --- |
| `eventId` | string | Stable event identifier. A reorg correction reuses it. |
| `removed` | boolean | `true` when a reorg removed this previously delivered event. |
| `revision` | number | Event version. For one `eventId`, a greater revision is newer. |
| `data.eventType` | string | `userOperation`, `accountDeployed`, `revertReason`, or `beforeExecution`. The other fields present depend on it. |
| `data.entryPoint` | string | EntryPoint contract that emitted the event. |
| `data.userOpHash` | string | UserOperation hash. Not present on `beforeExecution`. |
| `data.sender` | string | Smart account address. |
| `data.paymaster` | string | Paymaster address, or the zero address when the account paid for itself. |
| `data.nonce` | string | UserOperation nonce, hex-encoded (`userOperation`). |
| `data.success` | boolean | Whether the UserOperation's call succeeded (`userOperation`). |
| `data.actualGasCost` | string | Total cost charged for the operation in wei, hex-encoded (`userOperation`). |
| `data.actualGasUsed` | string | Gas used by the operation, hex-encoded (`userOperation`). |
| `data.address` | string | Address of the contract that emitted the log. |
| `data.blockNumber` | string | Block number, hex-encoded. |
| `data.blockHash` | string | Hash of the block that contains the log. |
| `data.blockTimestamp` | string | Block timestamp in Unix seconds, hex-encoded. |
| `data.transactionHash` | string | Hash of the transaction that emitted the log. |
| `data.transactionIndex` | string | Transaction's position in the block, hex-encoded. |
| `data.logIndex` | string | Log's position in the block, hex-encoded. |
| `data.removed` | boolean | The underlying log's `removed` flag. Use the envelope's `removed` for reorg handling. |

> **Info:** `accountDeployed` and `revertReason` events carry the fields of their EntryPoint event (for example the account `factory`, or the `revertReason` bytes) alongside `userOpHash` and `sender`. Read fields by name and ignore any you don't use.

## Use Cases

* Confirming a UserOperation from your bundler or wallet executed, and whether it succeeded
* Sponsorship accounting for paymasters (filter by `paymaster`)
* Tracking smart-account onboarding (`accountDeployed`)
* Surfacing revert reasons to users of a smart wallet

## Error Handling

| Code | Message | Cause |
| --- | --- | --- |
| `-32602` | `invalid eventType "…": must be userOperation, accountDeployed, revertReason, or beforeExecution` | `eventType` has an unsupported value. |
| `-32602` | `invalid entryPoint: invalid EVM address "…"` | `entryPoint` is not a 20-byte hex address. |
| `-32602` | `invalid sender: invalid EVM address "…"` | `sender` is not a 20-byte hex address. |
| `-32602` | `invalid paymaster: invalid EVM address "…"` | `paymaster` is not a 20-byte hex address. |
| `-32602` | `invalid accountAbstractionOperations request: json: unknown field "…"` | The request has a field this topic does not accept. |
| `-32001` | `subscription limit exceeded` | You already have 15 active or pending subscriptions. |
