Skip to main content
Glama

is_contract

Verify if an address is a smart contract or an externally owned account (EOA) on Ethereum and EVM-compatible networks using a unified interface.

Instructions

Check if an address is a smart contract or an externally owned account (EOA)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYesThe wallet or contract address or ENS name to check (e.g., '0x1234...' or 'uniswap.eth')
networkNoNetwork name (e.g., 'ethereum', 'optimism', 'arbitrum', 'base', etc.) or chain ID. Supports all EVM-compatible networks. Defaults to Ethereum mainnet.

Implementation Reference

  • The core handler function that implements the logic to check if a given address or ENS name corresponds to a contract by retrieving and checking its bytecode. Returns true if bytecode exists and is not empty ('0x'), false otherwise.
    export async function isContract(addressOrEns: string, network = 'ethereum'): Promise<boolean> { // Resolve ENS name to address if needed const address = await resolveAddress(addressOrEns, network); const client = getPublicClient(network); const code = await client.getBytecode({ address }); return code !== undefined && code !== '0x'; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mcpdotdirect/evm-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server