> For the complete documentation index, see [llms.txt](https://startower.gitbook.io/star-tower-chain/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://startower.gitbook.io/star-tower-chain/untitled/smart-contract-verification/startower-smart-contract-verification-api.md).

# StarTower smart-contract verification API

StarTower 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 <a href="#license-type" id="license-type"></a>

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 <a href="#verify-smart-contract" id="verify-smart-contract"></a>

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 <a href="#api-v2-smart-contracts-verification-config" id="api-v2-smart-contracts-verification-config"></a>

Responses

200Successful response

{% hint style="info" %} <mark style="background-color:orange;">`0x`</mark> <mark style="background-color:orange;"></mark><mark style="background-color:orange;">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.</mark>
{% endhint %}

### Flattened contract <a href="#flattened-contract" id="flattened-contract"></a>

For more information on parameters to pass, see the flattened source code information on the Verifying a smart contract page.

#### verification flattened contract <a href="#api-v2-smart-contracts-0xb12cad649a56e67188bbaa56583c18dc7d2812ed-verification-via-flattened-code" id="api-v2-smart-contracts-0xb12cad649a56e67188bbaa56583c18dc7d2812ed-verification-via-flattened-code"></a>

post <https://www.savwscan.com/api/v2/smart-contracts/0xb12cad649a56e67188bbaa56583c18dc7d2812ed/verification/via/flattened-code>

Body

object optional

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}`Responses200Successful response

### Via Standard JSON input <a href="#via-standard-json-input" id="via-standard-json-input"></a>

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 <a href="#api-v2-smart-contracts-0x9c1c619176b4f8521a0ab166945d785b92aef453-verification-via-standard-input" id="api-v2-smart-contracts-0x9c1c619176b4f8521a0ab166945d785b92aef453-verification-via-standard-input"></a>

<mark style="color:orange;background-color:orange;">**post**</mark>  [www.savwscan.com/api/v2/smart-contracts/0x9c1c619176b4f8521a0ab166945d785b92aef453/verification/via/standard-input](http://www.savwscan.com/api/v2/smart-contracts/0x9c1c619176b4f8521a0ab166945d785b92aef453/verification/via/standard-input)

Body

files\[0]stringoptionalchosen\_contract\_indexintegeroptional

Example: `4`

Responses

200Successful response

### Multi-part Solidity files <a href="#multi-part-solidity-files" id="multi-part-solidity-files"></a>

#### verification multipart Copy <a href="#api-v2-smart-contracts-0x030f7c7dbd472864220bcf9e37ede1b8a3125970-verification-via-multi-part" id="api-v2-smart-contracts-0x030f7c7dbd472864220bcf9e37ede1b8a3125970-verification-via-multi-part"></a>

<mark style="color:orange;background-color:orange;">**post**</mark>  <https://www.savwscan.com/api/v2/smart-contracts/0x030f7c7dbd472864220bcf9e37ede1b8a3125970/verification/via/multi-part>

Body

compiler\_versionnumberoptional

Example: `v0.8.17+commit.8df45f5f`

license\_typestringoptional

Example: `gnu_gpl_v3`

is\_optimization\_enabledbooleanoptional

Example: `true`

librariesstringoptional

Example: `{"Libcheck": "0x030f7c7dbd472864220bcf9e37ede1b8a3125970"}`

evm\_versionstringoptional

Example: `london`

optimization\_runsintegeroptional

Example: `199`

files\[0]stringoptional

files\[1]string · binaryoptional

Responses

200Successful response

### Vyper Contracts <a href="#vyper-contracts" id="vyper-contracts"></a>

#### verification vyper contract <a href="#api-v2-smart-contracts-0xd73249995040f04cb891bdf0f997579ee3a6676c-verification-via-vyper-code" id="api-v2-smart-contracts-0xd73249995040f04cb891bdf0f997579ee3a6676c-verification-via-vyper-code"></a>

&#x20;<mark style="color:orange;background-color:orange;">**post**</mark> <https://www.savwscan.com/api/v2/smart-contracts/0xd73249995040f04cb891bdf0f997579ee3a6676c/verification/via/vyper-code>

Body

object optional

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"}`

Responses

200Successful response

### Vyper Multi-part files <a href="#vyper-multi-part-files" id="vyper-multi-part-files"></a>

#### verification multipart vyper <a href="#api-v2-smart-contracts-0xc3fd3c09d5481f4d6c85e70775804de4c93fe630-verification-via-vyper-multi-part" id="api-v2-smart-contracts-0xc3fd3c09d5481f4d6c85e70775804de4c93fe630-verification-via-vyper-multi-part"></a>

&#x20;<mark style="color:orange;background-color:orange;">**post**</mark> <https://www.savwscan.com/api/v2/smart-contracts/0xc3fd3c09d5481f4d6c85e70775804de4c93fe630/verification/via/vyper-multi-part>

Body

compiler\_versionnumberoptional

Example: `v0.3.7+commit.6020b8bb`

license\_typestringoptional

Example: `gnu_lgpl_v2_1`

evm\_versionstringoptional

Example: `istanbul`

files\[0]string · binaryoptional

files\[1]string · binaryoptional

interfaces\[0]string · binaryoptional

interfaces\[1]string · binaryoptional

interfaces\[2]string · binaryoptional

Responses

200Successful response

### Vyper Standard JSON input <a href="#vyper-standard-json-input" id="vyper-standard-json-input"></a>

#### verification standard json vyper <a href="#api-v2-smart-contracts-0xc3fd3c09d5481f4d6c85e70775804de4c93fe630-verification-via-vyper-standard-in" id="api-v2-smart-contracts-0xc3fd3c09d5481f4d6c85e70775804de4c93fe630-verification-via-vyper-standard-in"></a>

&#x20;<mark style="color:orange;background-color:orange;">**post**</mark> <https://www.savwscan.com/api/v2/smart-contracts/0xc3fd3c09d5481f4d6c85e70775804de4c93fe630/verification/via/vyper-standard-input>

Bodycompiler\_versionnumberoptional

Example: `v0.2.7+commit.0b3f3b3`

license\_typestringoptional

Example: `gnu_lgpl_v3`

evm\_versionstringoptional

Example: `istanbul`

files\[0]string · binaryoptional

files\[1]string · binaryoptional

Responses

200Successful response
