Deploying Smart Contracts to BSC (BNB Chain)
BSC is an EVM-compatible network, so deployment is technically identical to Ethereum. The difference lies in several details: different chainId (56 for mainnet, 97 for testnet), native gas token BNB, and validator network specifics (21 validators, DPoS) that affect finality.
Hardhat Configuration
// hardhat.config.ts
import { HardhatUserConfig } from 'hardhat/config';
import '@nomicfoundation/hardhat-toolbox';
const config: HardhatUserConfig = {
solidity: {
version: '0.8.24',
settings: {
optimizer: { enabled: true, runs: 200 },
viaIR: true,
},
},
networks: {
bscTestnet: {
url: 'https://data-seed-prebsc-1-s1.binance.org:8545/',
chainId: 97,
accounts: [process.env.PRIVATE_KEY!],
},
bsc: {
url: 'https://bsc-dataseed1.binance.org/',
chainId: 56,
accounts: [process.env.PRIVATE_KEY!],
gasPrice: 3000000000, // 3 gwei — standard for BSC
},
},
etherscan: {
apiKey: {
bsc: process.env.BSCSCAN_API_KEY!,
bscTestnet: process.env.BSCSCAN_API_KEY!,
},
},
};
For BSC use bscscan.com instead of etherscan.io, get API key at bscscan.com/myapikey.
Deployment and Verification
# Deploy to testnet
npx hardhat run scripts/deploy.ts --network bscTestnet
# Verification (after deployment)
npx hardhat verify --network bscTestnet <CONTRACT_ADDRESS> <CONSTRUCTOR_ARG1> <CONSTRUCTOR_ARG2>
Verification via Hardhat Verify automatically uploads source code and ABI to BscScan. Without verification — contract appears as bytecode, users cannot read functions directly in Explorer.
Alternative to public RPC: Ankr, Nodereal, GetBlock — faster and more reliable under load. Public BSC nodes have rate limiting and sometimes lag.
BSC vs Ethereum Specifics
Gas price: BSC has a hardcoded minimum gasPrice of 3 gwei (hardcoded in the client). EIP-1559 on BSC is implemented differently, but most transactions use legacy gasPrice model.
Block time: ~3 seconds on BSC vs ~12 seconds on Ethereum. Code with hardcoded timeouts in blocks needs recalculation.
Contract size: 24KB limit identical to Ethereum. Proxy patterns (OpenZeppelin Transparent or UUPS) mandatory for complex contracts.
Finality: with 21 validators, reorgs are rare but possible. For valuable operations wait 15+ confirmations instead of standard 1-2.
Timeline Estimates
Deploying a ready contract with verification — 1-2 hours. If Ethereum contract adaptation is needed for BSC (tokens, bridge interaction) — 1-2 days.







