Launch a token

This page is a guide on how to create your custom ERC20 token on Specular.

Table of contents

  • Deploy an ERC20 demo

  • Add it to the Token List

  • Add liquidity to the DEX

Launch a Token

To launch a token on the Specular network using Hardhat, follow these steps:


Ensure you have the following prerequisites:

  • JavaScript knowledge.

  • Node.js and NPM/Yarn installed on your computer.

  • Rust installed.

  • Foundry installed.

Get started

Initialize a new Foundry project with the following command:

forge init deploy_erc20

This creates a new project named deploy_erc20.

Write the ERC20 contract

Write your ERC20 token contract. For example:

// MyToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

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

contract MyToken is ERC20 {
    constructor(uint256 initialSupply) ERC20("MyToken", "MTK") {
        _mint(msg.sender, initialSupply);


Compile your contracts using the following command:

forge build

This command compiles your contracts located in the src folder and generates a new out folder where all the compiled contract artifacts reside.


Execute your Solidity test files located under the test folder to ensure your smart contract functions as intended:

forge test

Deploy your token

Export your private key as a variable:


Deploy your token contract to the Specular network using the following command:

forge create --rpc-url --private-key $PRIVATE_KEY src/MyToken.sol:MyToken --legacy

Replace <YOUR_PRIVATE_KEY> with your actual private key. Ensure that you keep your private key secure and never share it publicly.

Upon successful deployment, you'll receive the address your contract is deployed to and the transaction hash.

Congratulations! You've successfully launched your token on the Specular network using Hardhat and Foundry.

Last updated