License type
You can specify license type of the smart contract asstring 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:
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.verification service running
GET https://eth.blockscout.com/api/v2/smart-contracts/verification/config
Responses
200 Successful response
200 Successful response
200 Successful Response
Flattened contract
For more information on parameters to pass, see the flattened source code information on the Verifying a smart contract page.verification flattened contract
POST https://eth.blockscout.com/api/v2/smart-contracts/0xb12cad649a56e67188bbaa56583c18dc7d2812ed/verification/via/flattened-code
Body
Example:
{"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}200 Successful response
200 Successful response
200 Successful Response
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.
verification standard json
POST https://eth.blockscout.com/api/v2/smart-contracts/0x9c1c619176b4f8521a0ab166945d785b92aef453/verification/via/standard-input
Body
string
Example:
v0.8.17+commit.8df45f5fstring
Example:
Ownerstring . binary
boolean
Example:
falsestring
Example:
00000000000000000000000000000000000000000000000000000002d2982db3000000000000000000000000bb36c792b9b45aaf8b848a1392b0d6559202729e666f6f0000000000000000000000000000000000000000000000000000000000string
Example:
gnu_gpl_v2200 Successful response
200 Successful response
200 Successful Response
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.
verification sourcify
POST https://eth.blockscout.com/api/v2/smart-contracts/0x030f7c7dbd472864220bcf9e37ede1b8a3125970/verification/via/sourcify
Body
string
integer
Example:
4200 Successful response
200 Successful response
200 Successful Response
Multi-part Solidity files
verification multipart Copy
POST https\://eth.blockscout.com/api/v2/smart-contracts/0x030f7c7dbd472864220bcf9e37ede1b8a3125970/verification/via/multi-part
Body
number
Example:
v0.8.17+commit.8df45f5fstring
Example:
gnu_gpl_v3boolean
Example:
truestring
Example:
{"Libcheck": "0x030f7c7dbd472864220bcf9e37ede1b8a3125970"}string
Example:
londoninteger
Example:
199string
string . binary
200 Successful response
200 Successful response
200 Successful Response
Vyper Contracts
verification vyper contract
POST https://eth.blockscout.com/api/v2/smart-contracts/0xd73249995040f04cb891bdf0f997579ee3a6676c/verification/via/vyper-code
Body
Example:
{"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"}200 Successful response
200 Successful response
200 Successful Response
Vyper Multi-part files
verification multipart vyper
POST https://eth.blockscout.com/api/v2/smart-contracts/0xc3fd3c09d5481f4d6c85e70775804de4c93fe630/verification/via/vyper-multi-part
Body
number
Example:
v0.3.7+commit.6020b8bbstring
Example:
gnu_lgpl_v2_1string
Example:
istanbulstring . binary
string . binary
string . binary
string . binary
string . binary
200 Successful response
200 Successful response
200 Successful Response
Vyper Standard JSON input
verification standard json vyper
POST https://eth.blockscout.com/api/v2/smart-contracts/0xc3fd3c09d5481f4d6c85e70775804de4c93fe630/verification/via/vyper-standard-input
Body
number
Example:
v0.2.7+commit.0b3f3b3string
Example:
gnu_lgpl_v3string
Example:
istanbulstring . binary
string . binary
200 Successful response
200 Successful response
200 Successful Response