Blockscout smart-contract verification API
Blockscout also offers a contract verification API.
This is the preferred option for contract verification via API. However, you can also use RPC endpoints, more info is available here.
License type
You can specify license type of the smart contract as string
or number
. For example for GNU General Public License v2.0 (GNU GPLv2)
you could pass either 4
or "gnu_gpl_v2"
We are supporting such types of license as:
API license types:
Verify smart contract
Use the appropriate Blockscout instance endpoint to verify if the smart contract microservice is enabled.
In the following examples we use https://eth.blockscout.com to query Ethereum.
0x
contract addresses in POST example urls below should be replaced with your contract hash supplied on contract creation. Variables in the body are examples and should be replaced with your contract details.
Flattened contract
For more information on parameters to pass, see the flattened source code information on the Verifying a smart contract page.
{"compiler_version":"v0.8.17+commit.8df45f5f","license_type":"mit","source_code":"// SPDX-License-Identifier: GPL-3.0\n\npragma solidity >=0.7.0 <0.9.0;\n\n/**\n * @title Owner\n * @dev Set & change owner\n */\ncontract Owner {\n\n address private owner;\n \n // event for EVM logging 2345678ewqwertyui54567890987654345678\n event OwnerSet(address indexed oldOwner, address indexed newOwner);\n \n // modifier to check if caller is owner\n modifier isOwner() {\n // If the first argument of 'require' evaluates to 'false', execution terminates and all\n // changes to the state and to Ether balances are reverted.\n // This used to consume all gas in old EVM versions, but not anymore.\n // It is often a good idea to use 'require' to check if functions are called correctly.\n // As a second argument, you can also provide an explanation about what went wrong.\n require(msg.sender == owner, \"Caller is not owner\");\n _;\n }\n \n /**\n * @dev Set contract deployer as owner\n */\n constructor(uint112 abc, address abb, bytes32 ghnc) {\n // console.log(\"Owner contract deployed by:\", msg.sender);\n owner = msg.sender; // 'msg.sender' is sender of current call, contract deployer for a constructor\n emit OwnerSet(address(0), owner);\n }\n\n /**\n * @dev Change owner\n * @param newOwner address of new owner\n */\n function changeOwner(address newOwner) public isOwner {\n emit OwnerSet(owner, newOwner);\n owner = newOwner;\n }\n\n /**\n * @dev Return owner address \n * @return address of owner\n */\n function getOwner() external view returns (address) {\n return owner;\n }\n}","is_optimization_enabled":true,"optimization_runs":199,"contract_name":"Owner","libraries":{"Libcheck":"0x030f7c7dbd472864220bcf9e37ede1b8a3125970","Libcheck_1":"0x030f7c7dbd472864220bcf9e37ede1b8a3125970"},"evm_version":"berlin","autodetect_constructor_args":true}
No body
Via Standard JSON input
For more information on parameters to pass, see the flattened source code information on the Verifying a smart contract page. 0x
contract in POST example should be replaced with your contract hash.
v0.8.17+commit.8df45f5f
Owner
false
00000000000000000000000000000000000000000000000000000002d2982db3000000000000000000000000bb36c792b9b45aaf8b848a1392b0d6559202729e666f6f0000000000000000000000000000000000000000000000000000000000
gnu_gpl_v2
No body
Via Sourcify Files
For more information on parameters to pass, see the Contract Verification via Sourcify. 0x
contract in POST example url should be replaced with your contract hash, as should your relevant variables.
Multi-part Solidity files
v0.8.17+commit.8df45f5f
gnu_gpl_v3
true
{"Libcheck": "0x030f7c7dbd472864220bcf9e37ede1b8a3125970"}
london
199
No body
Vyper Contracts
{"compiler_version":"v0.2.12+commit.2c6842c","license_type":"gnu_agpl_v3","source_code":"from vyper.interfaces import ERC20\n\nimplements: ERC20\n\nevent Transfer:\n sender: indexed(address)\n receiver: indexed(address)\n value: uint256\n\nevent Approval:\n owner: indexed(address)\n spender: indexed(address)\n value: uint256\n\nname: public(String[64])\nsymbol: public(String[32])\ndecimals: public(uint256)\n\nbalanceOf: public(HashMap[address, uint256])\nallowance: public(HashMap[address, HashMap[address, uint256]])\ntotalSupply: public(uint256)\nminter: address\n_supply: uint256\n_check: uint256 #1% of the total supply check\n\n\n@external\ndef __init__():\n self._supply = 10_000_000_000 \n self._check = 100_000_000\n self.decimals = 18\n self.name = 'Kooopa'\n self.symbol = 'KOO'\n \n init_supply: uint256 = self._supply * 10 ** self.decimals\n \n self.balanceOf[msg.sender] = init_supply\n self.totalSupply = init_supply\n self.minter = msg.sender\n\n log Transfer(ZERO_ADDRESS, msg.sender, init_supply)\n\n\n@internal\ndef _transfer(_from : address, _to : address, _value : uint256) -> bool:\n assert _value <= self._check, 'Transfer limit of 1%(100 Million) Tokens'\n\n TargetBalance: uint256 = self.balanceOf[_to] + _value\n assert TargetBalance <= self._check, 'Single wallet cannot hold more than 1%(100 Million) Tokens'\n\n self.balanceOf[_from] -= _value\n self.balanceOf[_to] += _value\n log Transfer(_from, _to, _value)\n return True\n\n\n@external\ndef transfer(_to : address, _value : uint256) -> bool:\n self._transfer(msg.sender, _to, _value)\n return True\n\n\n@external\ndef transferFrom(_from : address, _to : address, _value : uint256) -> bool:\n self._transfer(_from, _to, _value)\n self.allowance[_from][msg.sender] -= _value\n return True\n\n\n@external\ndef approve(_spender : address, _value : uint256) -> bool:\n assert _value <= self._check, 'Cant Approve more than 1%(100 Million) Tokens for transfer'\n\n self.allowance[msg.sender][_spender] = _value\n log Approval(msg.sender, _spender, _value)\n return True\n\n\n@external\ndef mint(_to: address, _value: uint256):\n assert msg.sender == self.minter\n assert _to != ZERO_ADDRESS\n self.totalSupply += _value\n self.balanceOf[_to] += _value\n log Transfer(ZERO_ADDRESS, _to, _value)\n\n\n@internal\ndef _burn(_to: address, _value: uint256):\n \n assert _to != ZERO_ADDRESS\n self.totalSupply -= _value\n self.balanceOf[_to] -= _value\n log Transfer(_to, ZERO_ADDRESS, _value)\n\n\n@external\ndef burn(_value: uint256):\n self._burn(msg.sender, _value)\n\n\n@external\ndef burnFrom(_to: address, _value: uint256):\n self.allowance[_to][msg.sender] -= _value\n self._burn(_to, _value)","constructor_args":null,"contract_name":"Storage","evm_version":"istanbul"}
No body
Vyper Multi-part files
v0.3.7+commit.6020b8bb
gnu_lgpl_v2_1
istanbul
No body
Vyper Standard JSON input
v0.2.7+commit.0b3f3b3
gnu_lgpl_v3
istanbul
No body
Last updated
Was this helpful?