> ## Documentation Index
> Fetch the complete documentation index at: https://docs.validationcloud.io/llms.txt
> Use this file to discover all available pages before exploring further.

# eth_getCode

Returns code at a given address.

This method will use `40` [Compute Units](https://docs.validationcloud.io/nodeapi/about/billing.md).

***

> [!NOTE]
>
> Cronos Mainnet keeps state for the last 362,880 blocks, about 42 hours at Cronos's block time of under half a second. Requests for an older block return JSON-RPC error `-32000` with a message that contains `failed to load state at height`.

## Reference: [Here](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getcode)

## **Parameters**

1. `DATA`, 20 Bytes - address.
2. `QUANTITY|TAG` - integer block number, or the string `"latest"`, `"earliest"` or `"pending"`, see the [default block parameter](https://ethereum.org/en/developers/docs/apis/json-rpc/#default-block-parameter)

```javascript theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
params: [
  "0x5c7f8a570d578ed84e63fdfa7b1ee72deae1ae23",
  "latest"
]
```

## Returns

`DATA` - the code from the given address.

```json theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
// Result
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x6080604052600436106100c05760003560e01c8063313ce56711610074578063a9059cbb1161004e578063a9059cbb146102b2578063d0e30db0146102eb5780..."
}
```

```bash title="mainnet" theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
curl https://mainnet.cronos.validationcloud.io/v1/<YOUR_API_KEY_HERE> \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_getCode","params":["0x5c7f8a570d578ed84e63fdfa7b1ee72deae1ae23","latest"],"id":1}'
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.