Quaiscan
  • Quaiscan Open-Source Explorer
  • ๐Ÿ™ŽUsing Quaiscan
    • Getting Started
      • Glossary of Terms
      • Main Menu
      • Blocks
      • Transaction Types
    • Token Support
      • ERC-1155 Support
  • ๐Ÿ‘ฉโ€๐Ÿ’ปDeveloper Support
    • Quaiscan API
      • REST API Endpoints
      • GraphQL
      • JSON RPC & Quai Compatible RPC Endpoints
        • Account
        • Block
        • Contract
        • Logs
        • Stats
        • Token
        • Transaction
        • Quai RPC API
    • Smart Contract Verification
      • Quaiscan UI
      • Quaiscan smart-contract verification API
      • Hardhat Verification Plugin
    • Local Deployment
  • FAQs
    • User FAQs
    • Developer FAQs
  • ๐ŸงฉResources
    • Media kit
    • Release Notes
      • v1.0.0
    • Discussion
    • GitHub Repo
Powered by GitBook
On this page
Export as PDF
  1. Developer Support
  2. Smart Contract Verification

Quaiscan smart-contract verification API

Quaiscan also offers a contract verification API.

PreviousQuaiscan UINextHardhat Verification Plugin

Last updated 7 months ago

This is the preferred option for contract verification via API. However, you can also use RPC endpoints, .

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

Via Standard JSON input

Multi-part Solidity files

For more information on parameters to pass, see the .

For more information on parameters to pass, see the . 0x contract in POST example should be replaced with your contract hash.

๐Ÿ‘ฉโ€๐Ÿ’ป
flattened source code information on the Verifying a smart contract page
flattened source code information on the Verifying a smart contract page
more info is available here

verification service running

get
Responses
200
Successful response
application/json
get
GET /api/v2/smart-contracts/verification/config HTTP/1.1
Host: eth.blockscout.com
Accept: */*
200

Successful response

No content

  • License type
  • Verify smart contract
  • GETverification service running
  • Flattened contract
  • POSTverification flattened contract
  • Via Standard JSON input
  • POSTverification standard json
  • Multi-part Solidity files
  • POSTverification multipart Copy

verification flattened contract

post
Body
objectOptionalExample: {"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}
Responses
200
Successful response
application/json
post
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
}
200

Successful response

No content

verification standard json

post
Body
compiler_versionnumberOptionalExample: v0.8.17+commit.8df45f5f
contract_namestringOptionalExample: Owner
files[0]string ยท binaryOptional
autodetect_constructor_argsbooleanOptionalExample: false
constructor_argsstringOptionalExample: 00000000000000000000000000000000000000000000000000000002d2982db3000000000000000000000000bb36c792b9b45aaf8b848a1392b0d6559202729e666f6f0000000000000000000000000000000000000000000000000000000000
license_typestringOptionalExample: gnu_gpl_v2
Responses
200
Successful response
application/json
post
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"
}
200

Successful response

No content

verification multipart Copy

post
Body
compiler_versionnumberOptionalExample: v0.8.17+commit.8df45f5f
license_typestringOptionalExample: gnu_gpl_v3
is_optimization_enabledbooleanOptionalExample: true
librariesstringOptionalExample: {"Libcheck": "0x030f7c7dbd472864220bcf9e37ede1b8a3125970"}
evm_versionstringOptionalExample: london
optimization_runsintegerOptionalExample: 199
files[0]stringOptional
files[1]string ยท binaryOptional
Responses
200
Successful response
application/json
post
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"
}
200

Successful response

No content