Binance and the BNB Chain (BSC) have grown in popularity tremendously both in the eyes of developers as well as users.
If you have ever used Binance or just want to implement a cryptocurrency that follows the BEP-20 token standard and is a part of the BNB Chain (BSC), we have created a step-by-step guide as to how you can create and integrate a BNB Chain token to any project.
Key Points:
The BNB Chain (BSC), formerly known as the Binance Smart Chain, has the main goal of building the infrastructure that power’s the virtual ecosystem, where BNB’s commitment is to be open, multi-chain, permissionless, decentralized, and much bigger than Binance.
The BNB Chain is composed of the BNB Beacon Chain, which was known as the Binance Chain, which is used for governance, voting, and staking. Then there’s the BNB Smart Chain, which was formerly known as the Binance Smart Chain, which is Ethereum Virtual Machine (EVM) compatible, features a consensus layer, and has hubs to multi-chains.
By building a token on top of the BNB Chain, developers can gain access to all of the advantages found within this ecosystem.
BSC runs in parallel to the BNB Chain and enables smart contracts for tokens on the blockchain. This results in cheap transaction fees, cross-chain decentralized finance (DeFi) mechanism that increases interoperability, a high-performance network holding the capability to produce a block every 3 seconds, a growing ecosystem, and a lot of other benefits.
We are going to go over just about everything you need to do in order to integrate a BSC token into any project that you are working on step-by-step.
BEP-20 is essentially the BNB Chain equivalent to the ERC-20 token standard used on Ethereum (ETH). However, BEP-20 does not run on the Ethereum network.
What this means is that you need to install the MetaMask browser extension and add the BSC testnet to your MetaMask wallet.
To do so, open up MetaMask and click on the networks tab, after which you can click on “Custom RPC.” To Configure your wallet to connect to the BSC Testnet, you can fill out the form as follows:
With that setup, you can add test BNB to your wallet. To do so, you need to head over to the “Binance Smart Chain Faucet” and import your BNB Chain address to get free BNB.
Due to the fact that BSC utilizes EVM, the code for the deployment of the ERC-20 token standard and the BEP-20 token standard is similar. Get the ERC-20 specification from OpenZeppelin, and use it in the smart contract. You will also need to visit the Remix IDE and start a new Workspace and create a file called BEP20.sol.'
In the file you just created, enter 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);
}
}
This will create an InitialSupply amount of tokens in the WEI format. To create 100 tokens, you need to pass the function 100000000000000000000, for example.
Within the Initial BEP20.sol file that has been written out, you can deploy it onto the BSC testnet. To do so, click on the BEP20.sol file and open the solidity compiler tab, where you can change the compiler version and click on “Compile.”
After the contract has been compiled successfully, you can now deploy it. To do so, click on the “Deploy & Run Transactions” tab and change the “Environment” tab to Injected Web 3. Here, you need to connect your MetaMask so that you can confirm the transaction.
You can now add the token to your wallet by clicking on “Add Token” under the “Assets” tab.
Here, you can paste the contract address from Remix, and you will see the fields get populated automatically. Then, all you have to do is just accept the token.
Hopefully, now you know how you can create and integrate a BSC token into your crypto project. Once the cryptocurrencies are in your MetaMask wallet, you are free to implement them in any way you want to.
To keep track of everything as it happens during development, you can connect to a NOWNodes node or blockchain explorer as a means of getting an in-depth look at each transaction as it happens and ensuring that you are sending the cryptocurrencies to the right addresses.