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).
Get your own node endpoint todayStart for free and get your app to production levels immediately. No credit card required.You can sign up with your GitHub, X, Google, or Microsoft account.
Parameters
- address (string, required): The address to check for deployed code
- 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"
- Can be a block number, block hash, or one of:
Response
The method returns a boolean value indicating whether the address contains code.Response structure
true
— the address contains deployed contract codefalse
— the address is an EOA or does not exist
Usage example
Shell
Example response
Check at specific block
Shell
Use cases
Theots_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
eth_getCode
when you only need to know if code exists, not the actual bytecode itself.Body
application/json