Etherscan API "Error! Missing Or invalid Module name"

by DIGVJSS   Last Updated April 15, 2019 07:28 AM

I am using Etherscan.io APIs to verify my smart contract.

I have a very simple smart contract to test the verification process, here it is -

pragma solidity ^0.5.0;

contract HelloWorld {
    address public owner;
    constructor (address _owner) public{
        owner = _owner;
    }
}

This is deployed on address 0xB74580969Dd84f83fa7b36726968CB7cE24Ad4de. In the verification process, I am passing the payload to etherscan API with the necessary details as shown below -

var sourceCode = fs.readFileSync(path.join(__dirname, '../../ERC20-Mintable-Contract/contract.sol'), 'utf8');

        var data = {
            apikey: contractConfig.ETHERSCAN_API_KEY,
            module: 'contract',
            action: 'verifysourcecode',
            contractaddress: contractAddress,
            sourceCode: sourceCode,
            contractname: contractConfig.CONTRACT_NAME,
            compilerversion: contractConfig.COMPILER_VERSION,
            optimizationUsed: 1,
            runs: 200,
            constructorArguements: '00000000000000000000000066f0ee075909d28c38f374d72154b32ee5663f34',
        };

        axios.post('https://api-ropsten.etherscan.io/api', data)
            .then( async response => {
                res.status(200).json({
                    status: true
                });
            })
            .catch(error => {
                res.status(400);
                return;
            });

This fails with below error as output -

{
    status: '0',
    message: 'NOTOK',
    result: 'Error! Missing Or invalid Module name' 
}

Your help is much appreciated!

Thanks!



Related Questions


Updated June 28, 2018 10:28 AM

Updated October 24, 2018 12:28 PM

Updated December 05, 2017 15:28 PM

Updated March 14, 2019 22:28 PM

Updated August 10, 2018 12:28 PM