# Remix-IDE를 이용한 컨트랙트 배포

리믹스 (Remix Project)는 컨트랙트 개발의 전 과정에서 필요한 기술 및 기능을 개발자가 사용할 수 있도록 지원하는 개발 도구이며, 이더리움을 배우고 실험할 수 있는 교육 플랫폼으로도 사용됩니다.

{% hint style="info" %}
모든 블록체인에 컨트랙트를 배포할 때는 해당 체인의 네이티브 토큰을 사용하여 배포 가스 수수료를 지불해야 하며, 이는 디카르고도 마찬가지입니다. 디카르고 테스트넷 Warehouse에 배포하기 전에 [faucet](/undefined-4/undefined.md)을 통해 $DKA 테스트넷 토큰을 획득할 수 있습니다.

Remix는 [메타마스크](/undefined-1/undefined.md)에 등록된 지갑을 이용하여 블록체인과 상호작용을 합니다.&#x20;
{% endhint %}

## STEP 1 - 리믹스 시작

1. [리믹스 (Remix)](https://remix.ethereum.org/)에 접속합니다. **File Explorer**로 이동한 후 **≡** 를 선택합니다. 옵션 중에서 **\[ + Create Blank ]**&#xB97C; 선택하여 새로운  워크 스페이스 (Workspace)를 생성합니다.
2. 새 파일 <mark style="color:blue;">`counter.sol`</mark>을 생성하고 컨트랙트 코드를 입력하거나 아래 샘플 코드를 사용합니다.

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
 
contract Counter {
    uint256 public number;
 
    function setNumber(uint256 newNumber) public {
        number = newNumber;
    }
 
    function increment() public {
        number++;
    }
}
```

3. **\[ Solidity Compile ]** 사이드바 옵션으로 이동하여 <mark style="color:blue;">`counter.sol`</mark> 컴파일을 선택합니다.

## STEP 2 - 컨트랙트 배포

1. 사이드바 옵션 **\[ Deploy & run transactions ]** 으로 이동합니다.
2. 드롭 다운 **ENVIRONMENT**을 **"Injected Provider - MetaMask"**&#xB85C; 변경합니다.
3. 메타마스크에서 **\[ Connect ]** 을 눌러 리믹스 액세스를 허용합니다.

<figure><img src="/files/2Mk6VQr1c6Ev8wuKUZHY" alt="" width="563"><figcaption></figcaption></figure>

4. 메타마스크 연결이 완료되면 **\[ Deploy ]** 버튼을 클릭하여 컨트랙트를 배포합니다.

<figure><img src="/files/RzlayEjM8r9E4cTrRSLe" alt="" width="563"><figcaption></figcaption></figure>

5. 배포된 컨트랙트는[ 디스캐너 (dScanner)의 Verified Contracts](https://warehouse.dscanner.io/contracts-verified) 메뉴에서 확인할 수 있습니다.

## STEP 3 - 컨트랙트와 상호 작용

1. 컨트랙트를 배포한 후에는 왼쪽 아래 탭에서 컨트랙트와 상호 작용을 할 수 있습니다.

<figure><img src="/files/o2BAoJeSFVzdr9Vm0o95" alt="" width="563"><figcaption></figcaption></figure>

2. **\[ Number ]** 를 선택하여 컨트랙트에 저장된 숫자를 조회합니다. 컨트랙트 배포 후, 숫자는 0으로 초기화된 상태입니다.

<figure><img src="/files/8pAriL2y1181a8h4hfk0" alt="" width="279"><figcaption></figcaption></figure>

3. **\[ increment ]**&#xB97C; 클릭하여 숫자에 +1을 동작하는 트랜잭션을 전송합니다. 메타마스크에서 트랜잭션을 확인(Confirm)하여 트랜잭션을 디카르고 체인에 전송합니다.

<figure><img src="/files/Y5HM02EP8ZLyRGfHKvIm" alt="" width="563"><figcaption></figcaption></figure>

4. **\[ number ]** 를 선택하여 1이 증가한 숫자를 확인합니다.

<figure><img src="/files/vw08jJrZQINkIVqhU861" alt="" width="280"><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.dkargo.io/undefined-3/remix-ide.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
