Quaiscan smart-contract verification API
Quaiscan 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:
1. No License (None)
2. The Unlicense (Unlicense)
3. MIT License (MIT)
4. GNU General Public License v2.0 (GNU GPLv2)
5. GNU General Public License v3.0 (GNU GPLv3)
6. GNU Lesser General Public License v2.1 (GNU LGPLv2.1)
7. GNU Lesser General Public License v3.0 (GNU LGPLv3)
8. BSD 2-clause "Simplified" license (BSD-2-Clause)
9. BSD 3-clause "New" Or "Revised" license* (BSD-3-Clause)
10. Mozilla Public License 2.0 (MPL-2.0)
11. Open Software License 3.0 (OSL-3.0)
12. Apache 2.0 (Apache-2.0)
13. GNU Affero General Public License (GNU AGPLv3)
14. Business Source License (BSL 1.1)
API license types:
none
unlicense
mit
gnu_gpl_v2
gnu_gpl_v3
gnu_lgpl_v2_1
gnu_lgpl_v3
bsd_2_clause
bsd_3_clause
mpl_2_0
osl_3_0
apache_2_0
gnu_agpl_v3
bsl_1_1
Verify smart contract
Use the appropriate Quaiscan instance endpoint to verify if the smart contract microservice is enabled.
In the following examples we use https://quaiscan.io to query the network.
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}
POST /api/v2/smart-contracts/0xb12cad649a56e67188bbaa56583c18dc7d2812ed/verification/via/flattened-code HTTP/1.1
Host: eth.blockscout.com
Content-Type: application/json
Accept: */*
Content-Length: 2029
{
"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
}
Successful response
No content
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
POST /api/v2/smart-contracts/0x9c1c619176b4f8521a0ab166945d785b92aef453/verification/via/standard-input HTTP/1.1
Host: eth.blockscout.com
Content-Type: multipart/form-data
Accept: */*
Content-Length: 370
{
"compiler_version": "v0.8.17+commit.8df45f5f",
"contract_name": "Owner",
"files[0]": "binary",
"autodetect_constructor_args": "false",
"constructor_args": "00000000000000000000000000000000000000000000000000000002d2982db3000000000000000000000000bb36c792b9b45aaf8b848a1392b0d6559202729e666f6f0000000000000000000000000000000000000000000000000000000000",
"license_type": "gnu_gpl_v2"
}
Successful response
No content
Multi-part Solidity files
v0.8.17+commit.8df45f5f
gnu_gpl_v3
true
{"Libcheck": "0x030f7c7dbd472864220bcf9e37ede1b8a3125970"}
london
199
POST /api/v2/smart-contracts/0x030f7c7dbd472864220bcf9e37ede1b8a3125970/verification/via/multi-part HTTP/1.1
Host: eth.blockscout.com
Content-Type: multipart/form-data
Accept: */*
Content-Length: 271
{
"compiler_version": "v0.8.17+commit.8df45f5f",
"license_type": "gnu_gpl_v3",
"is_optimization_enabled": "true",
"libraries": "{\"Libcheck\": \"0x030f7c7dbd472864220bcf9e37ede1b8a3125970\"}",
"evm_version": "london",
"optimization_runs": "199",
"files[0]": "text",
"files[1]": "binary"
}
Successful response
No content
Last updated