Using Remix

Deploy Smart Contract

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

pageUsing Remix

Verify Smart Contract

Via flattened source code

  • Our deployed HelloWorld contract address is 0x1267b1887f0a7333a47bb0a37e68c04a8ee80a44

  • Navigate to the HelloWorld smart contract address in the KCC Testnet explorer

  • Find the Code sub-tab and click on Verify & Publish

  • Choose the via flattened source code and continue to the Next

  • Naming the smart contract

  • Select the appropriate compiler version

  • Copy and paste the flattened source code

  • Click Verify & Publish.

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

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:

// 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).

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

{
    "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.

Import the local JSON file.

Last updated