I'm trying to verify a simple contract programmatically on BSCScan testnet using their APIs as they have explained in their docs: verifying-contracts-programmatically.
I don't intend to use Hardhat or a similar tool.
I am doing this on a REACT APP. I am using AXIOS in my app to handle the POST method explained by Etherscan in their docs: Source Code Verification Procedure by Etherscan.io.
Here's my post method code: (values I have left blank are those that the docs have suggested can be left blank for default settings)
axios.post("https://api-testnet.bscscan.com/api", {
apikey: ">>MY API KEY<<", // I have retracted my API key here
module: "contract", //Do not change
action: 'verifysourcecode',
contractaddress: '0xF3A6da5375C795bbc9606a50b1246EA0a7921bEE',
sourceCode: "// SPDX-License-Identifier: MIT \npragma solidity ^0.5.0; \n\ncontract Test5 {\n\n}",
codeformat: 'solidity-single-file',
contractname:'Test5',
compilerversion: 'v0.5.5+commit.47a71e8f',
optimizationUsed: 1,
runs: 200,
constructorArguements: '',
evmversion: 'default',
licenceType: 3
})
.then((res) => {
console.log(res);
})
I am however getting this error:
{
"status": "0",
"message": "NOTOK",
"result": "Error! Missing Or invalid Module name"
}
I am still getting the same error even upon using POSTMAN. Here's my postman bulk edit data:
apikey:>>MY API KEY<<
module:contract
action:verifysourcecode
contractaddress:0xF3A6da5375C795bbc9606a50b1246EA0a7921bEE
sourceCode:// SPDX-License-Identifier: MIT↵ pragma solidity ^0.5.0;↵↵ contract Test5 {↵ ↵ }
codeformat:solidity-single-file
contractname:Test5
compilerversion:v0.5.5+commit.47a71e8f
optimizationUsed:1
runs:200
constructorArguements:
evmversion:
licenceType:3
Anyone knows where I could be doing it wrong? Any help or ideas are highly appreciated.
I had the same problem with other testnet and solved it: Just use "http" instead of "https".