Smart Contract Submission
Submit your smart contract code for independent verification and publishing on Avascan
To successfully publish your smart contract souce code on Avascan, you need to take a few simple steps.
If you are deploying your token or smart contract using Remix, the compiler automatically uploads the source code to IPFS and appends its hash as metadata at the end of the code before deploying. The code includes all the comments and we can automatically verify it by pulling the code from IPFS, compiling and publish it if it's a perfect match.
However, if you do not deploy using Remix, chances are you didn't upload the source code to IPFS. We can still verify it, we won't be able to confirm if it's a perfect match, that is code and comments.

Endpoints

  • Mainnet: https://avascan.info/api/v1/verify-contract
  • Testnet: https://testnet.avascan.info/api/v1/verify-contract
To verify a smart contract you just need to execute the following command:
curl -X POST -H 'Content-type: application/json' -d '$BODY' https://avascan.info/api/v1/verify-contract
Where$BODY is:
{
"address": "CONTRACT_ADDRESS_HERE",
"solc": {
"version": "VERSION_OF_SOLC_COMPILER_HERE",
"options": {
"language":"Solidity",
"sources": {
"YOUR_CONTRACT_NAME_HERE.sol": {
"content": "YOUR_CONTRACT_CODE_HERE"
}
},
"settings": {
"outputSelection": {
"YOUR_CONTRACT_NAME.sol": {
"YOUR_CONTRACT_NAME": [
"*"
]
}
},
"optimizer": {
"enabled": TRUE_FALSE,
"runs": NUMBER_OF_RUNS_HERE
}
}
}
}
}

Submit using JavaScript

const fs = require("fs");
const got = require("got");
(async () => {
const contract = fs.readFileSync("./CONTRACT_NAME_HERE.sol", "utf-8");
const response = await got({
url: "https://avascan.info/api/v1/verify-contract",
method: "POST",
json: {
"address": "CONTRACT_ADDRESS_HERE",
"solc": {
"version": "VERSION_OF_SOLC_COMPILER_HERE",
"options": {
"language":"Solidity",
"sources": {
"Contract.sol": {
"content": CONTRACT_CODE_HERE
}
},
"settings": {
"outputSelection": {
"CONTRACT_NAME_HERE.sol": {
"CONTRACT_NAME": [
"*"
]
}
},
"optimizer": {
"enabled": TRUE_FALSE,
"runs": NUMBER_OF_RUNS_HERE
}
}
}
}
},
responseType: "json",
}).then(res => res.body);
console.log(response);
})();
NOTE: remove all the comments outside the .sol code itself to submit without errors. Our compiler won't accept JSON with comments.
We don't support implicit declaration for importing libraries. Please explicit all the libraries you are importing when submitting.
We currently don't support the Vyper programming language.
If you need any support just ask in our Discord server or our Telegram group.