0

For some contracts, the Etherscan api returns empty bytecode (0x). For example for:

For some other contracts, the API functions properly:

I need the deployed bytecode to implement my simulation of the EXTCODEHASH opcode.

Does the API not function properly?

The source code of my API call for clarity:

@classmethod
def _fetch_contract_source_code(cls, contract_address, api_key, api_base_url):
    params = {
        'module': 'proxy',
        'action': 'eth_getCode',
        'address': contract_address,
        'apikey': api_key
    }

    response = requests.get(api_base_url, params=params)

    if response.status_code != 200:
        raise Exception(f'Error fetching source code: {response.status_code} - {response.text}')

    data = response.json()

    if len(data['result']) < 3:
        return False

    return data['result'];

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.