January 16, 2024

How to Create a BSC Token with Remix IDE 

Table of Contents

In this article, we’ll show you how to create a token on BNB Smart Chain (BSC) using Remix, breaking down the process into five straightforward steps. But if you’re eager to dive straight into the code of our token contract, you can find it here: 

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

contract BEP20 is ERC20 {
    constructor(uint256 initialSupply) ERC20("BEP20Test", "BPT") {
        _mint(msg.sender, initialSupply);
    }
}

For a more comprehensive breakdown of the code above, along with detailed instructions on compiling and deploying the contract using Remix, we invite you to join us in this guide, offering a more in-depth tutorial on how to create a token on BSC! 

Overview 

We’ll kickstart today’s article by diving into the ins and outs of BSC tokens. From there, we’ll explore Remix IDE and MetaMask, as we’ll use both these tools to write and deploy our BSC token contract. Next, we’ll jump straight into our tutorial to show you how to create a BSC token with Remix in five easy steps: 

  1. Add the BSC Testnet to MetaMask
  2. Get BSC Testnet Tokens
  3. Create Your BSC Token Contract with Remix
  4. Deploy Your Contract
  5. Add the Token to MetaMask

Lastly, for those further interested in Web3 development, we’ll also introduce you to Moralis – the industry’s leading Web3 API provider! 

In Moralis’ suite of Web3 APIs, you’ll find multiple interfaces for various use cases. Some prominent examples include the NFT API, Wallet API, and many others. With these tools, you can seamlessly query and integrate on-chain data and blockchain functionality into all projects with only a few lines of code, making Web3 development a breeze!

Also, did you know you can sign up with Moralis for free? As such, please take this opportunity to supercharge your Web3 development endeavors with our premier Web3 APIs! 

Nevertheless, let’s start this article by answering the question, ”What’s a BSC token?”

What’s a BSC Token? 

A BSC token is a digital asset built on BNB Smart Chain (BSC) – an EVM-compatible blockchain network designed for running smart contract-based applications. Moreover, BSC tokens adhere to the BEP-20 token standard, which defines a set of rules and guidelines for creating and managing fungible tokens on the network! 

BEP-20 is an extension of Ethereum’s widely adopted ERC-20 standard, and they are very similar. You can think of the standard as a blueprint that defines specific functions and variables token contracts must implement to be considered BEP-20 compliant.

By providing a common standard, BEP-20 ensures consistency and interoperability among tokens, streamlining the process for developers to work with and integrate these digital assets into their Web3 wallets, decentralized exchanges (DEXs), and other platforms.

In essence, BSC tokens are tokens built on BNB Smart Chain adhering to the BEP-20 token standard! 

Creating a Token on BSC with Remix & MetaMask 

In today’s article, we’ll show you how to create a BSC token using Remix and MetaMask. Consequently, before jumping into the tutorial, let’s briefly break down both these platforms separately: 

  • Remix IDE: Remix is an integrated development environment (IDE) featuring an intuitive graphical user interface and a powerful toolset for writing, testing, debugging, compiling, and deploying EVM-compatible smart contracts. What’s more, Remix offers a wide range of plugins and extensions, allowing you to seamlessly tailor your development environment to your needs. 

    All in all, Remix is a powerful, intuitive, and well-used platform that has become an essential tool in Web3’s development ecosystem! 
  • MetaMask: MetaMask is the industry’s leading Web3 wallet, boasting an impressive 30 million monthly active users. With this EVM-compatible wallet, it’s possible to store, buy, send, and swap tokens across multiple chains, including Ethereum, BSC, Polygon, and many others. 

    Moreover, in addition to allowing you to store and manage your digital assets, MetaMask also acts as a gateway to Web3’s extensive ecosystem of decentralized applications (dapps) and smart contracts! 

Now, with an overview of Remix and MetaMask, let’s dive straight into the main tutorial and show you how to create a token on BSC! 

How to Create a BSC Token with Remix 

In the following subsections, we’ll show you how to create a BSC token with Remix and MetaMask in five steps: 

  1. Add the BSC Testnet To MetaMask
  2. Get BSC Testnet Tokens
  3. Create Your BSC Token Contract with Remix
  4. Deploy Your Contract
  5. Add the Token To MetaMask

In this tutorial, we’ll utilize the BSC testnet for convenience. However, the procedure for creating a token on the BSC mainnet remains nearly identical, with the main distinctions emerging in the first and second steps, where you need to add the mainnet and get real BNB tokens instead. 

Nevertheless, without further delay, let’s jump into the first step and show you how to add the BSC testnet to MetaMask!  

Step 1: Add the BSC Testnet To MetaMask 

Adding the BSC testnet to MetaMask is simple, and the first thing you need to do is click the networks drop-down menu at the top left of your MetaMask interface, followed by ”Add network”: 

Next, click ”Add a network manually” at the bottom: 

Doing so takes you to the following page, where you need to add the network details for the BSC testnet: 

You’ll find the information you need below: 

BSC Testnet Details
Network name:BNB Smart Chain Testnet
New RPC URL:https://bsc-testnet.publicnode.com
Chain ID:97
Currency symbol:tBNB
Block explorer URL (Optional):https://testnet.bscscan.com/

After hitting “Save”, the network will have been added to your wallet, allowing you to switch to the testnet: 

That’s it; you have now successfully added the BSC testnet to your MetaMask wallet: 

Step 2: Get BSC Testnet Tokens 

To get BSC testnet tokens, you need a reliable BNB faucet, and the easiest way to find one is to use Moralis. Simply visit Moralis’ crypto faucets page, scroll down, and click ”Try Now” for the BSC alternative: 

Clicking the button above takes you to the following page, where you just need to paste your MetaMask address and hit the ”Send 0.3 BNB” button:

Once the transaction is finalized, you should now find yourself with an additional 0.3 BNB testnet tokens added to your MetaMask wallet: 

From here, you can now use these newly acquired tokens to pay for transactions on the BSC testnet!

Step 3: Create Your BSC Token Contract with Remix

Since BSC is EVM-compatible, we can use Solidity and the ERC-20 token standard to create BEP-20 tokens. This further means we can leverage an ERC-20 smart contract template from OpenZeppelin to make this process as seamless as possible.

With that said, let’s start by launching the Remix IDE and setting up a new workspace: 

You can then create a new smart contract called something like ”BEP20.sol” in your ”contracts” folder:

Next, add the following code: 

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

contract BEP20 is ERC20 {
    constructor(uint256 initialSupply) ERC20("BEP20Test", "BPT") {
        _mint(msg.sender, initialSupply);
    }
}

From here, let’s now break down the code line by line, starting from the top! 

We begin by specifying the SPDX license: 

// SPDX-License-Identifier: MIT

Next, we import the ERC-20 package from OpenZeppelin:

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

From there, we define a new contract named BEP20, where we also specify that it should use the ERC-20 package we imported above: 

contract BEP20 is ERC20 {
   //...
}

We then create a constructor, which is called when the smart contract is deployed. This constructor takes an initialSupply parameter as an argument, which will be used to specify the initial supply of our token.

On the same line, we additionally call the ERC20() function we imported from OpenZeppelin. This function takes two parameters as an argument: BEP20Test and BPT. The first parameter is the name of the token, and the second parameter is its ticker:

    constructor(uint256 initialSupply) ERC20("BEP20Test", "BPT") {
        //...
    }

Lastly, we call the _mint() function, which is used to create the token. This function takes two parameters: msg.sender and initialSupply. msg.sender specifies that the tokens will be sent to the address deploying the contract, and initialSupply sets the number of tokens that will be deployed: 

        _mint(msg.sender, initialSupply);

Step 4: Deploy the Contract 

At this point, it’s now time to deploy the smart contract to the BSC testnet, and to do so, we initially need to compile it. As such, go to the ”Solidity compiler” tab, select your contract, and hit the ”Compile…” button: 

Next, navigate to the ”Deploy & run transactions” tab and select ”Injected Provider – …” as the environment:

From here, ensure that you’re deploying the right contract: 

You then need to specify the initial token supply that we pass to the contract’s constructor. In our case, we’ll be creating 100 tokens, and since it follows an 18-decimal format, we’ll pass 100000000000000000000 as the parameter: 

Lastly, all that remains is hitting the ”Deploy” button:

Clicking the ”Deploy” button prompts your MetaMask wallet, as you’ll need to pay for the transaction using the testnet tokens you previously acquired: 

If everything went according to plan, you should now see a success message in the terminal:

Step 5: Add the Token To MetaMask 

To add the newly deployed token to your MetaMask wallet, you first need to copy its contract address:

Next, open your MetaMask wallet and click the ”+ Import tokens” button:

This will open a new window where you simply need to paste the token address, and the rest of the information should autonomously fill in:

Finally, click ”Next” followed by ”Import”:

That’s it; you should now see your newly created BSC token in your MetaMask wallet:

Congratulations! You now know how to effortlessly create a token on the BSC testnet. From here, you can follow pretty much the same steps to create a BSC token on the mainnet!

Introducing Moralis – The Industry’s Leading Web3 API Provider 

Moralis is the industry’s leading Web3 API provider, offering a wide and dynamic range of tools you can use to streamline your development endeavors. In our suite of premier Web3 APIs, you’ll find interfaces such as our Wallet API, Token API, NFT API, Blockchain API, and many others. Consequently, it doesn’t matter if you build a DEX, Web3 wallet, or any other platform; Moralis has a tool for most use cases! 

But why should you leverage Moralis when building dapps? 

To answer the above question, let’s explore three benefits of Moralis! 

  • Top Performance: Moralis’ Web3 APIs consistently deliver top-tier performance. It doesn’t matter whether you measure by reliability, speed, or any other metric; Moralis always blows the competition out of the water. 
  • Data Accessibility: With our diverse set of APIs, you get accurate, real-time data with only a few lines of code. As such, when working with Morails, it has never been easier to fetch and integrate on-chain data and Web3 functionality into your projects. 
  • Cross-Chain Compatability: Our Web3 APIs are chain-agnostic, supporting all the biggest blockchains, including networks like Ethereum, Polygon, Arbitrum, Solana, and, of course, BNB Smart Chain, making our suite of tools stand out as the ultimate BSC API

To learn more about our industry-leading development tools, check out our Web3 API page! 

Also, remember that you can sign up with Moralis for free. So, take this opportunity, and you can start building Web3 projects faster and more efficiently today! 

Summary: How to Create a Token on BSC with Remix

In today’s article, we kicked things off by exploring the ins and outs of BSC tokens. In doing so, we learned that they are assets built on BNB Smart Chain adhering to the BEP-20 token standard. 

From there, we then explored Remix and MetaMask. Remix is a prominent IDE for writing, testing, debugging, compiling, and deploying EVM-compatible smart contracts. Meanwhile, MetaMask is a Web3 wallet for storing and managing digital assets, along with interacting with dapps and smart contracts. 

Next, we showed you how to create a token on BSC with Remix in five straightforward steps: 

  1. Add the BSC Testnet to MetaMask
  2. Get BSC Testnet Tokens
  3. Create Your BSC Token Contract with Remix
  4. Deploy Your Contract
  5. Add the Token To MetaMask

As such, if you have followed along this far, you now know how to create a BSC token with Remix! 

If you liked this tutorial on how to create a BSC token, consider checking out more Moralis content. For instance, read our contract ABI guide or learn how to list all the coins in an ETH address

Furthermore, for those excited to embark on their journey in Web3 development, be sure to sign up with Moralis. Signing up is free, and you’ll gain instant access to all our premier Web3 APIs! 

Moralis Money
Stay ahead of the markets with real-time, on-chain data insights. Inform your trades with true market alpha!
Moralis Money
Related Articles
February 9, 2023

Alchemy NFT API Alternative – Which is the Fastest NFT API?

August 18, 2022

Exploring the Ultimate NodeJS EVM API

November 29, 2022

The Best ERC20 Token Balance API for Dapp Development

January 3, 2023

Web3.py vs Web3.js – Ultimate Comparison of Two Leading Web3 Libraries

November 17, 2022

Exploring the Optimism Network – A Next-Gen L2 Blockchain for Ethereum

March 3, 2023

How to Build a Polygon Portfolio Tracker

January 8, 2024

Best Crypto Portfolio Tracker in 2024 – Full List

December 6, 2023

Cryptocurrency Exchange Development – How to Start a Crypto Exchange

October 12, 2023

Rinkeby Faucet Guide – What is the Rinkeby Faucet and Testnet?