0 votes
1 view
in Blockchain by (7k points)

I am looking for a way to simulate a 1000 node bitcoin network on my private LAN/Wifi network.

I read the developer's guide: https://bitcoin.org/en/developer-examples#regtest-mode which mentions the regtest mode that works primarily for single nodes or specified nodes and not random nodes like the actual network.

Some people might suggest using the testnet mode but that is not useful for me as I want to check a new protocol for bitcoins that won't be supported by the unknown nodes over the testnet network.

To put it simply, I am looking to simulate a complete bitcoin network within my LAN/Wifi network.

1 Answer

0 votes
by (14.5k points)

If you want to simulate a 1000 node bitcoin network on your private LAN network, there are some things that you need to keep in mind before jumping on to coding. The most effective way to simulate a 1000 node bitcoin network is to sandbox them before connecting them to the LAN. 

Also, specify unique ports while listening and specify the rpcport while using RPC for each node. Additionally, specify unique data directories for all nodes individually.

If you are doing it for the first time, you can use the mkdir command to create directories. 

mkdir $HOME/regtest/X/

mkdir $HOME/regtest/Y/

mkdir $HOME/regtest/Z/

Once done, you can modify and further execute the bash script. Note the port numbers to connect to each other in round-robin in the next round. 

#!/bin/bash

bitcoind -server -listen -port=17590 -rpcuser=<user> -rpcpassword=<pass> -rpcport=16590 -datadir=$HOME/regtest/X/ -addnode=localhost:17591 -regtest -pid=$HOME/regtest/X/ -daemon -debug

bitcoind -server -listen -port=17591 -rpcuser=<user> -rpcpassword=<pass> -rpcport=16591 -datadir=$HOME/regtest/Y/ -addnode=localhost:17592 -regtest -pid=$HOME/regtest/Y/ -daemon -debug

bitcoind -server -listen -port=17592 -rpcuser=<user> -rpcpassword=<pass> -rpcport=16592 -datadir=$HOME/regtest/Z/ -addnode=localhost:17590 -regtest -pid=$HOME/regtest/Z/ -daemon -debug

In the question, you have also mentioned that you want to research peer discover. So, for different use cases you may use, and note the difference between - connect and - addnode.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...