Creating and deploying a BEP-20 token on the Binance Smart Chain (BSC) is an essential skill for blockchain developers and entrepreneurs looking to launch their own digital assets. The BEP-20 token standard powers countless tokens across BSC, offering EVM compatibility and low transaction fees—making it ideal for decentralized applications (dApps), community tokens, or reward systems.
This comprehensive guide walks you through coding a functional BEP-20 token using Solidity, deploying it via Remix IDE, verifying the contract on BscScan, and importing it into MetaMask. Whether you're building your first token or expanding your Web3 development skills, this tutorial delivers actionable insights with real-world applicability.
Core Keywords: BEP-20 token, Binance Smart Chain, Solidity, Remix IDE, MetaMask, BscScan, smart contract, blockchain development
Understanding the BEP-20 Token Standard
The BEP-20 token standard defines a set of rules that govern how tokens behave on the Binance Smart Chain. It is functionally similar to Ethereum’s ERC-20 standard, enabling features like token transfers, balance tracking, and approvals. Because BSC is EVM-compatible, developers can use familiar Ethereum tools such as Remix, Hardhat, and Truffle.
To interact with BSC—whether sending transactions or deploying contracts—you need BNB to cover gas fees, just like ETH on Ethereum. This makes BNB the native utility token of the network.
While the base BEP-20 specification outlines core functions and events, most real-world implementations extend it with additional features such as:
- Minting and burning tokens
- Ownership transfer
- Emergency pause functionality
In this tutorial, we’ll implement a basic BEP-20-compliant token with minting and burning capabilities—perfect for testing and learning.
👉 Discover how to securely manage your tokens after deployment.
Prerequisites for Development
Before writing code, ensure your environment is ready:
- Solidity 0.8.0 or higher – The latest stable version ensures security improvements and built-in overflow checks.
- Remix IDE – A browser-based Solidity development environment with integrated compiler and deployment tools.
- MetaMask Wallet – To sign transactions and connect to BSC.
- Testnet BNB – Required for deploying contracts on the BSC testnet.
Ensure MetaMask is configured for the Binance Smart Chain testnet. You can request test BNB from the official faucet.
Step-by-Step: Coding a BEP-20 Token in Solidity
Open Remix IDE and create a new file named Token.sol under /contracts.
Start by declaring the license and Solidity version:
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.8.0;Next, define the contract structure:
contract Token {
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
address payable public owner;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approve(address indexed owner, address indexed spender, uint256 value);
}Public variables automatically generate getter functions in Solidity ≥0.8.0, so name(), symbol(), balanceOf(), etc., are available without extra code.
Constructor: Initializing Token Properties
The constructor sets initial values and mints the total supply to the deployer:
constructor() {
name = "RandomToken";
symbol = "RDT";
decimals = 18;
uint256 _initialSupply = 1000000000 * 10**uint256(decimals);
owner = payable(msg.sender);
balanceOf[owner] = _initialSupply;
totalSupply = _initialSupply;
emit Transfer(address(0), msg.sender, _initialSupply);
}Note: We multiply by 10**decimals to account for decimal precision.
Core Functions Implementation
getOwner()
Returns the contract owner.
function getOwner() public view returns (address) {
return owner;
}transfer(address _to, uint256 _value)
Transfers tokens from sender to another address.
function transfer(address _to, uint256 _value) public returns (bool success) {
require(_to != address(0), "Invalid recipient");
require(_value <= balanceOf[msg.sender], "Insufficient balance");
balanceOf[msg.sender] -= _value;
balanceOf[_to] += _value;
emit Transfer(msg.sender, _to, _value);
return true;
}approve(address _spender, uint256 _value)
Grants allowance to another address to spend tokens.
function approve(address _spender, uint256 _value) public returns (bool success) {
allowance[msg.sender][_spender] = _value;
emit Approve(msg.sender, _spender, _value);
return true;
}transferFrom(address _from, address _to, uint256 _value)
Transfers tokens on behalf of another user using pre-approved allowance.
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_to != address(0), "Invalid recipient");
require(_value <= balanceOf[_from], "Insufficient balance");
require(_value <= allowance[_from][msg.sender], "Insufficient allowance");
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
allowance[_from][msg.sender] -= _value;
emit Transfer(_from, _to, _value);
return true;
}mint(uint256 _amount)
Allows owner to create new tokens.
function mint(uint256 _amount) public returns (bool success) {
require(msg.sender == owner, "Unauthorized");
totalSupply += _amount;
balanceOf[msg.sender] += _amount;
emit Transfer(address(0), msg.sender, _amount);
return true;
}burn(uint256 _amount)
Destroys tokens from caller’s balance.
function burn(uint256 _amount) public returns (bool success) {
require(balanceOf[msg.sender] >= _amount, "Insufficient balance");
balanceOf[msg.sender] -= _amount;
totalSupply -= _amount;
emit Transfer(msg.sender, address(0), _amount);
return true;
}Deploying Your Token Using Remix IDE
Once your code is complete:
- In Remix, go to Solidity Compiler and compile
Token.sol. - Switch to Deploy & Run Transactions.
- Set Environment to Injected Web3 (this connects MetaMask).
- Confirm MetaMask is on the BSC testnet.
- Click Deploy and approve the transaction in MetaMask.
After confirmation, your contract appears under Deployed Contracts. Copy its address—you’ll need it for verification and importing.
👉 Learn best practices for securing your deployed smart contracts.
Verifying Your Contract on BscScan
Source verification increases trust by allowing users to audit your code.
- Go to BscScan Testnet or Mainnet.
- Paste your contract address into the search bar.
- On the contract page, click Verify and Publish.
Fill in:
- Compiler version (match Remix exactly)
- Open-source license (GPL-3.0)
- Constructor arguments (none in this case)
- Paste your full Solidity code.
- Click Verify and Publish.
Within minutes, your source code will be publicly viewable.
Importing Your Token into MetaMask
To see your token in MetaMask:
- Open MetaMask and switch to the correct BSC network.
- Use the same account used for deployment.
- Click Import Tokens > Custom Token.
- Paste the contract address.
- Symbol and decimals should auto-fill.
- Click Import Tokens.
Your token balance will now display under Assets.
Frequently Asked Questions (FAQ)
What is the difference between BEP-20 and ERC-20?
BEP-20 is functionally equivalent to ERC-20 but runs on Binance Smart Chain instead of Ethereum. It supports faster transactions and lower fees due to BSC’s consensus mechanism.
Can I deploy a BEP-20 token without coding?
Yes—tools like TokenSniffer or Polarfox allow no-code token creation. However, custom logic requires manual coding.
Why verify a contract on BscScan?
Verification proves transparency and authenticity. Users can review your code for backdoors or malicious functions before interacting.
How much does it cost to deploy a BEP-20 token?
On testnet: free (using test BNB). On mainnet: typically $5–$15 depending on network congestion.
Can I add more features later?
Yes—common upgrades include pausing transfers, setting tax mechanisms, or integrating with liquidity pools. Consider using OpenZeppelin’s secure contracts for advanced functionality.
What happens if I lose my private key?
You lose access to the contract ownership and minting capabilities. Always back up keys securely or use multi-sig wallets for production deployments.
Final Thoughts and Next Steps
You’ve successfully created, deployed, verified, and imported a BEP-20 token on Binance Smart Chain—a foundational milestone in blockchain development.
From here, consider:
- Building a dApp interface using React or Flutter
- Creating a liquidity pool on PancakeSwap
- Adding advanced security features using OpenZeppelin libraries
Blockchain innovation starts with small steps—and yours just began.
👉 Secure your next Web3 project with advanced tools and insights.