A Comprehensive Guide to BEP-20 Tokens: The Binance Token Standard

September 24, 2021 12:35 pm

BEP-20, or Binance Chain Evolution Proposal, is the Binance token standard for creating tokens on the Binance Smart Chain.

If you’ve ever tried to make cryptocurrency transfers or withdrawals, then you know the importance of sending your coins or tokens to the right address and network to avoid loss of funds, and knowing the token standard is paramount. 

For example, an exchange such as Binance will have you pick between BEP-20, BEP-2, ERC-20, or similar, when making transfers, depending on the asset involved.

This “BEP-20” or “ERC-20” is called a token standard; token standards exist to provide a blueprint for creating tokens on individual blockchains via smart contracts (i.e, computer programs). In general, any token that adheres to a particular standard can be used to transact with wallets or exchanges that support it.

Although certain wallets and exchanges may automatically select the right network based on a recipient’s address or warn you if an address is invalid, it’s still helpful to know your way around the most popular networks and their associated token standards.

In this post, we’ll discuss the BEP-20 token standard and cover how it differs from other standards such as the ERC-20.  

First, however, we’ll briefly review what tokens are. Let’s get started!

A Brief Review of Tokens

As mentioned earlier, token standards such as Ethereum’s ERC-20 and others like it provide an outline of sorts for creating tokens on individual blockchains. This enables developers to create interoperable assets with similar functionality, based on common guidelines proposed by such token specifications.

The resultant tokens are transferable native assets and operate in decentralized applications running on an underlying blockchain. They can serve as a store of value, be used to pay for a service, or even represent off-chain securities.

One example of a token is STORJ, an ERC-20 utility asset which gives access to the service provided by the Storj Network.

The Storj website

Now, let’s take a look at the BEP-20, a standard that extends the ERC-20.

Understanding the BEP-20 Token Standard

To appreciate the significance of the BEP-20 standard within Binance and the broader cryptocurrency ecosystem, we’ll briefly review some history involving Ethereum, Binance Chain (BC), and Binance Smart Chain (BSC), and discuss how the standard relates to others like the ERC-20 and the BEP-2.

The Binance Chain homepage

Ethereum was the first blockchain to implement a truly versatile smart contract and decentralized app (DApp) functionality. Its creator, Vitalik, co-wrote a specification, the ERC-20, that developers could build upon when creating tokens for the Ethereum blockchain. Smart contracts implementing the standard effectively had a set of mandatory functionality in common as laid out in the specification.

Since the launch of Ethereum, other blockchains have sprung up to offer similar or improved functionality. However, when Binance Chain went live in 2019, it eschewed smart contract functionality to optimize trading performance and speed. Its token standard was the BEP-2, which, by design, had no support for smart contracts.

The Binance Smart Chain page

In 2020, Binance dipped its toes into DeFi with Binance Smart Chain (BSC), a complement to the existing Binance Chain (BC). It introduced the BEP-20 token standard which included the smart contract functionality that was missing in the previous BEP-2 standard.

Some popular examples of applications and associated BEP-20 tokens built on BSC include:

  1. PancakeSwap (CAKE): A decentralized exchange on which you can swap BEP-20 tokens. The platform also enables you to earn its native CAKE tokens through yield farming or staking.
  2. Binance Coin (BNB): Initially built on the Ethereum blockchain as an ERC-20 token, BNB is now the native coin of Binance Chain as a BEP-2 token. It’s used to pay trading and transaction fees on the Binance exchange platform, and can also serve as both a store of value and medium of exchange. Additionally, it can be staked on BSC to earn even more BNB.
  3. BurgerSwap (BURGER): BurgerSwap is another decentralized exchange on our list which enables you to swap tokens, except in this case, it’s not just BEP-20 tokens. BurgerSwap lets you swap between ERC-20 and BEP-20 tokens. Liquidity providers on the platform are also rewarded with its native BURGER tokens.

Nowadays, aside from native BEP-20 assets on BSC, there are also pegged coins, which are essentially BEP-20 equivalents of other cryptoassets such as Ethereum, Cardano, or Bitcoin. They are pegged on a 1:1 ratio to the corresponding assets. A useful analogy here would be stablecoins such as USDT being pegged to the dollar.

Binance-pegged tokens on the BscScan website

This feature essentially allows you to send native assets to BSC, receive their BEP-20 equivalent, and eventually withdraw them back to the asset’s original blockchain. 

One advantage of using the pegged equivalents of native assets from Ethereum, for example, is that it can be more cost-effective due to bypassed gas fees.

Since BC and BSC are meant to complement each other, they have cross-chain compatibility; BEP-2 tokens can be swapped with their BEP-20 equivalent and vice versa. This interoperability is enabled by the Binance Bridge service, and it currently supports 35 currencies.

The Binance Bridge page

Next, let’s take a look at the similarities and differences between BEP-20 and ERC-20.

BEP-20 vs ERC-20: A Technical Glance

As mentioned already, the BEP-20 token standard was modeled after Ethereum’s ERC-20, so they’re compatible. Some functions common to both standards include:

  • totalSupply. This returns the total number of tokens available in a contract.
  • balanceOf. This returns the number of tokens available in a specific user address.
  • transfer. This function is used to transfer tokens between users and requires that the person invoking the function owns the tokens.
  • transferFrom. Unlike transfer, this function is used to automate transfers by approved persons or contracts. For example, you may prefer to authorize services you’re subscribed to deduct payments automatically rather than do it manually.
  • approve. This is used to limit the number of tokens any smart contract is allowed to withdraw from your balance.
  • allowance. Once a smart contract is authorized to spend a certain amount of your tokens, the allowance function can be used to check for any unspent portion of it.
  • name. This is used to attach a human-readable name to the token, such as “Binance Coin”.
  • symbol. Tokens may also have symbols such as “BNB”.
  • decimal. This function essentially sets the number of decimal places a token can be divided into. The more decimals, the more divisible a token is.

While the last three are optional for ERC-20 tokens, symbol and decimal are required for BEP-20 tokens. Additionally, the BEP-20 standard specifies an extra (required) method called getOwner, which returns the owner of a BEP-20 token.

How to Create Your Own BEP-20 Tokens

There are multiple ways to create your to make your own Binance BEP-20 tokens. These include creating it manually and using online token generators such as the BEP20 Generator. The former method is more involved than the latter and requires some coding skills.

In general, to ‘code’ your own token, you’ll want to follow these steps:

  1. Install Metamask and connect your Metamask wallet to BSC. For testing, connect to the BSC testnet. Otherwise, you’ll want to deploy to mainnet.
  2. Send some BNB to your Metamask wallet to cover transaction fees when deploying. (For testnet, you’ll want to get some test BNB.)
  3. Navigate to the Remix IDE. This is entirely online and does not need to be installed.
  4. Create your token in Remix and deploy it. Here’s a sample implementation of the BEP-20 specification that you could use as the basis for yours.
  5. Once you’ve deployed your token, you’ll want to grab its contract address and add the token to your wallet, whether on Metamask or Trust Wallet.

You’ll need to specify a cap or the maximum number of tokens you’ll want to mint. You may also want to make some tokens burnable. All in all, you can mint as many tokens as you want until you’ve reached your cap.

Final Thoughts: Why Do BEP-20 Tokens Matter?

Blockchains such as Ethereum and BSC create baseline standards such as the ERC-20 and BEP-20 to improve interoperability between tokens that adhere to the standard. One practical reason to familiarize yourself with these standards, even as a non-developer, is to understand enough to use the right mix of addresses and networks when making crypto transfers, thereby avoiding the unintentional burning of funds.

Not to mention, learning about these different blockchain platforms and their peculiar characteristics can potentially lead to cost savings, such as bypassed gas fees!

To recap, the BEP-20 is a token standard for Binance Smart Chain and it supports smart contracts, unlike Binance Chain (and its attendant BEP-2 token standard). Additionally, BSC supports pegged tokens, a feature that lets you use the BEP-20 equivalent of native assets on other blockchains.