Skip to content

fed-franz/bitcoin-network-simulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Local Bitcoin Network

It allows to locally simulate a Bitcoin network with Docker. Currently working with Testnet only.

Use 'btc-net-start.sh' to:

  1. Create an isolated /16 IP4 network (btcnet)
  2. Run the BIND DNS server at IP 10.1.1.2
  3. Run nodes and miners

Usage

'./btc-net-start.sh '

Default parameters are:

  • number-of-nodes = 100
  • number-of-miners = 10

DNS

Build: docker build -t btcnet-dns .
Run: docker run -d --rm --network btcnet --ip 10.1.1.2 --name=btcdns btcnet-dns
Check if the DNS is working: nslookup seed.seeder.btc 10.1.1.2
Stop: docker stop btcdns

To overwrite BIND files without rebuilding the container you can mount a folder at /root/mnt. Files in this folder will be copied recursively into /etc/bind and overwrite default files.
In order to work properly, the mounted folder must have the same structure as /etc/bind. See bind folder in this repo as a reference.
You can use docker's -v option to mount the folder at runtime.
For instance:
docker run -d --rm --network btcnet --ip 10.1.1.2 --name=btcdns -v $(pwd)/bind:/root/mnt fedfranz/btcnet-dns

To check the log, you can execute the following command:
docker exec -it btcdns tcpdump -i eth0 -vvv -s 0 -l -n port 53
or run a bash terminal and then execute the command dnslog:

$ docker exec -it btcdns /bin/bash
# dnslog

x9.seed.seeder.btc is redirected to seed.seeder.btc

NODE

Syntax:
docker run -d --rm --network=btcnet --dns=DNS_IP --name=btcnode-sipa fedfranz/btcnet-node [BTC_NET] [DNS_IP]

Default DNS_IP is 10.1.1.2

Exposed ports:
Mainnet: 8333, 8332 (RPC)
Testnet: 18333, 18332 (RPC)
Regtest: 18444, 18443 (RPC)

About

A local Bitcoin network reproduced with Docker

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published