Create a Token

In this section we'll get you to create a token on Asset Chain in less than 10 minutes.

Let’s see how to deploy a smart contract on Asset Chain using the Remix IDE for simplicity.

Get everything ready

Before getting started:

  1. Follow for the step-by-step on how to add Asset Chain testnet to Metamask.

  2. This guide assumes you have got Testnet RWA and connected to the Asset Chain Testnet Network. Learn how to do that in Testnet Faucets.

We are ready to get started!

Remix & Sample Code

Remix is a no-setup tool for developing smart contracts. It’s easy to get started allowing a simple deployment process, debugging, interacting with smart contracts, and more. It’s a great tool to test quick changes and interact with deployed smart contracts.

For the sake of this tutorial, we will be deploying the ‘ERC20Token.sol’ smart contract for minting a fungible token, but you can use any of your code.

You can copy and then paste this in Remix or use your own contract code. Here's the sample code:

ERC20Token.sol

Copy

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.3/contracts/token/ERC20/ERC20.sol";

contract ERC20Token is ERC20 {
    constructor(string memory _name, string memory _symbol)
        ERC20(_name, _symbol)
    {
        _mint(msg.sender, 1000000000 * 10**decimals());
    }
}

Steps to deploy

  1. Copy the sample code and paste it in one of the .sol files in Remix

  2. To compile your smart contract, go to the Solidity Compiler tab and select the contract you want to compile

  3. Click on "Compile", you can also enable "Auto Compile" for automatic compilation whenever you change the contract code.

Make sure to open the advanced configurations and setting the EVM version to London. This is to avoid an issue with the PUSH0 opcode.

  1. Once the smart contract is compiled successfully, switch to the "Deploy & Run Transactions" tab.

  2. In the "Environment" dropdown menu, select "Injected Provider - MetaMask"; this will connect your MetaMask to Remix and will allow you to make transactions from that connected wallet.

Make sure to have AssetChain Testnet as your selected network in Metamask before deploying.

  1. Select the compiled contract you want to deploy and click ‘Deploy.’

Now, MetaMask should pop up and ask you to confirm the transaction with super low fees.

Congratulations! You just deployed your first smart contract to Asset Chain.

If you have questions, join our Telegram and say hello 👋. We're Active!

Last updated