Skip to main content

Connect Remix to Kaia

Overview ​

Remix is a browser-based IDE (Integrated Development Environment) for developing Solidity contracts. In this guide, you will learn how to:

  • Create and Upload a pre-built smart contract on Remix IDE.
  • Compile the smart contract.
  • Connect to Kaia Plugin for Remix IDE
  • Set up deployment environment
  • Import account
  • Connect Kaia to Remix using Kaia Wallet
  • Connect Kaia to Remix using MetaMask
  • Deploy the smart contract.
  • Verify the smart contract.

This will cover connecting Remix with Kaia. If you want to know more about how to use Remix, please refer to Remix docs or Remix IDE.

Creating a file on Remix ​

To start building a smart contract, click on New File icon in the contracts folder in the File explorer tab and name it KaiaGreeter.sol

Next is to copy and paste the smart contract code provided below into the newly created KaiaGreeter.sol file.


// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
import "hardhat/console.sol";
contract KaiaGreeter {
uint256 totalGreetings;
constructor() {
console.log("Yo yo, Welcome to Kaia");
}
function greet() public {
totalGreetings += 1;
console.log(msg.sender, "says hello kaia!");
}
function getTotalGreetings() public view returns (uint256) {
console.log("We have %d total waves!", totalGreetings);
return totalGreetings;
}
}

Compile smart contract ​

To compile your contract, do the following:

  • Go to the Solidity Compiler tab
  • Select compiler version to 0.8.27
  • Turn on the 'Auto compile' option.
  • Cliick on the Compile KaiaGreeter.sol button to compile KaiaGreeter.sol contract.
  • After successful compilation, it will show a green tick mark on the Compiler tab button

Connect to Kaia Plugin on Remix IDE ​

To connect to Kaia plugin on Remix IDE, you can either use this Kaia Plugin for Remix or follow this step:

  • Navigate to the Plugin manager tab
  • Insert Klaytn in the search field
  • Activate the Klaytn plugin. If Klaytn tab appears, you are ready to interact with Kaia.

Setting up deployment environment ​

  • Click on the Klaytn plugin.
  • Select the appropriate [Environment].
  • You can select Kairos, Mainnet, Injected Provider - Kaia Wallet, Injected Provider - MetaMask
    • [Kairos]: Connects to the Kairos network
    • [Mainnet]: Connects to the Mainnet
    • [Injected Provider - Kaia Wallet]: Connects to Kaia Wallet
    • [Injected Provider - MetaMask ]: Connects to Metamask

Import account ​

You can export private key or Keystore from any compatible wallet to use here.

  • Click plus button next to the ACCOUNT.
  • Then put private key or keystore.
  • You can also import keys for the feePayer. It only supports private key.

Connecting Kaia to Remix using Kaia Wallet ​

  • Select [Injected Provider - Kaia Wallet] on the Remix Environment menu.

  • When you see the Kaia Wallet pop-up, click [Connect].
  • Once you are successfully connected to the Network, you will see the Chain ID and Account of the connected network.

Connecting Kaia - Remix using MetaMask ​

  • Connect Kaia with MetaMask by referring to the Connecting to MetaMask.
  • Select [Injected Provider - MetaMask] on the Remix Environment menu.

  • When you see the MetaMask pop-up, select the account by clicking it.
  • Once you are successfully connected to the Network, you will see the Chain ID and Account of the connected network.

Deploying the smart contract ​

In this section, we will deploy the KaiaGreeter.sol contract using Kaia Wallet. Having compiled the contract in the Compile Section, follow the deployment process below:

  • Set your deployment ENVIRONMENT to Injected Provider - Kaikas Wallet. Make sure to confirm all the connection prompts to Remix.
  • Select the contract you want to deploy in the CONTRACT field.
  • Click on the Deploy button. This would generate a Kaia Wallet popup that requires transaction confirmation. Simply confirm the transaction!

  • You can view the deployed contract on Kaiascan, and also test or debug it on Remix IDE.
Make this page better