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

# Onchain Lookup

> Raw chain-state lookup for a transaction hash on EVM or UTXO networks

## Endpoint

```
GET /leokit/explorer/onchain/{chain}/{hash}
```

No authentication required.

## Request

| Path parameter | Type   | Required | Description                                              |
| -------------- | ------ | -------- | -------------------------------------------------------- |
| `chain`        | string | Yes      | Chain code (case-insensitive) — see supported list below |
| `hash`         | string | Yes      | Transaction hash                                         |

### Supported Chains

#### EVM (via DRPC)

`ETH`, `ARB` / `ARBITRUM`, `BASE`, `OP` / `OPTIMISM`, `BSC` / `BNB` / `BNBCHAIN`, `AVAX` / `AVAX_CCHAIN`, `POLYGON` / `MATIC`, `FTM`, `LINEA`, `SCROLL`, `BLAST`, `ZKSYNC`, `SONIC`, `HYPERLIQUID`

#### UTXO (via mempool.space)

`BTC`, `LTC`, `DOGE`, `BCH`

## Response

### EVM Chains

```json theme={null}
{
  "data": {
    "type": "evm",
    "block_number": 19842018,
    "status": "success",
    "confirmations": 24,
    "gas_used": 165820,
    "effective_gas_price_gwei": "5.4321",
    "nonce": 142,
    "log_count": 4,
    "input_data": "0x..."
  }
}
```

| Field                      | Description                                                   |
| -------------------------- | ------------------------------------------------------------- |
| `type`                     | `"evm"`                                                       |
| `block_number`             | Block height                                                  |
| `status`                   | `"success"` (`0x1`), `"failed"` (`0x0`), or `null` if pending |
| `confirmations`            | `latestBlock - blockNumber`                                   |
| `gas_used`                 | Gas units consumed                                            |
| `effective_gas_price_gwei` | Effective gas price formatted as a 4-decimal string (gwei)    |
| `nonce`                    | Sender nonce                                                  |
| `log_count`                | Number of event logs                                          |
| `input_data`               | Raw transaction calldata hex                                  |

### UTXO Chains

```json theme={null}
{
  "data": {
    "type": "utxo",
    "block_height": 842018,
    "confirmed_at": "2026-04-28T12:00:00.000Z",
    "fee_sat": 1820,
    "size": 412,
    "vsize": 240
  }
}
```

| Field          | Description                                |
| -------------- | ------------------------------------------ |
| `type`         | `"utxo"`                                   |
| `block_height` | Block height when confirmed                |
| `confirmed_at` | Block time as ISO-8601                     |
| `fee_sat`      | Total fee in satoshis                      |
| `size`         | Transaction size in bytes                  |
| `vsize`        | Virtual size (witness-discounted) in bytes |

### Unknown Chain

If the chain is not in either supported set:

```json theme={null}
{ "data": { "type": "unknown" } }
```

## Errors

| Status | Description                       |
| ------ | --------------------------------- |
| `400`  | Missing `hash` path parameter     |
| `500`  | Upstream RPC/explorer call failed |

## Examples

```bash theme={null}
# Ethereum
curl "https://api.leokit.dev/leokit/explorer/onchain/ETH/0xabc..."

# Arbitrum (alias)
curl "https://api.leokit.dev/leokit/explorer/onchain/ARBITRUM/0xdef..."

# Bitcoin
curl "https://api.leokit.dev/leokit/explorer/onchain/BTC/abc1234..."
```

## Notes

* EVM lookups return partial data if either `eth_getTransactionByHash` or `eth_getTransactionReceipt` fails — fields will be `null` rather than the request erroring out.
* This endpoint is intentionally chain-agnostic at the response level (`type` discriminates EVM vs UTXO). Future chains will use new `type` values.
* For multi-protocol swap status (the cross-chain settlement view), use [`/leokit/status`](/api-reference/transactions) instead.


## OpenAPI

````yaml /api-reference/openapi.json GET /explorer/onchain/{chain}/{hash}
openapi: 3.0.3
info:
  title: Leokit API
  version: 1.0.0
  description: API reference for Leokit
servers:
  - url: https://api.leokit.dev
    description: Production
security:
  - ApiKeyAuth: []
paths:
  /explorer/onchain/{chain}/{hash}:
    get:
      summary: Raw chain-state lookup
      parameters:
        - name: chain
          in: path
          required: true
          schema:
            type: string
          example: ETH
        - name: hash
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: >-
            Chain-specific transaction state. Body shape depends on chain family
            (evm or utxo).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExplorerOnchainResponse'
      security:
        - {}
components:
  schemas:
    ExplorerOnchainResponse:
      type: object
      required:
        - data
      properties:
        data:
          type: object
          additionalProperties: true
          properties:
            type:
              type: string
              enum:
                - evm
                - utxo
                - unknown
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Api-Key
      description: 'Demo API-Key (Sandbox): 7037d2b3-9c76-4f62-b730-c544f7570fa4'

````