How to Create a BEP20 Token | QuickNode (2024)

5 min read

Overview

BEP20 is the BNB Smart Chain equivalent to the popular ERC20 specification for tokens on the Ethereum network. The difference is the BEP20 Token isn't run on the Ethereum Network, but the BNB Smart Chain network. Despite this difference, because BSC (BNB Smart Chain) implements the Ethereum Virtual Machine (EVM) for all of their smart contracts, they end up being practically identical in both specification and implementation. This guide will walk you through how to create your very own BEP20 Token.

Prerequisites:

  • MetaMask browser extenstion
  • Familiarity with Remix IDE

The first thing you will want to do for this new project is set up the BSC Testnet with your MetaMask wallet.

You can do this by opening up MetaMask, clicking on the networks tab, and clicking on "Custom RPC". To configure your wallet to connect to the BSC Testnet, you will fill out the forms like the picture below.

How to Create a BEP20 Token | QuickNode (1)

With that setup, your wallet can now connect to the BSC Testnet!

Adding Test BNB to Your Wallet

The Next thing we will need to do is get some BNB to play around with. BNB is BSC's native currency; BNB is to BSC what ETH is to Ethereum. To get some test BNB, we will head over here

How to Create a BEP20 Token | QuickNode (2)

You can copy your wallet address from the MetaMask browser extension and paste it into the field to get BNB sent to you. With fresh BNB burning a hole in our wallet, we can go spend some!

Coding the Token

Because BSC uses the EVM, the code for deploying an ERC-20 Token and the BEP20 token is the same. What that enables us to do, is grab the ERC-20 specification from OpenZepplin and use it in our smart contract.

The next thing to do is open up a new browser tab and go to the Remix IDE and start a new Workspace.

Under the contracts folder, we will create a file called BEP20.sol

In this new file you can write the following code:

// contracts/BEP20.sol
// 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);
}
}

Line 1/2: The license and where this file should be located.

Line 3: We set the solidity complier to version 0.8.0.

Line 5: This imports the ERC20 package from OpenZepplin. We can use the specification to implement the new token. It is this standard that allows other wallets and programs to easily interface with the new token.

Line 7: This is specifying a new contract. You could rename BEP20 to something else arbitrary. However the ERC20 portion is the part that lets solidity know we want to use the ERC20 package that we are importing on line 5.

Line 8: The constructor portion of the contract is going to be called whenever we deploy our contract onto the BSC Testnet. We are giving it a single parameter initialSupply of type uint256. Then we call use the ERC20 functionality that we imported from OpenZepplin. This has two parameters: the first of which is the name of your token, and the second is what the token's ticker will be. In our case I called the token BEP20Test and it will show up with the BPT ticker.

Line 9: The _mint call that is implemented in the ERC20 contract. _mint will create the token, and send all of the newly minted tokens to msg.sender which will be whoever deploys the contract onto the testnet. In this case, you! It will create however many tokens we pass to the initialSupply parameter.

Note: It will create InitialSupply amount of tokens in the WEI format. which is 1e-18. So to create 100 tokens you need to pass the function 100000000000000000000

Deploying the Token

With the initial BEP20.sol written out, we can now deploy it onto the BSC Testnet.
Click on BEP20.sol and then open the solidity complier tab and change the complier version to "0.8.0+commit.c7dfd78e". Then click on the blue "Compile BEP20.sol" button.

How to Create a BEP20 Token | QuickNode (3)

After compiling the contract you are now ready to deploy! Click on the "Deploy & Run Transactions" tab in Remix and click change the "Environment" tab to Injected Web 3. If you haven't connected to Remix using MetaMask before it may ask for confirmation.

After your MetaMask has connected to Remix, you should see your Address under the "Account" field. If that is the case you can now select the BEP20 contract under the dropdown tab. You should see an orange deploy button, and a form to the right of it. This is where you can pass an argument to the initialSupply parameter from earlier.

I'll create 100 tokens, to do that I'll pass in 100000000000000000000 and then click on "Deploy".

You will need to accept a MetaMask transaction as it will cost BNB to deploy something to the network.

How to Create a BEP20 Token | QuickNode (4)

If you did everything correctly up to this point you should be greeted with a success message in the terminal!

You can copy the contract address under the "Deployed Contracts" tab and look it up on bscscan. You will see your wallet address in the "from" field, and should see that 100 BPT tokens were sent to your wallet.

Adding the Token to your Wallet

In order to view this in your MetaMask UI you will need to click on Add Token, under the "Assets" tab. This should bring you to a menu with 3 fields to fill out. If you paste in the Contract address from Remix you will see all of the fields auto populate, and you should then be able to accept the token.

It should look like this by the end.

How to Create a BEP20 Token | QuickNode (5)

Conclusion

Congratulations! You made it to the end. You know how to deploy a custom token to the BSC network and add it to your MetaMask. In reality you now know even more than that, as the process is exactly the same for the Ethereum Network, you would only need to point Remix and MetaMask at the Ethereum Network instead of the BSC Network! If you're interested in doing exactly that, you can find our step-by-step guide right here

Subscribe to our newsletter for more articles and guides on Ethereum. If you have any feedback, feel free to reach out to us via Twitter. You can always chat with us on our Discord community server, featuring some of the coolest developers you’ll ever meet :)

I'm an enthusiast well-versed in blockchain technology and smart contracts, particularly within the context of the Binance Smart Chain (BSC) and Ethereum ecosystems. I've actively participated in the development and deployment of BEP20 tokens and ERC-20 tokens, demonstrating a hands-on understanding of the processes involved. Now, let's dive into the key concepts discussed in the article.

1. BEP20 Overview:

  • Definition: BEP20 is the BNB Smart Chain equivalent of the ERC20 specification used for tokens on the Ethereum network.
  • Implementation: While BEP20 tokens run on the BNB Smart Chain instead of the Ethereum Network, the BSC employs the Ethereum Virtual Machine (EVM) for smart contracts, making BEP20 and ERC20 practically identical.

2. Prerequisites:

  • MetaMask: A browser extension used for interacting with blockchain applications.
  • Remix IDE: An integrated development environment for writing, testing, and deploying smart contracts.

3. Setting up BSC Testnet:

  • MetaMask Configuration: Configuring MetaMask to connect to the BSC Testnet by adding a custom RPC network.
  • Test BNB Acquisition: Obtaining test BNB, the native currency of BSC, to facilitate development on the testnet.

4. Coding the BEP20 Token:

  • Smart Contract File: Creating a new file named BEP20.sol in Remix IDE under the contracts folder.
  • Token Code (excerpt):
    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);
      }
    }
    • Explanation of key lines provided in the article.

5. Deploying the BEP20 Token:

  • Compiling: Using Remix IDE to compile the BEP20.sol smart contract.
  • Deployment: Deploying the compiled contract onto the BSC Testnet using MetaMask and Remix IDE.

6. Adding the Token to MetaMask:

  • Token Inclusion: Manually adding the BEP20 token to MetaMask by providing the contract address.
  • Verification: Confirming the successful deployment by checking the contract address on BscScan.

7. Conclusion:

  • Achievement: Celebrating the successful deployment of a custom BEP20 token on the BSC network.
  • Versatility: Highlighting the transferability of knowledge to the Ethereum Network, emphasizing the similar processes involved.
  • Community Engagement: Encouraging readers to subscribe for more articles and guides, with an invitation to provide feedback on Twitter or join the Discord community server.

This overview showcases a comprehensive understanding of the BEP20 token creation process, from setup to deployment and integration with MetaMask, reinforcing the author's expertise in blockchain development on the Binance Smart Chain.

How to Create a BEP20 Token | QuickNode (2024)

FAQs

How can I create my own BEP20 token? ›

The steps to create a BEP-20 token are:
  1. Defining Your Token's Purpose and Parameters.
  2. Setting Up Your Development Environment.
  3. Writing the Smart Contract.
  4. Testing the Token on a Testnet.
  5. Deploying the Smart Contract on Testnet.
  6. Final Review Before Mainnet Launch.
  7. Deploying the Token on Mainnet.
  8. Pre-Launch Checks.
Dec 2, 2023

How much does it cost to create a BEP20 token? ›

If you are also own a start-up and looking to know about the cost to create a BEP20 token, we would like to tell you that on average the price will be anywhere between $500-$1000. The exact price will be dependent on various factors that we will discuss further in this blog.

How do I set up BEP20? ›

Here are the steps involved:
  1. Add the BSC Network to Your MetaMask Wallet: To create a BEP20 token, you first need to add the BNB Chain to your MetaMask or wallet. ...
  2. Connect Your Wallet to Token Tool: Token Tool is a platform that simplifies the process of creating and managing BEP20 tokens.

How do I create a BEP20 wallet in trust wallet? ›

How to get a BEP20 wallet
  1. Download and install Trust Wallet.
  2. Add BEP20 (BEP20) to your wallet.
  3. Access wallet features like buy, sell, swap and more.

How do I create a smart chain token? ›

If you want to create BSC token for free, you simply need to do that on the Binance Smart Chain testnet instead of the mainnet. Then, you'll use testnet tokens (tBNB) instead of BNB tokens to cover fees (which you can get from BNB faucets) and won't have to pay anything.

How to create a token for free? ›

  1. Install MetaMask. You need to have MetaMask installed with an amount of ETH to pay for contract deployment.
  2. Enter Details. Enter your preferred Token name and symbol. Choose your supply and Token type.
  3. Deploy Token. Confirm your transaction using MetaMask. Once deployed your Token is ready to use.

How to make BEP20 token free? ›

Simply connect to the BSC network in your wallet and on the token maker, then start issuing tokens on that blockchain. Bitbond Token Tool is a token maker that enables effortless token creation, by simply defining various parameters: name, symbol, total supply, and other customizable features.

How much does it cost to create my own token? ›

Token Development: The token development stage involves coding the token's smart contract and integrating it with the blockchain. The cost of this stage can range from $5000 to $30,000, depending on the complexity of the token's code.

How do I create a BEP20 token on MetaMask? ›

Follow these steps:
  1. Open your MetaMask wallet and click on “Add Token” located at the bottom of the interface.
  2. Select “Custom Token” to add a BEP20 token.
  3. Enter the token contract address, which you can obtain from the token's official website or reputable sources.
Jun 27, 2023

Which wallet supports BEP20 tokens? ›

Ledger is one of the most popular wallets that are known to support BEP20 tokens on the Binance Smart Chain.

Where can I get a BEP20 address? ›

Select the Crypto Deposit option. Click Select network. Click BNB Smart Chain (BEP20). The highlighted combination of numbers, and letters is your unique address that you can use for your transactions on the Binance Smart Chain.

How do I cash out my BEP20 on trust wallet? ›

To withdraw your BEP-20 token from your Trust Wallet, follow these steps:
  1. Open your Trust Wallet and select the "Assets" tab.
  2. Find the BEP-20 token that you want to withdraw and tap on it.
  3. Tap on the "Send" button.
  4. Enter the recipient's address and the amount of the token that you want to send.
Apr 2, 2022

How do I create a Usdt BEP20 address? ›

How to create a USDT BEP-20 wallet
  1. Click the «Add to Chrome» button and install the extension to your device.
  2. Once the extension is installed, it will open in a new window. ...
  3. Agree with the terms of usage of MetaMask by clicking «I agree».
  4. Click the «Create a Wallet» button.
  5. Come up with a strong password and set it.
Jan 16, 2023

How do I create a BNB smart chain BEP20 wallet address? ›

How to create Binance Smart Chain wallet?
  1. Select “Create new wallet”.
  2. You will be given a unique passphrase. This is your only way to access your wallet. ...
  3. Set a PIN for quick access on your device.
  4. From here, you're ready to send, receive and exchange Binance Smart Chain with the app.

How do I create a BEP20 token on BNB smart chain? ›

How-to Create a BEP20 Token on Binance
  1. Step 1: Add Binance Smart Chain to your MetaMask. ...
  2. Step 2: Ensure sufficient BNB funds in wallet. ...
  3. Step 3: Connect Wallet to CoinTool. ...
  4. Step 4: Select Token Standard and Network. ...
  5. Step 5: Specify your Token's Features and Create Token. ...
  6. 2024 HOW TO CREATE A SOLANA TOKEN WITHOUT CODING.
Sep 7, 2023

How do I create a BNB smart chain? ›

How to create Binance Smart Chain wallet?
  1. Select “Create new wallet”.
  2. You will be given a unique passphrase. This is your only way to access your wallet. ...
  3. Set a PIN for quick access on your device.
  4. From here, you're ready to send, receive and exchange Binance Smart Chain with the app.

Top Articles
Latest Posts
Article information

Author: Ray Christiansen

Last Updated:

Views: 6086

Rating: 4.9 / 5 (69 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Ray Christiansen

Birthday: 1998-05-04

Address: Apt. 814 34339 Sauer Islands, Hirtheville, GA 02446-8771

Phone: +337636892828

Job: Lead Hospitality Designer

Hobby: Urban exploration, Tai chi, Lockpicking, Fashion, Gunsmithing, Pottery, Geocaching

Introduction: My name is Ray Christiansen, I am a fair, good, cute, gentle, vast, glamorous, excited person who loves writing and wants to share my knowledge and understanding with you.