# Smart Contract

## Remix

{% embed url="<https://remix.ethereum.org>" %}
Online Solidity Editor
{% endembed %}

Setup DxChain 3.0 in [Metamask](https://dxchain.gitbook.io/dxchain-wiki/stake-and-trade/stake-on-dxchain/wallet), select `injected web3`for the environment in Remix, keep the same with the network in Metamask.

![](https://402733873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ft7Yq0wZVG1pJ3PiTzoaE%2Fuploads%2Fzfga2W2PbcM1kwYtPoyz%2Fimage.png?alt=media\&token=c0906491-2aae-4d06-9e7d-4163653ce372)

Create`sol` file, write smart contracts

```solidity
// SPDX-License-Identifier: GPL-3.0

pragma solidity >=0.7.0 <0.9.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract TestToken is ERC20("TestToken", "TT") {}

```

![](https://402733873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ft7Yq0wZVG1pJ3PiTzoaE%2Fuploads%2FVywxe0mQOhVkc7Hi34Zy%2Fimage.png?alt=media\&token=833311b3-db38-40e6-a9e3-4d5bd86ad62a)

Select the appropriate version of the `solidity` compiler, set automatic compilation and optimization, then perform contract compilation.

![](https://402733873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ft7Yq0wZVG1pJ3PiTzoaE%2Fuploads%2Fm4uRAevv5AaoLvqnEDzv%2Fimage.png?alt=media\&token=da227b25-c8c4-44d5-9887-1c898504ec9b)

Select the `injected web3` network to deploy the smart contract.

![](https://402733873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ft7Yq0wZVG1pJ3PiTzoaE%2Fuploads%2FrIx8plxJjpxqmRixD5Za%2Fimage.png?alt=media\&token=b0102cce-610c-49c9-b3c3-6a8017991c53)

The contract deployment is completed after the transaction is sent.

![](https://402733873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ft7Yq0wZVG1pJ3PiTzoaE%2Fuploads%2FkmYFg8VkOlbdocemW25L%2Fimage.png?alt=media\&token=7f72b5c8-f889-4144-af31-74fa44927e7a)

## Other

* hardhat
* truffle
* ......
