# 2. How to Use Ethereum IDE?

## 1. Write a contract

Upon entering the project, the README.md file included in the folder will be automatically previewed.

<figure><img src="https://3745657014-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MYy-lqJKjq1m0yBAX4r%2Fuploads%2F8VmfiMkZoJlHhjlXkstG%2Fimage.png?alt=media&#x26;token=08b40b27-b54f-4e31-8cb9-8aea38f2b8bf" alt=""><figcaption></figcaption></figure>

In the Explorer panel, you can create new files (or folders), refresh the directory, and download files. You can also directly click on the files that come with the template.

<figure><img src="https://3745657014-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MYy-lqJKjq1m0yBAX4r%2Fuploads%2FE2cSwSZdbKLZK5YN7XGK%2Fimage.png?alt=media&#x26;token=47ea9493-d238-474e-ab62-17a9d1f83dd3" alt=""><figcaption></figcaption></figure>

Click on a contract file to edit the code.

<figure><img src="https://3745657014-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MYy-lqJKjq1m0yBAX4r%2Fuploads%2Fc3NCif0cmQb6idg1jY4z%2Fimage.png?alt=media&#x26;token=a3bfae68-88a5-480d-b296-de50afd1b019" alt=""><figcaption></figcaption></figure>

## 2. Compile a contract

Once your contract code is written, click on the "Compiler" button in the right-side menu to open the compilation module. Choose the compiler version and decide whether to enable optimization, then click "Compile \*\*\*.sol" to initiate the compilation.

<figure><img src="https://3745657014-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MYy-lqJKjq1m0yBAX4r%2Fuploads%2FQS6C9NkM83qjij2cjinx%2Fimage.png?alt=media&#x26;token=f8a692d6-dd2e-4b97-916f-63488e2d691c" alt=""><figcaption></figcaption></figure>

After successful compilation, the [ABI](https://docs.soliditylang.org/en/latest/abi-spec.html) and BYTE CODE will be displayed below, and you'll see a message in the console stating "Compile contract success."

<figure><img src="https://3745657014-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MYy-lqJKjq1m0yBAX4r%2Fuploads%2FczE48oDmrmEi2hNWpGds%2Fimage.png?alt=media&#x26;token=3f51d9b4-063e-48dd-a60e-b13b54bc0781" alt="" width="326"><figcaption></figcaption></figure>

## 3. Connect to Ethereum EVM

Before deploying a contract, you need to click on "Connect Wallet" in the upper right corner and select to connect to JavaScript VM (used for testing, implemented in JavaScript) or Metamask (for deployment on the Ethereum blockchain).

<figure><img src="https://3745657014-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MYy-lqJKjq1m0yBAX4r%2Fuploads%2FLRhasXHh6XnfX6AsxOko%2Fimage.png?alt=media&#x26;token=81c389b6-c8b0-43c2-a26e-7f5ee01d60c9" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3745657014-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MYy-lqJKjq1m0yBAX4r%2Fuploads%2F4uXSxMyzRDWHccETN2da%2Fimage.png?alt=media&#x26;token=685f6089-6a5a-4c25-85b6-48895dd919ad" alt=""><figcaption></figcaption></figure>

## 4. Deploy a contract

Click the "Deploy & Interaction" button on the right-hand side, which will bring up the deployment and interaction pages. Select the compiled contract and click "Deploy" to initiate the deployment (then confirm in Metamask). After successful contract deployment, the console will display the contract deployment result and relevant information.

<figure><img src="https://3745657014-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MYy-lqJKjq1m0yBAX4r%2Fuploads%2FpeIYpktLaqFHufnv9tya%2Fimage.png?alt=media&#x26;token=3be48138-2531-4101-8cf6-9ef8ef03eca6" alt=""><figcaption></figcaption></figure>

In addition, you can click "Import Deployed Contract" to import a contract that has already been deployed for contract interactions.

<figure><img src="https://3745657014-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MYy-lqJKjq1m0yBAX4r%2Fuploads%2FeYKAxnJtXAtt0xoYCULR%2Fimage.png?alt=media&#x26;token=808db479-b96d-4416-abad-a0af351a5aac" alt=""><figcaption></figcaption></figure>

## 5. Contract interaction

After a successful contract deployment, you can interact with the contract. Click on the deployed contract, choose the corresponding interface, and click "Submit" or "Get" to perform interactions.

<figure><img src="https://3745657014-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MYy-lqJKjq1m0yBAX4r%2Fuploads%2F6Te1Fw0bJAAe9EzpT1VB%2Fimage.png?alt=media&#x26;token=70056b9e-defc-459a-ab28-388a1da67544" alt=""><figcaption></figcaption></figure>

## 6. Transaction Query

Click on the transaction hash in the Output section to view the specific details of each transaction.

<figure><img src="https://3745657014-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MYy-lqJKjq1m0yBAX4r%2Fuploads%2FBvl2Q2N9HFnmV51s0Xkz%2Fimage.png?alt=media&#x26;token=dfec2d96-6a6d-417c-abc8-3de98491546a" alt=""><figcaption></figcaption></figure>

## 7. Verify the Contract

If you wish to open-source your smart contract on a blockchain explorer, please refer to [ChainIDE Verifier](https://chainide.gitbook.io/chainide-english-1/chainide-modules/4.7-plug-in-system-module/2.7.3.-chainide-scan-verifier) or [ChainIDE Flattener](https://chainide.gitbook.io/chainide-english-1/chainide-modules/4.7-plug-in-system-module/2.7.2.-chainide-flattener-plugin).

## 8. Ethereum EVM Sandbox

If you prefer using the command line for development, you can open the Ethereum EVM Sandbox, which comes pre-loaded with [Hardhat](https://hardhat.org/), [Truffle](https://trufflesuite.com/), [Brownie](https://eth-brownie.readthedocs.io/en/stable/), [Ganache](https://trufflesuite.com/ganache/), [Git](https://git-scm.com/) and [Node.js V16](https://nodejs.org/en).

<figure><img src="https://3745657014-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MYy-lqJKjq1m0yBAX4r%2Fuploads%2FPgfHTgYUyMl4W4lxljDV%2Fimage.png?alt=media&#x26;token=b781c8b6-c6a0-416c-9d37-a3e45605f693" alt=""><figcaption></figcaption></figure>

If you've started a process on a port in the Sandbox and wish to access that port, please refer to [ChainIDE - Port Forwarding](https://chainide.gitbook.io/chainide-english-1/port-forwarding).


---

# 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://chainide.gitbook.io/chainide-english-1/ethereum-ide-1/1.-ethereum-ide/quick-demo.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.
