Guide to create and deploy Bep-20 token in binance smart chain:
In this article, you will find a step-by-step complete guide on how to create and deploy your first bep-20 token in Binance smart chain.
Are you excited to deploy your own bep-20 token in BSC? Yes? then, let’s get started!
Pre-requisites required:
- Metamask wallet extension.
- $2-3 worth of BNB token.
1. Connect your Metamask to Binance Smart Chain:
You need to configure your metamask wallet to add Binance smart chain network. Follow the below guide if you’re setting up everything from scratch.
- Select your Metamask wallet extension and Click on icon on the top-right.
- Now select Settings >> Network >> Add Network
![metamask home](https://androidstrike.com/wp-content/uploads/2022/05/metamask-home.png)
![Metamask settings](https://androidstrike.com/wp-content/uploads/2022/05/Metamask-settings.png)
![metamask network](https://androidstrike.com/wp-content/uploads/2022/05/metamask-network.png)
3. Now visit this official binance post to get the parameters to manually add your BSC to metamask. Click here
![bsc mainnet paramters](https://androidstrike.com/wp-content/uploads/2022/05/bsc-mainnet-paramters.png)
4. Once done, switch your network to BSC in Metamask wallet.
We are done setting up. Now, let’s move on to the actual part.
2. Writing BEP-20 Token Smart Contract:
1. Now, let’s write our smart contract in remix IDE.Go to remix.ethereum.org and create a file (name_anything.sol) under contracts folder.
![remix IDE](https://androidstrike.com/wp-content/uploads/2022/05/remix-IDE-1024x383.png)
It should look something like the above image.
2. Then, we will set our compiler version.
pragma solidity ^0.8.3;
3. Now, Let’s import the ERC-20 smart contract code from the OpenZeppelin Github page.
import 'https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol';
4. Now, Let’s write our contract.
contract BalaToken is ERC20 { constructor(uint256 initialSupply) ERC20("BalaToken","Bala") { _mint(msg.sender, initialSupply); } }
we have named our contract as “BalaToken” and it inherits from ERC20.
![balatoken code](https://androidstrike.com/wp-content/uploads/2022/05/balatoken-code-1024x243.png)
This is how your code should look like now.
3. Deploying Bep-20 Token in Binance Smart Chain:
We have wrote our code in remix IDE. Now, Let’s compile our code and deploy it.
1. Now select your compiler version and click on compile. The solidity compiler will compile the code and the success tick mark will appear in the left-sidebar icon.
![remix ide compiler](https://androidstrike.com/wp-content/uploads/2022/05/remix-ide-compiler.png)
2. Now, Let’s deploy it.
Select Environment as Injected Web3 and Select your contract_name.sol from the contract drop-down and Set your Initial Supply value like “10000”. Now, Click on Deploy button.
![remix deploy contract](https://androidstrike.com/wp-content/uploads/2022/05/remix-deploy-contract.png)
3. The Metamask wallet will open, Click on Confirm to confirm the transaction and you’ve successfully deployed bep-20 token in Binance Smart Chain.
![transaction hash](https://androidstrike.com/wp-content/uploads/2022/05/transaction-hash-1024x196.png)
Search your transaction hash in bscscan.com and you will find your contract address.
To Import your token in Metamask, Click on Import tokens, add your contract address to add your custom bep-20 token to the Metamask wallet.
I hope this article helped you to write and deploy bep-20 token in Binance Smart chain. Please do share it with your friends.