eth_getCode

OptimismC1

Returns the compiled contract bytecode stored at an address. An empty result ("0x") means the address is an EOA or has no code at that block.

Endpoint
POST https://api.1st-node.com/v1/optimism/rpc

Parameters

NameTypeDescription
addressDATA, 20 bytesAddress to read code from.
blockQUANTITY | TAGBlock number or tag.

Returns

DATA — the bytecode at the address, or "0x" if none.

Request

curl https://api.1st-node.com/v1/optimism/rpc \
  -H "Authorization: Bearer $ONE_KEY" \
  -H "content-type: application/json" \
  -d '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_getCode",
  "params": ["0xdac17f958d2ee523a2206206994597c13d831ec7", "latest"]
}'
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_getCode",
  "params": ["0xdac17f958d2ee523a2206206994597c13d831ec7", "latest"]
}

Response

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x606060405236156100..."
}
More state methods on Optimism

Optimism API

Частые вопросы

How do I tell a contract from a wallet?

A wallet (EOA) returns "0x"; a contract returns non-empty bytecode.

Пополнили, получили ключ, запустили.

Полное самообслуживание. Оплата криптой или картой. Тарификация в кредитах — тяжёлые примитивы дороже, простые дёшевы.

Получить API-ключ