<p>I would recommend using the testnet of your desired client (bitcoin/litecoin etc.) with it's own genesis block and thus it's own blockchain. Configure the testnet parameters in chainparams.cpp to fit your desired outcome, compile it on a couple of nodes on your LAN and configure them to connect to each other in your config file (your/data/dir/.yourcoin) by appending the line connect=IPADDRESS:PORT</p>

<p>You will also want to make sure that you have DNS seeding disabled. Once you have done this you will be able to mine coins on the testnet, grow the chain and eventually depending on how you've set your parameters the network will retarget difficulty and work as if it were on the main network but you will be shielded from the outside world.</p>

CC BY-SA 4.0
2018-06-14T04:33:15.407Z
yup, I'm aware that I can compile from source to set up my private net, I'm just wondering if there's some easier where I don't need to deal with the source code to do it. If there's no better option then I guess I'll just have to recompile from source.
hellopeach
CC BY-SA 4.0
2018-07-31T13:43:23.690Z
Yeah unfortunately you'll have to play with the source to get the outcome you desire. Also, don't forget to comment out the hard-coded seed nodes in chainparamsseeds.h and change the "magic number" values in chainparams.cpp under pchMessageStart. Good luck!
apt-getschwifty
CC BY-SA 4.0
2018-06-13T17:24:31.823Z
2018-06-13T17:24:31.823Z
apt-getschwifty
<p>I have some experience in Ethereum-related development and it was very easy to set up a private net with Ethereum that simulate the public main net, I just create a custom genesis block json config, then I can use it to set up half a dozen nodes to connect to a single bootnode, and voila I have a completely up and working private net which can perfectly mimic how the public main net works where I can mine ether and send transactions and wait for them to be mined in around 15 seconds, which is perfect for development and testing.</p>

<p>However when it comes to bitcoin it seems there's no easy way to setup a private net in a closed environment? I have searched around and the best I can find is use the regtest mode to connect multiple nodes, but there seems to be no way to simulate the real mining process, or do I really need to download the Bitcoin source and change some hardcoded settings and recompile my own version of (alt) bitcoin to just setup a private net?</p>

CC BY-SA 4.0
2018-06-13T06:09:13.420Z
What do you mean by "no way to simulate the real mining process"? You can mine on regtest.
Ava Chow
CC BY-SA 4.0
2018-06-13T10:50:57.953Z
@Andrew Chow, well from what I got from google results, it seems you just generate new blocks instantly in regtest mode, not really doing PoW mining to get a new block? Also the block confirmation is 100 blocks which is not the same as the public network. So are those info I see online incorrect?
hellopeach
CC BY-SA 4.0
2018-06-13T17:42:21.740Z
It is still PoW mining, just the difficulty is extremely low. The difficulty also does not change. Otherwise, everything is the same as the mainnet. There is no such thing as "block confirmation". However there is coinbase maturity which is the number of confirmations for a coinbase transaction to be spendable from, and that is 100 blocks. This is the same for mainnet.
Ava Chow
CC BY-SA 4.0
2018-06-14T04:28:32.720Z
@Andrew Chow, okay I guess the online tutorials that I looked up messed up on the concepts of block maturity and transaction maturity, but still the mining mechanism seems different from mainnet, since it seems I'm not able to mine the regtest nodes with an older version of cgminer that still supports cpu mining?
hellopeach
CC BY-SA 4.0
2018-06-14T06:30:32.103Z
cgminer relies on getblocktemplate which is not available unless your node is connected to another node. This behavior is the same for mainnet, testnet, and regtest. cgminer should work on regtest if you can connect another node. Of course it is going to mine blocks extremely quickly as the difficulty is extremely low and does not change.
Ava Chow
<development><private-blockchains>
How to setup a Bitcoin private net that can simulate the public net?
hellopeach
# How to setup a Bitcoin private net that can simulate the public net?

(Asked by: username_0 on 2018-06-13)

I have some experience in Ethereum-related development and it was very easy to set up a private net with Ethereum that simulate the public main net, I just create a custom genesis block json config, then I can use it to set up half a dozen nodes to connect to a single bootnode, and voila I have a completely up and working private net which can perfectly mimic how the public main net works where I can mine ether and send transactions and wait for them to be mined in around 15 seconds, which is perfect for development and testing.

However when it comes to bitcoin it seems there's no easy way to setup a private net in a closed environment? I have searched around and the best I can find is use the regtest mode to connect multiple nodes, but there seems to be no way to simulate the real mining process, or do I really need to download the Bitcoin source and change some hardcoded settings and recompile my own version of (alt) bitcoin to just setup a private net?

**Tags:** development, private-blockchains

> **Comments:**
> **username_1**: What do you mean by "no way to simulate the real mining process"? You can mine on regtest.  
> **username_0**: @Andrew username_1, well from what I got from google results, it seems you just generate new blocks instantly in regtest mode, not really doing PoW mining to get a new block? Also the block confirmation is 100 blocks which is not the same as the public network. So are those info I see online incorrect?  
> **username_1**: It is still PoW mining, just the difficulty is extremely low. The difficulty also does not change. Otherwise, everything is the same as the mainnet. There is no such thing as "block confirmation". However there is coinbase maturity which is the number of confirmations for a coinbase transaction to be spendable from, and that is 100 blocks. This is the same for mainnet.  
> **username_0**: @Andrew username_1, okay I guess the online tutorials that I looked up messed up on the concepts of block maturity and transaction maturity, but still the mining mechanism seems different from mainnet, since it seems I'm not able to mine the regtest nodes with an older version of cgminer that still supports cpu mining?  
> **username_1**: cgminer relies on getblocktemplate which is not available unless your node is connected to another node. This behavior is the same for mainnet, testnet, and regtest. cgminer should work on regtest if you can connect another node. Of course it is going to mine blocks extremely quickly as the difficulty is extremely low and does not change.  

---

## 1 answers

### Answer by username_2 on 2018-06-13. Score: 0 | Accepted answer

I would recommend using the testnet of your desired client (bitcoin/litecoin etc.) with it's own genesis block and thus it's own blockchain. Configure the testnet parameters in chainparams.cpp to fit your desired outcome, compile it on a couple of nodes on your LAN and configure them to connect to each other in your config file (your/data/dir/.yourcoin) by appending the line connect=IPADDRESS:PORT

You will also want to make sure that you have DNS seeding disabled. Once you have done this you will be able to mine coins on the testnet, grow the chain and eventually depending on how you've set your parameters the network will retarget difficulty and work as if it were on the main network but you will be shielded from the outside world.

> **Comments:**
> **username_0**: yup, I'm aware that I can compile from source to set up my private net, I'm just wondering if there's some easier where I don't need to deal with the source code to do it. If there's no better option then I guess I'll just have to recompile from source.  
> **username_2**: Yeah unfortunately you'll have to play with the source to get the outcome you desire. Also, don't forget to comment out the hard-coded seed nodes in chainparamsseeds.h and change the "magic number" values in chainparams.cpp under pchMessageStart. Good luck!  

---

