How to Create a Smart Contract on BSC, Step by Step
To create a smart contract on BSC, write it in Solidity, compile it in Remix, and deploy it with MetaMask. Test on the testnet first.
On this page
Short answer
To create a smart contract on BNB Smart Chain, write the contract in Solidity, compile it in the Remix IDE, add BSC to MetaMask, and deploy it first on the BSC testnet (chain ID 97) and then on mainnet (chain ID 56). BSC is EVM compatible, so the same Solidity and OpenZeppelin code used on Ethereum works unchanged.
What is a smart contract on BSC?
A smart contract on BNB Smart Chain (BSC) is a program stored on the chain that runs when called, without a server in the middle. On BSC, smart contracts power BEP-20 tokens, decentralised exchanges, NFT marketplaces and lending apps, and creating a token means deploying a smart contract.
BSC is a layer-1 blockchain that runs the Ethereum Virtual Machine, the same execution environment Ethereum uses. Its native coin is BNB, and its mainnet identifies itself to wallets with chain ID 56. Because it is EVM compatible, standard Ethereum tooling works with little change: the same Solidity language, the same Remix editor and the same OpenZeppelin libraries.
| Item | BSC | Ethereum |
|---|---|---|
| Mainnet chain ID | 56 | 1 |
| Testnet chain ID | 97 | 11155111 (Sepolia) |
| Gas token | BNB | ETH |
| Token standard | BEP-20 | ERC-20 |
| Block explorer | BscScan | Etherscan |
| Block time | About 3 seconds | About 12 seconds |
One thing changed since older guides were written. BNB Chain used to be two chains, and under the BNB Chain Fusion the Beacon Chain was shut down in November 2024, with its functions folded into BSC. Today there is effectively one chain, and the current token standard is BEP-20. For the Ethereum equivalent, see how to create an ERC-20 token.
What do you need before you start?
Before you create a smart contract on BSC, you need a wallet, test funds, the contract code and a plan for the token. All of it is free for testing, and the list is short.
| Item | What it is | Notes |
|---|---|---|
| MetaMask | EVM wallet as a browser extension | Install it and keep the phrase offline |
| Test BNB | Gas for the BSC testnet | Free from the official faucet |
| Remix IDE | Browser-based Solidity editor | No installation needed |
| Contract code | Solidity, usually from OpenZeppelin | Reuse audited ERC-20 code as BEP-20 |
| Token details | Name, symbol, decimals, supply | Decide before you deploy |
You do not need to install a compiler or run any infrastructure. Remix handles compilation in the browser, and your wallet connects to the chain through a public endpoint. The practical takeaway is that you can reuse OpenZeppelin's audited ERC-20 contract to make a BEP-20 token, since there is no separate library to learn.
How to add BSC to MetaMask
MetaMask does not include BSC by default, so you add the network by hand before you can deploy. The values below are the standard ones for mainnet and testnet.
- Open MetaMask and click the network menu. Choose the option to add a network manually.
- Enter the mainnet details. Network name BNB Smart Chain, RPC URL https://bsc-dataseed.binance.org/, chain ID 56, currency symbol BNB, block explorer https://bscscan.com.
- Save the network. MetaMask switches to BSC and shows BNB as your balance.
- Add the testnet the same way. Network name BNB Smart Chain Testnet, chain ID 97, currency symbol tBNB, and the testnet RPC from the BSC docs.
- Get test BNB. Claim free test BNB from the official faucet so you can pay gas on the testnet.
Chainlist.org can add the network in one click if you prefer not to type the values. Either way, check the chain ID shown in MetaMask before you deploy: 56 for mainnet and 97 for testnet.
How to write the contract in Remix
Remix IDE is a browser-based Solidity development environment maintained by the Ethereum Foundation. It works for BSC because BSC is EVM compatible, so the same editor and the same code work on both chains.
- Open Remix IDE in the browser. In the file explorer, create a new file ending in .sol, such as MyToken.sol.
- Generate the code with OpenZeppelin Wizard. Set the name and symbol, set the premint amount, and tick mintable, burnable or pausable as needed.
- Paste the generated code into Remix. The contract inherits from OpenZeppelin's ERC20 standard, which BSC fully supports.
- Compile the contract. Open the Solidity compiler tab, pick the compiler version shown at the top of the generated code, and compile.
- Fix any errors before moving on. A contract that does not compile cannot deploy, so read the compiler output and fix each error in turn.
Keep the contract simple for a first deploy. A plain token with a fixed supply is easier to test than one with minting, pausing and fees, and you can add features in a later contract. For a token on another chain, see how to create a token on Solana.
How to deploy and verify on BscScan
Deploy on the testnet first, so a mistake costs nothing, then repeat the same steps on mainnet when the contract works. Verification on BscScan lets anyone read the code behind the contract address.
- Switch MetaMask to the BSC testnet. Check the chain ID is 97 and that you hold test BNB for gas.
- Open the Deploy tab in Remix. Choose the injected provider so Remix talks to MetaMask.
- Select the contract and deploy. Enter the constructor arguments, such as token name and initial supply, and confirm the transaction in MetaMask.
- Copy the contract address. Remix shows it after the transaction confirms. Save it, since it is the token's permanent on-chain address.
- Test the contract on the testnet. Mint, transfer and burn tokens, and check the results on the testnet block explorer.
- Repeat on mainnet. Switch MetaMask to chain ID 56, deploy the same code, and verify the contract on BscScan so its source is public.
For a token built with a no-code route on another chain, see how to create a token on the Core blockchain.
Example (hypothetical): a 1,000,000-token launch
Example (hypothetical): a team launches a BEP-20 token on BSC with a total supply of 1,000,000 tokens. The split is 500,000 tokens for the public sale, 300,000 held for the team and 200,000 for the community fund, which adds up as 500,000 + 300,000 + 200,000 = 1,000,000.
The team share vests over four quarters, so each quarter releases 300,000 / 4 = 75,000 tokens. After the first quarter the circulating supply is 500,000 + 75,000 = 575,000 tokens, with 225,000 team tokens still locked.
The lesson is to write the split and the vesting into the contract before deployment. A split agreed in a chat message is not enforceable on chain, while a vesting schedule in the contract releases tokens only when the rules say so.
What are the common mistakes?
The most common mistakes when creating a smart contract on BSC are deploying straight to mainnet, using the wrong network, and leaving the contract unverified.
- Skipping the testnet. Deploy on the testnet first and test minting, transfers and burning before mainnet.
- Wrong chain ID. Deploying while MetaMask is on the wrong network sends the contract to the wrong chain. Check the chain ID first.
- Unverified contract. A contract that is not verified on BscScan cannot be read by users, so verify it after deployment.
- Unlimited minting with no rule. Mintable without a cap or a reserve rule invites supply growth nobody can audit.
- Copying code without reading it. A contract copied from a forum can hide a backdoor. Read every line, or use audited OpenZeppelin code.
- Forgetting gas for later steps. Deploying is only the first transaction. Keep BNB aside for verification, transfers and listing.
Key takeaways
- BSC is EVM compatible, so Ethereum Solidity code works
- Mainnet is chain ID 56, testnet is chain ID 97
- Deploy on the testnet first, then mainnet
- Verify the contract on BscScan after deployment
- Write the token split into the contract
Frequently asked questions
What is a smart contract on BSC?
A smart contract on BNB Smart Chain is a program stored on the chain that runs when called, without a server in the middle. On BSC, smart contracts power BEP-20 tokens, decentralised exchanges, NFT marketplaces and lending apps.
What do I need to create a smart contract on BSC?
You need MetaMask as a wallet, test BNB for gas on the testnet, the Remix IDE for writing and compiling Solidity, and the contract code, usually generated with OpenZeppelin Wizard. All of it is free for testing.
What is the chain ID for BSC?
The BSC mainnet chain ID is 56, and the testnet chain ID is 97. Check the chain ID shown in MetaMask before you deploy, since deploying on the wrong network sends the contract to the wrong chain.
Is a BEP-20 token the same as an ERC-20 token?
BEP-20 is BSC's token standard and is fully interface-compatible with Ethereum's ERC-20. You can reuse OpenZeppelin's audited ERC-20 contract to make a BEP-20 token, since there is no separate library to learn.
How do I verify my contract on BscScan?
After deployment, open the contract address on BscScan and use the verify option to publish the source code. Verification lets anyone read the code behind the address, which builds trust with users and exchanges.
How much does it cost to deploy a smart contract on BSC?
Deploying a typical BEP-20 token contract costs a small amount of BNB for gas, and gas fees on BSC are low compared with Ethereum mainnet. Test on the testnet first, where test BNB is free from the faucet, so a mistake costs nothing.