How to Write and Deploy BEP-20 Token on Binance Smart Chain

How to Write and Deploy BEP-20 Token on Binance Smart Chain

Consistently, the Blockchain business produces imaginative and contemporary developments that challenge the prevailing system and bring upgrades, particularly in the decentralized finance space. Binance Smart Chain is a new improvement that benefits its clients with a rich and developing computerized resource ecosystem like never found in the decentralized exchange spectrum.

Using binance smart chain everyone can create and deploy their tokens. This is quite simple task. Let's have a look about Binance Smart Chain.

What is binance smart chain?

It is a double chain engineering that engages its clients to make their dApps and digital resources on the blockchain and gives the upside of quick exchanging.

Merits to use Binance smart chain

  • cheap transaction fees
  • cross chain defi mechanism that increases defi interoperability
  • a growing ecosystem with millions of users

What is BEP20 token?

BSC tokens are compliant with the BEP-20 token standard, It is similar to ERC20 Ethereum standard, Both are identical to each other , Even BSC is fork of ethereum mainnet.

Let's Create a BEP2- Token

How to create a BEP-20 token?

First thing is that to connect your metamask to BSC, Fill all the details as required. Afterward now open Remix Plateform. remix.png

Now create a new file under contracts tab , save as {Filename}.sol and start writing smart contracts.

pragma solidity 0.5.16;

interface IBEP20 {
  /**
   * @dev Returns the amount of tokens in existence.
   */
  function totalSupply() external view returns (uint256);

  /**
   * @dev Returns the token decimals.
   */
  function decimals() external view returns (uint8);

  /**
   * @dev Returns the token symbol.
   */
  function symbol() external view returns (string memory);

For sample code you may reach at my repository Crypto Hub

Change your token detail inside this function

constructor() public {
    _name = "Test Token Cooding Dessign";
    _symbol = "CDBEP";
    _decimals = 19;
    _totalSupply = 1000 * 10 ** 18;
    _balances[msg.sender] = _totalSupply;

    emit Transfer(address(0), msg.sender, _totalSupply);
  }

Debug your code Before deploying your contract you must debug your code if any error occurs then make it resolve for which , you have to compile code first

two.png

Let's deploy contract for which first select ENVIRONMENT as shown below, First let it be selected Javascript VM and deploy. Here you will find total supply in wei unit, Now check ethereum value of total supply by using Ethereum Unit Converter

123.png

let's finish it now, go back to remix and select ENVIRONMENT as Injected Web3, As you change environment it will ask you gas fee, You can confirm metamask popup. Then click on deploy.

It will return a boolen value which depicts operation succeeded.

Once it will be succeeded you can find hash , Check your transaction as my token create CDBEP

You can find your smart contract and can import into metamask as well.

cdbep.png

Note: This is only testnet , But you can follow same steps to deploy mainnet.

Conclusion

Binance Smart Chain effectively fills the hole between different blockchain and drastically extends the functionality of the first Binance Chain. BNB staking and EVM compatibility promise makes the stage an optimal engine for developers building hearty decentralized applications.

That's all about this article and with that, it's a wrap! Hope you found the article useful.

It never ends, Take care and see you in next article

Did you find this article valuable?

Support Shantun Parmar by becoming a sponsor. Any amount is appreciated!