The BNB Smart Chain (BSC) has emerged as one of the most popular blockchain platforms for launching decentralized applications (dApps) and creating custom tokens. With its compatibility with Ethereum’s tools and significantly lower transaction fees, BSC offers an accessible entry point for developers and enthusiasts alike. This guide walks you through the essentials of working with BSC, deploying BEP-20 tokens, and interacting with smart contracts—no prior experience required.
Whether you're exploring blockchain development or aiming to launch your first token, this step-by-step tutorial equips you with practical knowledge on using MetaMask, Remix IDE, and the BSC network.
Setting Up Your Development Environment
Before diving into smart contract deployment, you need a secure and functional environment. Here's how to get started:
Install MetaMask in Chrome
MetaMask is a cryptocurrency wallet that allows you to interact with blockchain applications directly from your browser. It supports multiple networks, including BNB Smart Chain.
To install:
- Open the Chrome Web Store.
- Search for "MetaMask" and install the official extension.
- Follow the setup instructions to create a new wallet. Be sure to securely back up your recovery phrase.
👉 Get started with blockchain development using trusted tools today.
Once installed, MetaMask will appear as an icon in your browser toolbar, ready to connect to various blockchains.
Connect MetaMask to BNB Smart Chain
By default, MetaMask is configured for Ethereum. To use BSC, manually add the network:
- Network Name: Binance Smart Chain
- New RPC URL:
https://bsc-dataseed.binance.org/ - Chain ID: 56
- Currency Symbol: BNB
- Block Explorer URL:
https://bscscan.com
After adding these details, switch your network from Ethereum to BSC within MetaMask.
Writing and Deploying a BEP-20 Token Contract
The BEP-20 token standard is BSC’s equivalent of Ethereum’s ERC-20. It defines a set of rules for fungible tokens, enabling them to be used across exchanges, wallets, and dApps.
We’ll use Remix IDE, a web-based development environment, to write, compile, and deploy our smart contract.
Step 1: Open Remix IDE
Navigate to remix.ethereum.org in your Chrome browser. No installation is needed—Remix runs entirely in the browser.
Ensure MetaMask is connected and unlocked before proceeding.
Step 2: Create a New File and Paste the BEP-20 Template
Create a new .sol file (e.g., MyToken.sol) in the file explorer panel. Then paste the following Solidity code:
pragma solidity ^0.4.16;
interface tokenRecipient {
function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public;
}
contract TokenERC20 {
string public name;
string public symbol;
uint8 public decimals = 18;
uint256 public totalSupply;
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Burn(address indexed from, uint256 value);
function TokenERC20(uint256 initialSupply, string tokenName, string tokenSymbol) public {
totalSupply = initialSupply * 10 ** uint256(decimals);
balanceOf[msg.sender] = totalSupply;
name = tokenName;
symbol = tokenSymbol;
}
function _transfer(address _from, address _to, uint _value) internal {
require(_to != 0x0);
require(balanceOf[_from] >= _value);
require(balanceOf[_to] + _value > balanceOf[_to]);
uint previousBalances = balanceOf[_from] + balanceOf[_to];
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
Transfer(_from, _to, _value);
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
function transfer(address _to, uint256 _value) public returns (bool success) {
_transfer(msg.sender, _to, _value);
return true;
}
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]);
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint256 _value) public returns (bool success) {
allowance[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
function burn(uint256 _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] -= _value;
totalSupply -= _value;
Burn(msg.sender, _value);
return true;
}
function burnFrom(address _from, uint256 _value) public returns (bool success) {
require(balanceOf[_from] >= _value);
require(_value <= allowance[_from][msg.sender]);
balanceOf[_from] -= _value;
allowance[_from][msg.sender] -= _value;
totalSupply -= _value;
Burn(_from, _value);
return true;
}
}This template includes core functionalities such as transferring tokens, approving third-party spending, and burning tokens.
Step 3: Compile the Contract
In the Remix sidebar, go to the Solidity Compiler tab. Select a compiler version compatible with ^0.4.16 (e.g., v0.4.26).
Click Compile MyToken.sol. If there are no errors, proceed to deployment.
Step 4: Deploy the Contract
Switch to the Deploy & Run Transactions tab.
- Environment: Select Injected Web3 (this connects Remix to MetaMask).
- Under Deploy, select
TokenERC20from the dropdown. Enter constructor parameters:
initialSupply: e.g.,1000000tokenName: e.g.,"MyToken"tokenSymbol: e.g.,"MTK"
Click Deploy. MetaMask will prompt you to confirm the transaction.
👉 Speed up your blockchain journey with seamless wallet integration.
Confirm the transaction in MetaMask. Gas fees will be paid in BNB.
Verifying and Interacting With Your Token
After deployment:
- Copy the contract address from Remix.
- Visit BscScan and paste the address to view its details.
- Wait a few moments for the blockchain to process and confirm the contract creation.
On BscScan, you can:
- View token holders
- Check transaction history
- Verify and publish the source code (recommended for transparency)
You can also add your token to MetaMask:
- Click “Import Tokens” in MetaMask.
- Paste the contract address.
- The symbol and decimals should auto-fill based on your contract settings.
Frequently Asked Questions (FAQ)
What is BNB Smart Chain?
BNB Smart Chain (BSC) is a blockchain platform that supports smart contracts and is compatible with Ethereum’s tooling. It operates alongside the BNB Beacon Chain and enables fast, low-cost transactions using BNB as gas.
How does BEP-20 differ from ERC-20?
BEP-20 is functionally similar to ERC-20 but runs on the BNB Smart Chain instead of Ethereum. It offers faster confirmation times and lower fees while maintaining compatibility with Ethereum development tools like Remix and MetaMask.
Can I deploy a BEP-20 token without coding?
Yes. Several platforms offer no-code solutions for generating BEP-20 tokens. However, understanding Solidity and manual deployment gives you greater control over features like minting limits, tax mechanisms, or custom logic.
Do I need real BNB to deploy on BSC?
Yes. You need BNB to pay for gas fees when deploying contracts or making transactions. For testing purposes, use the BSC testnet and obtain test BNB from a faucet.
How do I verify my contract on BscScan?
After deployment, visit BscScan, find your contract, and choose “Verify and Publish.” Provide the source code, compiler version, and optimization settings used during compilation.
Is it safe to deploy contracts using Remix?
Remix is a trusted open-source tool widely used by developers. However, always audit your code before deployment and avoid sharing private keys or sensitive data.
Final Thoughts
Learning how to deploy a BEP-20 token on BNB Smart Chain opens doors to decentralized finance (DeFi), NFT projects, and community-driven ecosystems. With tools like MetaMask and Remix IDE, even beginners can launch functional tokens in under an hour.
As you grow more confident, explore advanced topics like upgrading contracts, integrating oracles, or launching liquidity pools on PancakeSwap.