/publishSmartContractCode
1 min
POST
http://1.1.1.1/publishSmartContractCode
contract_addressstring<p>the address of the deployed Ethereum smart contract, should start with 0x, e.g. 0x4c113f627fe35231fd11131a9974b9a99f584cb6</p>
source_codestring<p>the source code of the Ethereum smart contract (flattened if necessary)</p>
contract_namestring<p>if code_format="solidity-single-file", this should be the name appears in the contract declaration</p>
<ul>
<li>
<p>For example: contract EIP20 { ... } - the contract name in this case is EIP20</p>
</li>
<li>
<p>If code_format=solidity-standard-json-input, then enter contract_name as: token_name.sol</p><div></div><p></p>
</li>
</ul>
compiler_versionstring<p>the version of the Solidity compiler in which the contract was compiled</p>
<ul>
<li>see <a href="https://etherscan.io/solcversions" target="_blank">https://etherscan.io/solcversions</a> for list of supported versions</li>
</ul>
optimization_usedbooleanwhether the contract code was compiled with optimisations
code_formatstring<p>solidity-single-file (default) or solidity-standard-json-input (for std-input-json-format support)</p>
bodyobject
200success
curl --request POST \
--url 'http://1.1.1.1/publishSmartContractCode?contract_address=0x4c113f627fe35231fd11131a9974b9a99f584cb6&source_code=contract%20EIP20%20{%20...%20}&contract_name=EIP20&compiler_version=v0.8.22-nightly.2023.9.19%2Bcommit.cc7a14a6&optimization_used=true&code_format=solidy-single-file' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"FunctionData": {
"contract_address": "0x4c113f627fe35231fd11131a9974b9a99f584cb6",
"source_code": "solidity",
"contract_name": "token_name.sol:token_name",
"compiler_version": "v0.8.22-nightly.2023.9.19+commit.cc7a14a6",
"optimization_used": "true",
"code_format": "solidity-single-file"
},
"Meta": {
"FunctionName": "publishSmartContractCode",
"RandomData": "288cd49d4b8bf00e7d6114b78d5668d5581d6b953fafef779133caa844cd4229",
"Destination": "b9cb8afe52f1d52521cf2b62dfe12146156ad5328f83c62c20c7da81b263356a61340de745c858998544c041798b01c2f4fac31bebe52a19280a32cd57d6d374ea",
"Time": "2021-02-07T18:37:46.948Z",
"Source": "048b99461a70a49abe63fd585cb224177a22a92d2e9e4ddfbc0027887bee9d1843388f42a3eb2e740565e115ad8b7981abf59e3b03b771f4b063b53c517d7a9d99",
"AccessToken": "51311c84d2c8fd2fafbe56ceb1fb30a99d3417abfc55769577338ab286798087"
}
}'- Provides a way to verify and publish Ethereum smart contract source code in Etherscan, so that users will be able to inspect and verify that it does what it claims to do