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

# ots_hasCode | Hyperliquid EVM

> The ots_hasCode JSON-RPC method checks whether a specified address contains deployed contract code on the Hyperliquid EVM blockchain.

<Info>
  This method is available on Chainstack. Not all Hyperliquid methods are available on Chainstack, as the open-source node implementation does not support them yet — see [Hyperliquid methods](/docs/hyperliquid-methods) for the full availability breakdown.
</Info>

The `ots_hasCode` JSON-RPC method checks whether a specified address contains deployed contract code on the Hyperliquid EVM blockchain. This Otterscan-specific method provides a quick way to determine if an address is a smart contract or an externally owned account (EOA).

<Check>
  **Get your own node endpoint today**

  [Start for free](https://console.chainstack.com/) and get your app to production levels immediately. No credit card required.

  You can sign up with your GitHub, X, Google, or Microsoft account.
</Check>

## Parameters

1. **address** (string, required): The address to check for deployed code
2. **block identifier** (string, optional): The block at which to check the code
   * Can be a block number, block hash, or one of: `"earliest"`, `"latest"`, `"pending"`
   * Defaults to `"latest"`

## Response

The method returns a boolean value indicating whether the address contains code.

### Response structure

* `true` — the address contains deployed contract code
* `false` — the address is an EOA or does not exist

## Usage example

```shell Shell theme={"system"}
curl -X POST https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/evm \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "ots_hasCode",
    "params": ["0x5555555555555555555555555555555555555555", "latest"],
    "id": 1
  }'
```

### Example response

```json theme={"system"}
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
```

### Check at specific block

```shell Shell theme={"system"}
curl -X POST https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/evm \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "ots_hasCode",
    "params": ["0x5555555555555555555555555555555555555555", "0x1000"],
    "id": 1
  }'
```

## Use cases

The `ots_hasCode` method is essential for:

* **Address classification**: Quickly determine if an address is a contract or EOA
* **Transaction validation**: Check if transaction targets are contracts before sending
* **Security checks**: Verify addresses before interacting with them
* **UI differentiation**: Display different interfaces for contracts vs EOAs
* **Gas estimation**: Optimize gas estimates based on target address type
* **Contract verification**: Confirm successful contract deployment
* **Historical analysis**: Check when contracts were deployed by testing different blocks
* **Wallet integration**: Warn users when sending to contracts vs regular addresses
* **Smart contract interaction**: Pre-validate addresses before calling contract methods
* **Block explorer optimization**: Efficiently categorize addresses without fetching full code

This method provides a lightweight alternative to `eth_getCode` when you only need to know if code exists, not the actual bytecode itself.


## OpenAPI

````yaml /openapi/hyperliquid_node_api/evm_ots_has_code.json post /evm
openapi: 3.0.0
info:
  title: Hyperliquid EVM API - ots_hasCode
  version: 1.0.0
servers:
  - url: >-
      https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274
security: []
paths:
  /evm:
    post:
      summary: ots_hasCode
      description: >-
        Check if an address contains deployed contract code on Hyperliquid EVM.
        Efficiently determine if an address is a smart contract.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - jsonrpc
                - method
                - params
                - id
              properties:
                jsonrpc:
                  type: string
                  enum:
                    - '2.0'
                  default: '2.0'
                  description: JSON-RPC version
                method:
                  type: string
                  enum:
                    - ots_hasCode
                  default: ots_hasCode
                  description: The RPC method name
                params:
                  type: array
                  description: 'Parameters: [address, block identifier (optional)]'
                  default:
                    - '0x5555555555555555555555555555555555555555'
                    - latest
                id:
                  type: integer
                  default: 1
                  description: Request identifier
            example:
              jsonrpc: '2.0'
              method: ots_hasCode
              params:
                - '0x5555555555555555555555555555555555555555'
                - latest
              id: 1
      responses:
        '200':
          description: Successful response indicating if address has code
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                    description: JSON-RPC version
                  id:
                    type: integer
                    description: Request identifier
                  result:
                    type: boolean
                    description: True if address has code, false otherwise
              example:
                jsonrpc: '2.0'
                id: 1
                result: true

````