# Using Remix

## Deploy Smart Contract

You can refer to this tutorial on using Remix to deploy contracts.

{% content-ref url="../deploy-smart-contract/using-remix" %}
[using-remix](https://docs.kcc.io/developers/deploy-smart-contract/using-remix)
{% endcontent-ref %}

## Verify Smart Contract

### Via flattened source code

* &#x20;Our deployed `HelloWorld` contract address is `0x1267b1887f0a7333a47bb0a37e68c04a8ee80a44`
* Navigate to the HelloWorld smart contract address in the [KCC Testnet explorer](https://scan-testnet.kcc.network/)
* Find the **Code** sub-tab and click on **Verify & Publish**

<figure><img src="https://2372007595-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Tecsoe4KNURIiIXeVdO%2Fuploads%2FMKD0PspBIHEwDxTs2L5i%2Fimage.png?alt=media&#x26;token=039d06f3-7a1d-41cf-8ff1-196ecc38b296" alt=""><figcaption></figcaption></figure>

* Choose the `via flattened source code` and continue to the **Next**

<figure><img src="https://2372007595-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Tecsoe4KNURIiIXeVdO%2Fuploads%2FxGqmGCZQiLoFXjgpANiG%2Fimage.png?alt=media&#x26;token=e8f4730d-56c8-48ee-a081-f5adb69d9c6a" alt=""><figcaption></figcaption></figure>

* Naming the smart contract
* Select the appropriate compiler version
* Copy and paste the flattened source code
* Click **Verify & Publish**.

<figure><img src="https://2372007595-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Tecsoe4KNURIiIXeVdO%2Fuploads%2Fzys2Z4uVBMGnAlIfVuQ9%2Fimage.png?alt=media&#x26;token=9a6403be-7d92-48d8-9e5b-009b54a0401c" alt=""><figcaption></figcaption></figure>

* KCC Testnet will take a few seconds to compile your contract, verify, and publish it.

<figure><img src="https://2372007595-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Tecsoe4KNURIiIXeVdO%2Fuploads%2Fi0HdKr7NbbiUNV2s3y8U%2Fimage.png?alt=media&#x26;token=1c3c1e26-6ca7-4472-abd6-e8d54ab594d6" alt=""><figcaption></figcaption></figure>

### Via Standard Input JSON

Standard input json is basically the raw file fed into the Solidity compiler on verification. There are some minor updates made regarding info the output compiler should return, but the main contract-related fields remain the same. This way, standard json allows you to specify the most subtle compiler settings, as well as to specify all source files.

It is quite cumbersome and tedious work, so it is preferable to use any of the above methods, however, we describe the process in more detail for those who want to use it.

For this tutorial, we will create standard json for the following contract:

```solidity
// SPDX-License-Identifier: MIT
// Specifies that the source code is for a version
// of Solidity greater than 0.8.15
pragma solidity ^0.8.15;

contract HelloWorld {

    // A publicly accessible function that takes a string as a parameter
    // and echoes the `message`
    function echo(string memory message) public pure returns (string memory) {
        return message;
    }
}
```

1\) We will use a `COMPILERINPUT` file generated by the compiler. You can find it in the “Compilation Details” tab (ensure that correct contract is chosen).&#x20;

<figure><img src="https://2372007595-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Tecsoe4KNURIiIXeVdO%2Fuploads%2Fie2QjllscnovVWTgXu1Y%2Fimage.png?alt=media&#x26;token=25359394-c85f-48ba-acf2-b128201e8665" alt=""><figcaption></figcaption></figure>

Create a JSON file locally and paste the copied content into the JSON file.

```json
{
    "language":"Solidity",
    "sources":{
        "HelloWorld.sol":{
            "content":"// SPDX-License-Identifier: MIT\n// Specifies that the source code is for a version\n// of Solidity greater than 0.8.15\npragma solidity ^0.8.15;\n\ncontract HelloWorld {\n\n    // A publicly accessible function that takes a string as a parameter\n    // and echoes the `message`\n    function echo(string memory message) public pure returns (string memory) {\n        return message;\n    }\n}"
        }
    },
    "settings":{
        "optimizer":{
            "enabled":true,
            "runs":200
        },
        "outputSelection":{
            "*":{
                "":[
                    "ast"
                ],
                "*":[
                    "abi",
                    "metadata",
                    "devdoc",
                    "userdoc",
                    "storageLayout",
                    "evm.legacyAssembly",
                    "evm.bytecode",
                    "evm.deployedBytecode",
                    "evm.methodIdentifiers",
                    "evm.gasEstimates",
                    "evm.assembly"
                ]
            }
        }
    }
}
```

2\) Submit composed standard json for verification “`Via Standard Input JSON`” and check results.

<figure><img src="https://2372007595-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Tecsoe4KNURIiIXeVdO%2Fuploads%2Fiom82f1iQqWJiWXdebre%2Fimage.png?alt=media&#x26;token=17e41927-5aee-4c0e-bc22-9030c550ca56" alt=""><figcaption></figcaption></figure>

Import the local JSON file.

<figure><img src="https://2372007595-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Tecsoe4KNURIiIXeVdO%2Fuploads%2Fohpkypr3qEyKHWihcWu9%2Fimage.png?alt=media&#x26;token=3bb283a3-bbfb-473e-83d3-2a059da48b05" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2372007595-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Tecsoe4KNURIiIXeVdO%2Fuploads%2Ff3Azg7zVPiZo7fFCfltr%2Fimage.png?alt=media&#x26;token=6e1bb50c-2d6b-4e1b-b4ae-362f7e02ec01" alt=""><figcaption></figcaption></figure>
