# eth_getCode - Get Neuroweb Contract Bytecode

Retrieves the compiled bytecode of a smart contract deployed on the Neuroweb network. This method is essential for contract verification, security analysis, and understanding deployed contract functionality on Ethereum's Layer 2 infrastructure.

## Request Parameters

- `address` (`string, required`): The 20-byte address of the contract (0x-prefixed hex string)
- `blockNumber/blockTag` (`string, required`): Block number in hex (e.g., "0x1b4") or block tag: "latest", "earliest", "pending", "safe", "finalized"

## Request Example

```json
{
  "jsonrpc": "2.0",
  "method": "eth_getCode",
  "params": [
    "<address>",
    "<blockNumber/blockTag>"
  ],
  "id": 1
}
```

## Response Fields

- `result` (`string, required`): Hex-encoded bytecode starting with "0x". Returns "0x" for EOA addresses

## Successful Response

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x608060405234801561001057600080fd5b50600436106101735760003560e01c80638da5cb5b116100de578063c87b56dd11610097578063e985e9c511610071578063e985e9c5146104a2578063f2fde38b146104de578063f46a04eb146104fa578063f5298aca1461051657610173565b8063c87b56dd1461044a578063d547741f14610466578063e8a3d4851461048257610173565b80638da5cb5b146103a657806391d14854146103c457806395d89b41146103e0578063a217fddf146103fe578063a22cb4651461041c578063bd85b0391461043857610173565b80632f2ff15d1161013057806336568abe1161010a57806336568abe146103285780634e1273f414610344578063715018a6146103745780638456cb591461037e57610173565b80632f2ff15d146102cc5780633659cfe6146102e85780633f4ba83a1461030457610173565b8062fdd58e1461017857806301ffc9a71461019857806306fdde03146101c85780630e89341c146101e6578063248a9ca3146102065780632eb2c2d614610236575b600080fd5b610182600480360381019061017d9190611c3a565b610532565b60405161018f9190611c89565b60405180910390f35b6101b260048036038101906101ad9190611cfc565b6105fa565b60405161..."
}
```

## Code Examples

cURL
JavaScript
Python

```bash
# Get bytecode for USDC contract on Ethereum
curl -X POST https://api-neuroweb.n.dwellir.com/YOUR_API_KEY \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "eth_getCode",
    "params": [
      "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
      "latest"
    ],
    "id": 1
  }'
```

```javascript
// Get bytecode for Ethereum's official bridge contract
const response = await fetch('https://api-neuroweb.n.dwellir.com/YOUR_API_KEY', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    jsonrpc: '2.0',
    method: 'eth_getCode',
    params: [
      '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
      'latest'
    ],
    id: 1
  })
});

const data = await response.json();
console.log('Contract bytecode:', data.result);

// Check if address is a contract or EOA
if (data.result === '0x') {
  console.log('Address is an EOA (no contract code)');
} else {
  console.log('Address contains contract code');
}
```

```python
import requests
import json

# Get bytecode for Coinbase's cbETH contract on Ethereum
url = "https://api-neuroweb.n.dwellir.com/YOUR_API_KEY"
payload = {
    "jsonrpc": "2.0",
    "method": "eth_getCode",
    "params": [
        "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",  # cbETH on Ethereum
        "latest"
    ],
    "id": 1
}

response = requests.post(url, json=payload)
result = response.json()

if result['result'] == '0x':
    print("Address is an EOA")
else:
    print(f"Contract bytecode: {result['result'][:100]}...")  # First 100 chars
    print(f"Bytecode length: {len(result['result'])} characters")
```

## Important Notes

### EOA vs Contract Addresses

- **Contract addresses**: Return the actual bytecode of the deployed smart contract
- **EOA addresses**: Return "0x" as they contain no contract code
- Use this method to programmatically distinguish between EOAs and contracts

### Use Cases

- **Contract verification**: Compare deployed bytecode with source code
- **Security analysis**: Analyze contract functionality and potential vulnerabilities
- **Proxy detection**: Identify proxy contracts and their implementation patterns
- **Contract interaction**: Understand contract capabilities before interaction

### Ethereum-Specific Considerations

- Neuroweb is the main Layer 1 blockchain using Proof of Stake consensus
- Bytecode format is identical to Neuroweb mainnet
- Gas costs for contract deployment and execution are significantly lower
- Full compatibility with Neuroweb smart contracts and tooling

***

*Need help? Contact our [support team](mailto:support@dwellir.com) or check the [Neuroweb documentation](https://www.dwellir.com/docs/neuroweb).*
