# Deploy with Remix

[Remix](https://remix.live/) is a no-setup toolset for developing smart contracts. Used by experts and beginners alike, Remix will get you going in no time.

Remix is available as [a web-based environment](https://remix.ethereum.org/), [a desktop program](https://github.com/remix-project-org/remix-desktop), and even [a CLI tool](https://www.npmjs.com/package/@remix-project/remixd).\
In this page, we will use the web-based version.

{% hint style="info" %}
You can also use the [official Remix IDE documentation for creating and deploying a contract](https://remix-ide.readthedocs.io/en/latest/create_deploy.html).
{% endhint %}

Here is how to deploy a smart contract using Remix Online IDE:

1. Go to [<mark style="color:blue;">https://remix.ethereum.org</mark>](https://remix.ethereum.org). The Remix IDE opens in your browser.<br>

   <figure><img src="https://3400301555-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4L7rBH2rmyoBTn93MSdx%2Fuploads%2FMZOYayLjtrlGeyMFdiKg%2Fimage.png?alt=media&#x26;token=3a010c84-bdc9-43a3-ba40-b00516b9db2b" alt=""><figcaption></figcaption></figure>
2. Click the "Create a new Workspace" button, then choose an option: blank workspace, AI-generated workspace, contract wizard, project import, or git repository cloning. You also rely on categorized workspace templates.\
   For the purpose of this tutorial, we'll use an OpenZeppelin ERC20 workspace template. You can of course deploy your own smart contract using a blank workspace.

{% hint style="info" %}
Chiliz's Fan Tokens are CAP20 tokens, which are Chiliz Chain-specific extension of the Ethereum ERC20 token standard. [Learn more about CAP20 here](https://docs.chiliz.com/learn/glossary/cap-20).
{% endhint %}

3. Scroll down to the "OpenZeppelin" template category, and click the "ERC20" template.

<figure><img src="https://3400301555-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4L7rBH2rmyoBTn93MSdx%2Fuploads%2F7vyh45CQ9s61zSgnQQhb%2Fimage.png?alt=media&#x26;token=55241811-cb36-434d-9bf4-6b155197a685" alt=""><figcaption></figcaption></figure>

{% hint style="success" %}
[OpenZeppelin](https://www.openzeppelin.com/) is an open-source platform for building secure dApps.&#x20;

In addition to several security and auditing services, they provide [a library of community-vetted smart contracts](https://docs.openzeppelin.com/contracts/), free for the community to use in their projects.

OpenZeppelin contracts are considered industry standards, and you can safely use them.
{% endhint %}

4. Give your ERC20 token a name using the form that Remix displays, then click the "Validate workspace" button.

<figure><img src="https://3400301555-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4L7rBH2rmyoBTn93MSdx%2Fuploads%2FoTBCuX4a30gQbWPC56U2%2Fimage.png?alt=media&#x26;token=c4e849bb-8f9d-4190-a5f3-278341cd57aa" alt=""><figcaption></figcaption></figure>

Once you validate your choice, Remix loads a standard workspace with folders and files that appear in the File Explorer on the left. Click in the `/contracts/{token name}.sol` file to display the ERC20 contract that you are about to deploy:

<figure><img src="https://3400301555-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4L7rBH2rmyoBTn93MSdx%2Fuploads%2Fyykjnjfm6DdvdFjA1WSl%2Fimage.png?alt=media&#x26;token=fbc718e0-d8a4-441f-a3a0-6d5b933bc54d" alt=""><figcaption></figcaption></figure>

As you can see, the default `MyToken.sol` smart contract imports the `ERC20.sol` contract from OpenZeppelin.\
\&#xNAN;*You can open the `.deps/npm/@openzeppelin/contracts/token/ERC20/ERC20.sol` file to display the ERC20 contract itself.*

You are free to edit your `MyToken.sol` contract as you see fit. \
For instance, in order to work with the Chiliz Chain EVM, your contract should rely on Solidity 0.8.24 at most, so make this change:

```solidity
pragma solidity ^0.8.24;
```

... and select the relevant compiler:

<div align="left"><figure><img src="https://3400301555-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4L7rBH2rmyoBTn93MSdx%2Fuploads%2FJpCDXfg0hAO2J1s743uK%2Fimage.png?alt=media&#x26;token=d2eb6daf-4f39-43e8-8638-a228ed3be06d" alt="" width="277"><figcaption></figcaption></figure></div>

5. Click the "Compil&#x65;**"** above your contract file.\
   ![](https://3400301555-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4L7rBH2rmyoBTn93MSdx%2Fuploads%2F0voFzQ0PIy37OSf6epgq%2Fimage.png?alt=media\&token=f3bc6b87-6f54-4cd2-bd18-2a5df718d090)

If there are no mistakes in your changes, Remix IDE should display a green checkmark in the "Solidity Compiler" menu on the left:

<div align="left"><figure><img src="https://3400301555-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4L7rBH2rmyoBTn93MSdx%2Fuploads%2FYoclOXW9FxJLDQadYtY4%2Fimage.png?alt=media&#x26;token=ce1d7419-9f32-4457-a6b5-f4ad3347a174" alt="" width="338"><figcaption></figcaption></figure></div>

6. Open the "Deploy & run transactions" section.<br>

   <figure><img src="https://3400301555-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4L7rBH2rmyoBTn93MSdx%2Fuploads%2FSz3YJvH4YJQoFHq9qgkn%2Fimage.png?alt=media&#x26;token=b6611802-f084-498a-85b6-0c788f8466d5" alt=""><figcaption></figcaption></figure>

* Select "Browser Extension > Injected Provider - MetaMask" in the "Environment" dropdown menu. This will link the deployed token to your MetaMask account — which should be configured to work with Chiliz Chain already (if not, [see here](https://docs.chiliz.com/learn/about-wallets/how-to-use-metamask/link-chiliz-chain-and-metamask)).
* Make sure that Remix displays the correct network: Chiliz Chain Mainnet.\
  ![](https://3400301555-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4L7rBH2rmyoBTn93MSdx%2Fuploads%2FFgVyyby82yGEwDnf8qmz%2Fimage.png?alt=media\&token=813d941c-cec9-401f-be67-a9618f4abf63)
* Make sure that your contract file is selected and that the chosen EVM version is "Shangai".\
  If not, it means your compiler version was not set to v0.8.24 (see above), go back to Step 4.\
  ![](https://3400301555-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4L7rBH2rmyoBTn93MSdx%2Fuploads%2FNT1K56bqjFa3CT49WkJf%2Fimage.png?alt=media\&token=18fe2cdb-9519-4ed5-92a0-6875acfed616)
* Click "Deploy & Verify".\
  \&#xNAN;*If you prefer to just deploy the contract then verify the contract by yourself, you can have Remix deploy the contract by unchecking the "Verify Contract on Explorers" box.*

{% hint style="warning" %}
Make sure to have enough CHZ on your wallet to pay for the deployment transactions!
{% endhint %}

7. Your MetaMask wallet should open automatically.&#x20;

<figure><img src="https://3400301555-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4L7rBH2rmyoBTn93MSdx%2Fuploads%2FmD8Zemg0qr38US35ITm7%2Fimage.png?alt=media&#x26;token=89add66a-2441-4099-9c53-212318a4e44c" alt="" width="375"><figcaption></figcaption></figure>

8\. Click "Confirm" to link your MetaMask Wallet with your token's smart contract.\
You should receive a notification confirming the transaction within a few seconds, along with an invitation to view the transaction on the [Chiliscan](https://chiliscan.com/) block explorer.

From the transaction, you can can access the deployed contract itself (here, the link after "Contract"):

<figure><img src="https://3400301555-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4L7rBH2rmyoBTn93MSdx%2Fuploads%2Fsz4rzgruPoVUXtNuwBIl%2Fimage.png?alt=media&#x26;token=6dcb6c97-3d35-41b8-95dd-ada7a15b0d6d" alt=""><figcaption></figcaption></figure>

In your MetaMask wallet, under the *"*&#x41;ctivity" tab, you will see the contract deployment information. Click it to see all the information about it:

<figure><img src="https://3400301555-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4L7rBH2rmyoBTn93MSdx%2Fuploads%2FxbdCTYr6H4VwFlRFUaa6%2Fimage.png?alt=media&#x26;token=9ed56e67-6d74-4f24-89ce-96d2a0e39c1c" alt="" width="329"><figcaption></figcaption></figure>

Congratulations! Your contract is now deployed on Chiliz Chain!

Now it is time to verify it:

{% content-ref url="../verify-a-smart-contract" %}
[verify-a-smart-contract](https://docs.chiliz.com/develop/basics/verify-a-smart-contract)
{% endcontent-ref %}


---

# 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.chiliz.com/develop/basics/deploy-a-smart-contract/deploy-with-remix.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.
