> For the complete documentation index, see [llms.txt](https://worldkoisan.gitbook.io/koisan-international-coin/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://worldkoisan.gitbook.io/koisan-international-coin/koisan-chain/dapp-development/remix.md).

# Remix

[Remix](https://remix.ethereum.org/) is an online tool for contract development and deployment.

## Firstly, go to `Remix` <a href="#firstly-go-to-remix" id="firstly-go-to-remix"></a>

![](https://2103574787-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpKwizNWZIjDLi4j7LHIV%2Fuploads%2FVZzTc7YKA511r7fJ4drO%2Fremix_home.png?alt=media\&token=a3c5fb4d-fb73-4dfd-98be-e6a1f89393de)

In the left file browser, there are 3 folders under the example project default\_workspace:

* contracts：For contract file storage.
* scripts：For script file storage.
* tests：For test file storage.

We can refer to the sample project to create a new project.

## Edit Contract

Click file, such as `1_Storage.sol`, contents are editable on the right side.

![](https://2103574787-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpKwizNWZIjDLi4j7LHIV%2Fuploads%2FaCdVlmfg68ylcyVCVvvm%2Fremix_edit.png?alt=media\&token=3ce228b6-a845-4bde-b4b8-b8b480338a1b)

## Compile Contract <a href="#compile-contract" id="compile-contract"></a>

1. Click the left button to switch to Compile interface;
2. Set related compilation options;
3. Click the compile button to compile.

![](https://2103574787-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpKwizNWZIjDLi4j7LHIV%2Fuploads%2Fs7L16hMRige9b3uDqrEM%2Fremix_compile.png?alt=media\&token=b57a2866-f048-4e17-85bc-7d202105de92)

If you need to compile another contract, you must switch back to the file browser, select a new contract, and then switch to `Compile` interface to compile.

## Deploy Contract

To deploy a compiled contract on chain, a browser wallet plug-in is required. Taking `MetaMask` for instance:

Install `MetaMask` plug-in on browser, set network information, and save the above setting.

* Mainnet

```
rpc: https://rpc.koisan-chain.com
chainID: 312
symbol: KIC
explorer: https://explorer.koisan-chain.com
```

![](https://2103574787-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpKwizNWZIjDLi4j7LHIV%2Fuploads%2FrX3aTipqCceu6GdvvWft%2Fmetamask2_en%20\(1\).png?alt=media\&token=52c13253-af44-4fae-bd26-b0359679e541)

Switch back to `Remix` interface.

* Click the left button to switch to Deploy interface;
* Select 'injected Web3' and allow `MetaMask` to provide the execution environment;
* Click the deploy button.

![](https://2103574787-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpKwizNWZIjDLi4j7LHIV%2Fuploads%2FXRsds3viVSaVStjidQMG%2Fremix_deploy.png?alt=media\&token=63e466f1-dd07-4a4e-bf9d-7b9521ab58bc)

The contract is ready to be deployed on chain once `MetaMask` is confirmed.

## Interaction <a href="#interaction" id="interaction"></a>

With the contract deployed successfully, the deployed contract can be viewed under `Deployed Contracts`. Open contract and click the button to invoke contract method.

The interaction with the contract differentiates between writing data and reading data: Writing data is called a transaction, while reading data is defined as a call.

* Transactions: Fundamentally, it changes the state of the network. It can be a normal transaction, or a contract that is deployed or invoked. It takes gas to execute a transaction, and a certain amount of time for a transaction to be uploaded. Each transaction has a unique transaction hash.
* Calls: It does not cost gas to execute the code on the network and just reads data.

In the figure below, the yellow button initiates a transaction and the blue button initiates a call.

![](https://2103574787-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpKwizNWZIjDLi4j7LHIV%2Fuploads%2FY44jV4XIzIAIKUBuN2Em%2Fremix_interaction.png?alt=media\&token=b7a027cb-6e10-401d-9674-03c4bc9186d4)
