Home

Get contract bytecode at an address

POST
https://vinu.nownodes.io/

Authorizations

ApiKeyAuthApiKeyAuth

api-key string

NOWNodes API key passed in the api-key header.

Returns the contract code stored at a given address. If the address is an externally owned account (EOA), it returns "0x".

State access is limited to recent blocks - these are full nodes, not archive nodes. In practice only the last dozen or so blocks resolve; deeper block parameters return -32000 missing trie node <hash> (path ). earliest also works, since genesis state is kept. Use latest or pending for anything that must not fail: the pruning boundary moves continuously, so a height taken from eth_blockNumber can already be out of range by the time you query it.

Block, transaction and receipt history is complete back to block 1 - only state is pruned.

Block tags accepted by this node: earliest, latest, pending, or a hex block number. safe and finalized are NOT supported and fail with -32602 invalid argument N: hex string without 0x prefix - Lachesis aBFT finalises immediately, so there is no separate safe/finalized head.

Body

application/json
jsonrpcstringrequired

JSON-RPC version.

methodstringrequired

JSON-RPC method name.

paramsArray<string>required

Parameters array with two elements:

  1. The address to get the code for (hex string, 0x-prefixed).
  2. The block number or block tag (e.g., "latest", "earliest", "pending").
idintegerrequired

Request identifier.

Response

200OK

Contract bytecode in hex format

405Method Not Allowed

Method not served by this endpoint. The body is the plain-text string Method Not Allowed, not JSON.

422Unprocessable Entity

Missing API key - the api-key header was absent. The body is the plain-text string Missing API_key, not JSON.