# OneSource Ethereum Event Logs (eth_getLogs)

> OneSource Ethereum Event Logs (eth_getLogs) is a paid API for AI agents from api.onesource.io, paid per call via x402, $0.005/call, status unknown (last checked 2026-09-13).

Fetches on-chain Ethereum event logs filtered by contract address, topic hash, and block range on mainnet or Sepolia testnet

## Facts

- Endpoint: GET https://api.onesource.io/api/chain/events
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/onesource-ethereum-event-logs-eth-getlogs-dad3a1cc
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_dtWHhmokxD379l9s3b6Vx

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability onesource-ethereum-event-logs-eth-getlogs-dad3a1cc
```

Example prompt: Can you fetch all Transfer events from the USDT contract at 0xdac17f958d2ee523a2206206994597c13d831ec7 on Ethereum mainnet from block 20000000 to latest? The Transfer topic hash is 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef.

## When to prefer this

Use this endpoint when you need to query on-chain Ethereum event logs by contract address and event topic, especially for ERC20 Transfer events, NFT mints/transfers, or any custom smart contract events. Prefer over generic JSON-RPC eth_getLogs calls when you want a REST-style interface with per-call micropayment via x402/USDC, no API key setup, and support for both mainnet and Sepolia testnet.

## Known failure modes

- Invalid contract address format (not 0x + 40 hex chars) — likely 400 error
- Invalid topic hash format (not 0x + 64 hex chars) — likely 400 error
- from_block greater than to_block — likely 400 or empty result
- Block range too large causing timeout
- Payment not received (x402 payment required, 402 response)
- Network not supported (only ethereum/sepolia accepted)
- Node unavailability causing 503 or timeout

## How this service works

Query Ethereum contract event logs via eth_getLogs - filter by contract, topic, and block range

## Output

Returns a JSON object with a 'logs' array and a 'count' integer. Each log entry includes: 'address' (contract address), 'topics' (array of topic hashes), 'data' (ABI-encoded log data), 'tx_hash' (transaction hash), and 'block_number' (hex-encoded block number).

## Example request

```json
{
 "topic": "0x0000000000000000000000000000000000000000000000000000000000000000",
 "network": "sepolia",
 "contract": "0x1234567890123456789012345678901234567890",
 "to_block": "latest",
 "from_block": "latest"
}
```

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET",
      "HEAD",
      "DELETE"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "properties": {
      "topic": {
       "type": "string",
       "pattern": "^0x[a-fA-F0-9]{64}$"
      },
      "network": {
       "enum": [
        "ethereum",
        "sepolia",
        "robinhood"
       ],
       "type": "string",
       "default": "ethereum"
      },
      "contract": {
       "type": "string",
       "pattern": "^0x[a-fA-F0-9]{40}$"
      },
      "to_block": {
       "oneOf": [
        {
         "type": "integer",
         "minimum": 0
        },
        {
         "enum": [
          "latest",
          "pending",
          "earliest",
          "safe",
          "finalized"
         ],
         "type": "string"
        },
        {
         "type": "string",
         "pattern": "^0[xX][a-fA-F0-9]+$"
        }
       ]
      },
      "from_block": {
       "oneOf": [
        {
         "type": "integer",
         "minimum": 0
        },
        {
         "enum": [
          "latest",
          "pending",
          "earliest",
          "safe",
          "finalized"
         ],
         "type": "string"
        },
        {
         "type": "string",
         "pattern": "^0[xX][a-fA-F0-9]+$"
        }
       ]
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "required": [
      "data",
      "meta"
     ],
     "properties": {
      "data": {
       "type": "object",
       "properties": {
        "logs": {
         "type": "array",
         "items": {
          "type": "object",
          "properties": {
           "data": {
            "type": "string"
           },
           "topics": {
            "type": "array",
            "items": {
             "type": "string"
            }
           },
           "address": {
            "type": "string"
           },
           "logIndex": {
            "type": "string"
           },
           "blockNumber": {
            "type": "string"
          
… (truncated)
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "data": {
   "logs": [
    {
     "data": "0x0000000000000000000000000000000000000000000000000000000000000001",
     "topics": [
      "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
     ],
     "address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
     "logIndex": "0x0",
     "blockNumber": "0x133da1e",
     "transactionHash": "0xad7e04119ecd85857728205f5b12e95f0bab8e99f9c2f60be5dc79cfc6a8df1f"
    }
   ],
   "count": 1,
   "to_block": "latest",
   "from_block": "latest"
  },
  "meta": {
   "endpoint": "/api/chain/events",
   "cost_usdc": "0.001",
   "request_id": "00000000abcdef01",
   "payment_chain": "base",
   "payment_token": "USDC"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/onesource-ethereum-event-logs-eth-getlogs-dad3a1cc/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.onesource.io](https://www.zero.xyz/host/api.onesource.io/llms.txt)
