본문으로 건너뛰기
This page uses machine translation from English, which may contain errors or unclear language. For the most accurate information, please see the original English version. Some content may be in the original English due to frequent updates. Help us improve this page's translation by joining our effort on Crowdin. (Crowdin translation page, Contributing guide)

Remix를 카이아에 연결하기

Overview

Remix는 Solidity 컨트랙트를 개발하기 위한 브라우저 기반 IDE(통합 개발 환경)입니다. 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

계정 가져오기

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

  • Click plus button next to the ACCOUNT.
  • 개인키 또는 키저장소를 입력합니다.
  • 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].
  • 네트워크에 성공적으로 연결되면 연결된 네트워크의 체인 ID와 계정이 표시됩니다.

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.

  • MetaMask 팝업이 표시되면 해당 계정을 클릭하여 선택합니다.
  • 네트워크에 성공적으로 연결되면 연결된 네트워크의 체인 ID와 계정이 표시됩니다.

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.
페이지를 개선해 주세요