POST
/
evm
eth_getCode
curl --request POST \
  --url https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/evm \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "eth_getCode",
  "params": [
    "0x5555555555555555555555555555555555555555",
    "latest"
  ],
  "id": 1
}'
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c8063a9059cbb1461003b578063dd62ed3e14610057575b600080fd5b610055600480360381019061005091906101a7565b610087565b005b610071600480360381019061006c91906101e7565b6100a5565b60405161007e9190610236565b60405180910390f35b8173ffffffffffffffffffffffffffffffffffffffff16ff5b60008173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156100e0576000905061012c565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610120576001905061012c565b60009050610131565b809150505b92915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061016782610138565b9050919050565b6101778161015c565b811461018257600080fd5b50565b6000813590506101948161016e565b92915050565b6000819050919050565b6101ad8161019a565b81146101b857600080fd5b50565b6000813590506101ca816101a4565b92915050565b600080604083850312156101e7576101e6610133565b5b60006101f585828601610185565b9250506020610206858286016101bb565b9150509250929050565b600080604083850312156102275761022661013357600080fd5b5b600061023585828601610185565b925050602061024685828601610185565b9150509250929050565b6102598161019a565b82525050565b60006020820190506102746000830184610250565b9291505056fea2646970667358221220..."
}
The eth_getCode JSON-RPC method returns the bytecode of a smart contract at a given address and block. This method is essential for contract verification, analysis, and determining whether an address contains a smart contract or is 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

The method takes two parameters:
  1. Address - The contract address to retrieve bytecode from
  2. Block parameter - The block at which to retrieve the code

Parameter details

  • address (string, required) — The 20-byte address to retrieve code from
  • block (string, required) — Block identifier: "latest" (only the latest block is supported on Hyperliquid)

Response

The method returns the contract bytecode as a hexadecimal string, or "0x" if no code exists at the address.

Hyperliquid-specific considerations

Block limitations

Latest block only:
  • Only the "latest" block parameter is supported
  • Historical contract code queries are not available in the default implementation
  • All code retrieval is performed against the current state
  • For historical analysis, consider using archive node implementations

Contract analysis

Address classification:
  • Distinguish between contracts and EOAs efficiently
  • "0x" indicates an externally owned account (EOA)
  • Non-empty bytecode indicates a smart contract
  • Use for implementing different handling logic for different address types

Example request

This an example call with wrapped HYPE (wHYPE) on the Hyperliquid mainnet deployed at 0x5555555555555555555555555555555555555555.
Shell
curl -X POST \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"eth_getCode","params":["0x5555555555555555555555555555555555555555","latest"],"id":1}' \
  https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/evm

Use cases

The eth_getCode method is essential for applications that need to:
  • Address classification: Distinguish between smart contracts and EOAs
  • Contract verification: Verify deployed contracts against expected bytecode
  • Security analysis: Analyze contract bytecode for security patterns
  • Block explorers: Display contract information and verification status
  • Development tools: Build contract analysis and debugging tools
  • Wallet applications: Verify contract authenticity before interactions
  • DeFi protocols: Analyze and verify protocol contract implementations
  • Integration services: Provide contract information to external systems
On Hyperliquid, eth_getCode only supports the latest block. The returned bytecode is the runtime code deployed on the blockchain, not the constructor code. For EOAs (externally owned accounts), this method returns "0x".

Body

application/json

Response

200 - application/json

Successful response with the contract bytecode

The response is of type object.