How to Set Up a Private BSC Testnet Node for Development
Setting up a private BSC testnet node means running a local copy of the Binance Smart Chain network that only you and your development tools can see. You do this by downloading the BSC client software, configuring it for testnet mode, and syncing a few hundred megabytes of test data. This gives you a sandbox where you can deploy contracts, test transactions, and debug without spending real BNB or competing with others for block space.
Why Run a Private Node Instead of Using the Public Testnet
The public BSC testnet (Chapel) works well for simple testing, but a private node gives you control. You can:
- Mine your own test BNB instantly by calling the faucet endpoint built into the node
- Revert the chain state to a previous block, letting you replay tests
- Avoid rate limits and transaction delays from other developers
- Run tests offline without internet access
The trade-off is you must maintain the node yourself and it won't have the same transaction volume as the public testnet.
Prerequisites
Before starting, you need:
- A machine running Linux or macOS (Windows works via WSL2)
- At least 4 GB of RAM and 20 GB of free disk space
- Go 1.18 or later installed (check with
go version) - Git installed
Step 1: Download and Build the BSC Client
The official BSC node software is called geth (Go Ethereum), modified for BSC. Clone the repository and compile it:
git clone https://github.com/bnb-chain/bsc
cd bsc
make geth
This produces a binary called geth in the build/bin directory. Verify it works:
./build/bin/geth version
You should see version output that includes "BSC" and a build date.
Step 2: Create a Testnet Genesis File
A genesis file defines the initial state of your private chain. BSC provides a template for testnet. Create a file called genesis.json with this content:
{
"config": {
"chainId": 97,
"homesteadBlock": 0,
"eip150Block": 0,
"eip155Block": 0,
"eip158Block": 0,
"byzantiumBlock": 0,
"constantinopleBlock": 0,
"petersburgBlock": 0,
"istanbulBlock": 0,
"berlinBlock": 0,
"londonBlock": 0,
"arrowGlacierBlock": 0,
"grayGlacierBlock": 0,
"mergeNetsplitBlock": 0,
"shanghaiTime": 0,
"cancunTime": 0,
"ethash": {}
},
"difficulty": "1",
"gasLimit": "8000000",
"alloc": {}
}
The chainId of 97 matches the public BSC testnet, which helps when connecting test wallets. The ethash consensus engine means your node will use proof-of-work mining, which is simple for a single-node setup.
Step 3: Initialize the Node
Create a data directory for your testnet chain and initialize it with the genesis file:
mkdir bsc-testnet-data
./build/bin/geth init --datadir bsc-testnet-data genesis.json
This writes the genesis block to the data directory. You only need to run this once unless you want to reset the chain.
Step 4: Add a Pre-Funded Account
You need test BNB to deploy contracts and pay gas. Generate a new account:
./build/bin/geth account new --datadir bsc-testnet-data
Follow the prompts to set a password. This creates a key file in bsc-testnet-data/keystore. Note the address that appears (it starts with 0x).
Now edit genesis.json to give this account an initial balance. Add the address under alloc:
"alloc": {
"0xYourAddressHere": {
"balance": "1000000000000000000000000"
}
}
This gives you 1,000,000 test BNB (in wei). Re-run geth init with the updated genesis file:
./build/bin/geth init --datadir bsc-testnet-data genesis.json
This resets the chain with your funded account.
Step 5: Start the Node in Mining Mode
Launch the node with mining enabled so it produces blocks automatically:
./build/bin/geth --datadir bsc-testnet-data \
--networkid 97 \
--http \
--http.api eth,web3,net,personal \
--http.corsdomain "*" \
--mine \
--miner.etherbase 0xYourAddressHere \
--allow-insecure-unlock
Key flags explained:
--networkid 97sets the network ID to match the testnet chain ID--httpenables the JSON-RPC endpoint athttp://localhost:8545--http.apilists which APIs are available (eth, web3, net, personal)--minestarts the CPU miner--miner.etherbasetells the miner where to send block rewards--allow-insecure-unlocklets you unlock accounts via the HTTP API (only safe on localhost)
After a few seconds, you should see log messages about mining blocks. Your node is now producing blocks every 3 seconds.
Step 6: Connect Your Wallet or Development Tool
With the node running, point MetaMask or Hardhat to:
- RPC URL:
http://localhost:8545 - Chain ID:
97
Import the account you created earlier using its private key. To export the private key from your node, use:
./build/bin/geth account export --datadir bsc-testnet-data 0xYourAddressHere
Enter your password when prompted. This outputs the raw private key (without the 0x prefix). Import this into MetaMask or your development framework.
Common issues and fixes
Node won't start: Check that port 8545 is not already in use. Run lsof -i :8545 to see what's listening.
No blocks being mined: Ensure you passed --mine and --miner.etherbase with a valid address. The address must be in your keystore.
Transactions fail with "nonce too low": Reset your wallet's nonce counter. In MetaMask, go to Settings > Advanced > Clear activity tab data.
Disk fills up quickly: Your private chain stores all blocks. To reset, delete the bsc-testnet-data directory and repeat steps 3-5.
When to use this setup
This private node is ideal for:
- Unit testing smart contracts before deploying to public testnet
- Learning how BSC transactions work without spending real tokens
- Running integration tests in CI/CD pipelines
For production-grade testing that needs real BSC testnet conditions (like oracle price feeds or cross-chain bridges), use the public Chapel testnet instead.
Not financial advice. dogesound.club publishes market data and general information about digital assets. Crypto assets are volatile and you can lose everything you put in. Nothing here is a recommendation to buy, sell or hold, and we make no price predictions.
Prices are sourced from third parties and may be delayed or wrong. Verify anything you intend to act on against a primary source.