Using Remix IDE

This page describes how to deploy smart contracts using Remix IDE.

Remix IDE

Remix IDE is used for the entire journey of smart contract development by users at every knowledge level. It requires no setup, fosters a fast development cycle, and has a rich set of plugins with intuitive GUIs. The IDE comes in two flavors (web app or desktop app) and as a VSCode extension.

Remix Online IDE, see: https://remix.ethereum.org

Steps

  1. Add 'Kroma Mainnet' to your wallet, you can refer to the Configure your wallet.

  2. Select the Environment Injected Provider - MetaMask.

  3. Accept the connection in the wallet.

  1. Make sure your environment is Injected Web3 and the network ID is '255'.

  2. Write the source code - testContract.sol.

// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.0;

contract testContract {

    uint256 value;

    constructor (uint256 _p) {
        value = _p;
    }

    function setP(uint256 _n) payable public {
        value = _n;
    }

    function setNP(uint256 _n) public {
        value = _n;
    }

    function get () view public returns (uint256) {
        return value;
    }
}
  1. The constructor of testContract needs a parameter (of type uint256). Input a uint256 and click on Deploy.

  2. Confirm the transaction in the wallet.

  1. Scroll down. In the At Address field, type the contract address. Then, click At Address. Expand the contract to see you can interact with it.

  2. You can view your transactions through Block Explorer.

e.g - Deploy ERC20 Token Contract
// contracts/GLDToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract GLDToken is ERC20 {
    constructor(uint256 initialSupply) ERC20("Gold", "GLD") {
        _mint(msg.sender, initialSupply);
    }
}

Input value 1000000000000000000000, click 'Deploy' button.

Last updated