Bitcoin Cash (BCH) continues to gain traction in the blockchain ecosystem, especially with innovations like the SmartBCH sidechain. This guide provides a step-by-step walkthrough for deploying a BCH development network (regtest) using Docker, focusing on the latest v23.0.0 release.
Why Deploy a BCH Development Network?
- Testing: Safely experiment with BCH features without risking real funds.
- Learning: Understand BCH’s architecture and RPC interfaces.
- Development: Build and test decentralized applications (dApps) on a local network.
👉 Explore advanced blockchain development tools
Step 1: Generate the BCH Docker Image
1.1 Pull the Base Image
docker pull buildpack-deps:jessie-curl1.2 Create the Dockerfile
FROM buildpack-deps:jessie-curl
RUN wget -O bchn.tar.gz https://github.com/bitcoin-cash-node/bitcoin-cash-node/releases/download/v23.0.0/bitcoin-cash-node-23.0.0-x86_64-linux-gnu.tar.gz \
&& tar -xzvf bchn.tar.gz \
&& cd bitcoin-cash-node-23.0.0/bin \
&& mv bitcoin-cli bitcoin-tx bitcoind /usr/local/bin \
&& cd / \
&& rm -Rfv bitcoin*
EXPOSE 18443 18444
WORKDIR /root/.bitcoin
ENTRYPOINT ["bitcoind"]Key Notes:
- Ports
18443(RPC) and18444(P2P) are exposed for regtest. - The image includes
bitcoind,bitcoin-cli, andbitcoin-tx.
1.3 Build and Verify the Image
docker build . -t bch/bitcoin-cash-node:v23.0.0
docker images | grep bchStep 2: Launch the BCH Container
2.1 Prepare the Data Directory
mkdir -p /opt/docker/bch-regtest/data2.2 Start the Container
docker run -itd --restart=unless-stopped \
-v /etc/localtime:/etc/localtime \
-v /opt/docker/bch-regtest/data:/root/.bitcoin/regtest \
-p 18443:18443 -p 18444:18444 \
--name bchn-regtest \
bch/bitcoin-cash-node:v23.0.0 \
-regtest -server=1 \
-rpcuser=admin -rpcpassword=123456 \
-txindex=1 -paytxfee=0.00005 \
-rpcport=18443 -rpcallowip=0.0.0.0/0 \
-port=18444 -rpcbind=0.0.0.0:18443Parameter Breakdown:
-regtest: Enables the local development network.-txindex=1: Indexes all transactions for full query support.-rpcuser/-rpcpassword: Secures RPC access.
Step 3: Verify Deployment
3.1 Check Container Status
docker ps | grep bchn-regtest3.2 Monitor Logs
docker logs bchn-regtestLook for lines like:
UpdateTip: new best=0f9188f13... height=0
msghand thread startStep 4: Interact with BCH via RPC
4.1 Create a New Address
curl --user admin:123456 --data-binary '{
"jsonrpc": "1.0",
"method": "getnewaddress",
"params": ["test-wallet"]
}' http://127.0.0.1:184434.2 Mine Blocks
curl --user admin:123456 --data-binary '{
"jsonrpc": "1.0",
"method": "generatetoaddress",
"params": [6, "qz9qwcwqd3jrt669dvjg32pyd5kmh2x8zyvflejunj"]
}' http://127.0.0.1:184434.3 Check Balance
curl --user admin:123456 --data-binary '{
"jsonrpc": "1.0",
"method": "listaddressgroupings",
"params": []
}' http://127.0.0.1:18443👉 Master BCH development with these pro tips
FAQs
Q1: Why use -regtest instead of -testnet?
- A1: Regtest allows instant block generation for testing, while testnet requires mining and has network delays.
Q2: How do I reset the regtest environment?
- A2: Delete the data directory (
/opt/docker/bch-regtest/data) and restart the container.
Q3: What’s the default block reward in regtest mode?
- A3: Unlike mainnet, regtest has no fixed reward schedule. Use
generatetoaddressto create coins.
Q4: Can I connect multiple nodes to this regtest network?
- A4: Yes! Launch additional containers with the same parameters and connect them via
addnodeRPC.
Key Takeaways
- Docker simplifies BCH node deployment with isolated environments.
- Version v23.0.0 introduces updated RPC methods—always check the release notes.
- Use
-txindex=1for full transaction query capabilities.
Pro Tip: For production environments, replace -regtest with -testnet or omit it for mainnet (with caution!).
This Markdown output adheres to SEO best practices with:
- Hierarchical headings (`#` to `####`).
- Keyword integration ("BCH development," "Docker deployment," "RPC interfaces").
- FAQ section for user engagement.