How to Build a BEP20 Wallet on BSC, Step by Step
A BEP20 wallet on BNB Smart Chain holds BNB and BEP20 tokens and connects to apps. Here is how to build one, from chain connection to token list and security.
On this page
Short answer
To build a BEP20 wallet on BNB Smart Chain, create a wallet app that generates keys, connects to BSC through a node or RPC endpoint, reads BEP20 token balances from the chain, and lets users send tokens and approve decentralised apps. Use chain ID 56 for mainnet and 97 for the testnet, and test every send and approval on the testnet before launch.
What is a BEP20 wallet?
A BEP20 wallet is a crypto wallet built for BNB Smart Chain that holds BNB and tokens made to the BEP20 standard. BEP20 is the token standard on BSC, the same role ERC20 plays on Ethereum, so any token issued on BSC follows the same rules for transfers, balances and approvals.
The wallet does not hold the funds. It holds the keys and talks to the chain: it reads balances from BEP20 contracts, builds transactions to send tokens, and signs them with the user's key. The tokens themselves live on the chain, and the wallet is the tool that moves them.
| Part | What it does | Example |
|---|---|---|
| Key manager | Creates and stores keys | Seed phrase, encrypted vault |
| Chain connection | Reads blocks and sends transactions | BSC RPC endpoint |
| Token list | Shows BEP20 balances | Contract addresses and decimals |
| Transaction builder | Builds sends and approvals | Transfer, approve calls |
| dApp connector | Links to apps and exchanges | WalletConnect |
A BEP20 wallet is different from a plain BSC wallet mainly in how much token work it does. A basic wallet shows BNB and lets you send it. A BEP20 wallet also lists token balances, handles token approvals and connects to decentralised apps that use BEP20 tokens. For the basics of a BSC wallet, see what a Binance Smart Chain wallet is.
What do you need before you start?
You need five things before you write any wallet code: a chain connection, a way to work with keys, a library for building transactions, a token list, and test funds on the BSC testnet.
| Item | What it is | Notes |
|---|---|---|
| BSC RPC endpoint | Node connection to the chain | Mainnet chain ID 56, testnet 97 |
| ethers.js or web3.js | Library for chain calls | Reads contracts and signs transactions |
| Key storage | Encrypted vault for keys | Never store a plain private key |
| Token list | BEP20 contract addresses | Address, symbol and decimals per token |
| Test BNB | Gas for the testnet | Free from the official faucet |
| BscScan | Block explorer and contract data | Check balances and transactions |
Start on the testnet. The testnet uses the same BEP20 rules as mainnet, and test BNB is free, so you can send tokens, approve apps and break things without losing real funds. For the token side of the chain, see how to create a smart contract on BSC.
How do you build a BEP20 wallet on BSC, step by step?
Building a BEP20 wallet on BSC takes seven steps, from the chain connection to the first testnet transfer. Each step can be tested on its own, so start with the connection and add features one at a time.
- Connect to BSC. Point your app at a BSC RPC endpoint and set the chain ID: 56 for mainnet, 97 for the testnet. Read the latest block number to confirm the connection works.
- Generate and store keys. Create a seed phrase and derive the wallet address from it. Store the phrase encrypted on the device, and never send it to a server or log it.
- Read the BNB balance. Call the chain for the address balance and show it in BNB. This is the simplest chain read and the right first test.
- Add the token list. For each BEP20 token, store its contract address, symbol and decimals. Read each token balance by calling the balanceOf function on its contract.
- Build token sends. Let the user pick a token and an amount, then build a transfer call to the token contract. Show the amount, the recipient and the gas cost before asking for a signature.
- Add approvals and dApp connections. Support the approve call so users can let a decentralised app spend a set amount, and add WalletConnect so apps can request signatures from your wallet.
- Test every flow on the testnet. Send tokens, approve an app, revoke the approval and recover from a wrong address. Only move to mainnet when every flow works and the balances match BscScan.
Keep the first version small: one chain, a short token list and the core flows. A wallet that does a few things well is safer than one that does many things half-finished. For the general wallet build, see how to create a crypto wallet app.
How does BEP20 token support work?
BEP20 token support works by reading and writing to token contracts on BSC. Each BEP20 token is a contract with a fixed set of functions, and your wallet calls those functions to show balances and move tokens.
Balances come from the balanceOf function, which takes an address and returns the amount that address holds, in the token's smallest unit. The wallet then divides by the token's decimals to show a readable number: a token with 18 decimals stores 1 token as 1,000,000,000,000,000,000 units, so getting the decimals wrong shows a balance that is off by a huge factor.
Sends use the transfer function, which moves tokens from the wallet address to a recipient. Approvals use the approve function, which lets a decentralised app spend up to a set amount on the user's behalf. Approvals are the riskiest part: an approval for an unlimited amount stays valid until the user revokes it, so your wallet should show the amount clearly and offer a revoke option.
The token list is the wallet's own data, not chain data. You choose which tokens to show, and each entry needs the contract address, the symbol and the decimals. A wrong contract address shows the wrong token, so check each entry against BscScan before you ship the list.
Example (hypothetical): a first wallet launch
Example (hypothetical): a team launches a BEP20 wallet with a short list of 20 tokens and tests it with 1,000 users on the testnet. Each test user sends 10 tokens to a second address and approves a test app to spend 50 tokens.
One test user holds 2,500 tokens. After sending 500 tokens to a friend, the balance is 2,500 - 500 = 2,000 tokens. The approval for the test app is separate from the balance, so the user still holds 2,000 tokens and the app can spend up to 50 of them.
Gas is the other cost to check. A token transfer on the testnet costs about 0.0005 BNB in gas, so 1,000 test transfers cost 1,000 x 0.0005 = 0.5 BNB in total. The team funds the test wallets from the faucet and confirms that every transfer appears on BscScan with the right amount and the right recipient.
The lesson is to test the numbers, not just the screens. A wallet that looks right but shows the wrong balance or sends the wrong amount is worse than no wallet at all, because users trust what it shows.
What are the common mistakes?
The most common mistakes when building a BEP20 wallet are getting token decimals wrong, approving unlimited amounts by default, and skipping testnet testing.
- Wrong decimals. A token with 6 decimals and one with 18 decimals need different maths. Read the decimals from the contract and test the display with real token data.
- Unlimited approvals by default. Approving an app to spend unlimited tokens saves a step and creates a lasting risk. Default to the amount the user asked for, and show a revoke option.
- Keys stored in plain text. A private key or seed phrase in plain storage is one breach away from empty wallets. Encrypt keys on the device and never send them to a server.
- Skipping the testnet. Testnet testing is free and catches most bugs. A wallet that goes straight to mainnet puts real funds at risk on its first day.
- Trusting the token list blindly. A wrong contract address shows the wrong token. Check every entry against BscScan, and let users add tokens by address with a warning.
- Hiding the gas cost. Users need to see the gas cost before they sign. A send that fails for lack of BNB wastes a signature and confuses the user.
What do you do after the wallet is live?
After the wallet is live, the work shifts from building to watching: monitor transactions, answer support questions and keep the token list and the chain connection healthy.
Start with monitoring. Track failed transactions, slow balance reads and RPC errors, and set alerts for a spike in any of them. A wallet that silently shows stale balances loses trust fast, so show a clear warning when the chain connection is down or the data is old.
Then keep the token list fresh. New tokens launch, old ones stop trading, and contract addresses change after migrations. Review the list on a schedule and remove tokens that no longer work, with a note for users who still hold them.
Finally, plan the security review. Get the key storage, the transaction signing and the approval flows reviewed by someone who did not write them, and fix what they find before the next release. If you need help building or reviewing a wallet, a team that does crypto wallet development can check the flows against how production wallets handle them.
Key takeaways
- A BEP20 wallet holds keys and talks to BSC, not the funds
- Mainnet is chain ID 56, testnet is chain ID 97
- Read balances and decimals from the token contract
- Show the amount, recipient and gas before every signature
- Test every flow on the testnet before mainnet
Frequently asked questions
What is a BEP20 wallet?
A BEP20 wallet is a crypto wallet built for BNB Smart Chain that holds BNB and tokens made to the BEP20 standard. The wallet holds the keys and talks to the chain: it reads balances from BEP20 contracts, builds transactions to send tokens, and signs them with the user's key.
What is the difference between BEP20 and ERC20?
BEP20 is the token standard on BNB Smart Chain and ERC20 is the token standard on Ethereum. They work the same way, with the same functions for transfers, balances and approvals, so a wallet built for one can usually support the other with a different chain connection.
What is the chain ID for BSC?
The BSC mainnet chain ID is 56 and the testnet chain ID is 97. Your wallet must set the right chain ID before it sends a transaction, since sending on the wrong network can send funds to the wrong chain.
How do BEP20 token approvals work?
An approval lets a decentralised app spend up to a set amount of a token on the user's behalf, using the approve function of the token contract. The approval stays valid until the user revokes it, so wallets should show the amount clearly and offer a revoke option.
Do I need real BNB to test a BEP20 wallet?
No. Test BNB is free from the official faucet and pays for gas on the BSC testnet, which follows the same BEP20 rules as mainnet. You only need real BNB when the wallet goes live on mainnet and handles real funds.
Is a BEP20 wallet safe to build?
It can be, if the keys are encrypted on the device, the token decimals are read from the contract, approvals default to a set amount, and every flow is tested on the testnet first. Get the key storage and signing flows reviewed before launch, since a bug there puts user funds at risk.