Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Mike Hearn on March 15, 2011, 01:43:13 PM



Title: Testnet in a box
Post by: Mike Hearn on March 15, 2011, 01:43:13 PM
The testnet difficulty has risen again - people use GPUs to speed up their testing and then the network adapts.

To solve this I've put together testnet-in-a-box. It's a zip file you can extract locally, run a couple of commands and you have a difficulty-1, private testnet instance with a few thousand coins for you to spend. You can then use CPU mining to create blocks every 10 minutes as normal or a GPU miner for blocks every few seconds.

Get it here:

  http://sourceforge.net/projects/bitcoin/files/Bitcoin/testnet-in-a-box/

The README file contains instructions on how to use it.


Title: Re: Testnet in a box
Post by: johnieeliang on March 15, 2011, 03:50:58 PM
thanks man testing out now


Title: Re: Testnet in a box
Post by: JollyGreen on March 15, 2011, 06:08:39 PM
great idea, I'll try it out tonight!


Title: Re: Testnet in a box
Post by: JollyGreen on March 16, 2011, 07:02:27 AM
Great Job!  Not your problem, but it's still kind of annoying at difficulty 1 it takes 1 hour to generate a block on a 1000khash/sec machine....

oh well, this should be faster than the current testnet.  Thanks


Title: Re: Testnet in a box
Post by: JollyGreen on March 16, 2011, 07:40:29 AM
is there a way to run the block explorer on the testbox setup you created?


Title: Re: Testnet in a box
Post by: Mike Hearn on March 16, 2011, 09:30:50 AM
It didn't take that long for me, perhaps you just got unlucky. But yeah, I think for faster testing the way to go is to introduce a third localtest network that has super easy difficulty. For now you can use a graphics card to knock out blocks.

No way to run blockexplorer. It's not open source (afaik).


Title: Re: Testnet in a box
Post by: Jan on June 29, 2011, 07:50:55 AM
testnet-in-a-box almost works for me with the current bitcoin client on a windows system.

Observations:
 I can start the two clients on the same windows box (two processes running).
 Only one of them has a UI, and the other is headless until i stop the first.
 The first client correctly displays 192 blocks and 3650 coins, and the second zero coins.
 The -deamon option seems not to make any difference.
 Issuing the getinfo command gives me a dialog "error: couldn't connect to server"

Is testnet-in-a-box only supported on a Linux system?


Title: Re: Testnet in a box
Post by: Roodemol on November 21, 2011, 10:25:30 PM
Hello,
is it possible to setup "testnet in a box" with a pool on a computer and mine with a miner (cgminer, DiabloMiner, ...) on a second one? With such a configuration one could easily test modifications on the SHA algorithm.

Does anyone have a sample configuration?

Regards,
Gilles


Title: Re: Testnet in a box
Post by: terrytibbs on December 09, 2011, 03:15:57 PM
is there a way to run the block explorer on the testbox setup you created?

No way to run blockexplorer. It's not open source (afaik).

Try bitcoin-abe (https://github.com/jtobey/bitcoin-abe).


Title: Re: Testnet in a box
Post by: Red Emerald on December 09, 2011, 08:12:21 PM
nifty


Title: Re: Testnet in a box
Post by: farproc on July 09, 2013, 03:54:42 AM
Not work with 0.8.3?

The 2 clients are always syncing. No progress at all.


Title: Re: Testnet in a box
Post by: Mike Hearn on July 09, 2013, 08:44:44 AM
I haven't tried this in a while. We have something better now anyway. Grab git master, build it (or wait for the next Bitcoin release) and then run it with the -regtest flag:

./bitcoind -regtest &

Now connect a client to it on port 18444 and run:

./bitcoind -regtest setgenerate true

You just got a block, immediately. Run that command again to get a block whenever you want one. Regtest mode has difficulty set to (effectively) zero, so you can mine blocks in about 300 msec on a regular CPU.

Your software has to support the regtest network parameters of course, but obviously regular Bitcoin does (in git master) as does bitcoinj (again in git master).


Title: Re: Testnet in a box
Post by: 🏰 TradeFortress 🏰 on July 09, 2013, 08:52:48 AM
This is awesome - thanks so much! No longer will I have to wait or beg for new blocks on testnet.

That also means I cannot procrastinate for 5 - 30 minutes through :(..


Title: Re: Testnet in a box
Post by: Mike Hearn on July 09, 2013, 10:39:33 AM
You're welcome :)


Title: Re: Testnet in a box
Post by: aray on January 29, 2014, 03:45:20 PM
I haven't tried this in a while. We have something better now anyway. Grab git master, build it (or wait for the next Bitcoin release) and then run it with the -regtest flag:

./bitcoind -regtest &

Now connect a client to it on port 18444 and run:

./bitcoind -regtest setgenerate true

You just got a block, immediately. Run that command again to get a block whenever you want one. Regtest mode has difficulty set to (effectively) zero, so you can mine blocks in about 300 msec on a regular CPU.

Your software has to support the regtest network parameters of course, but obviously regular Bitcoin does (in git master) as does bitcoinj (again in git master).

This does not seem work for me, using bitcoind 0.8.6 on Linux. The process started by ./bitcoind -regtest & is very active, ./bitcoind -regtest getmininginfo shows generate is true and an increasing block count, but no test bitcoin accumulate.

It may be that I don't understand what the phrase 'connect a client to it on port 18444' means. Are there complete instructions (including the setup of bitcoin.conf and any other prerequisites that I haven't thought of) for running  with -regtest anywhere?


Title: Re: Testnet in a box
Post by: Mike Hearn on January 29, 2014, 05:12:47 PM
You need to use git master or the soon to be released 0.9.0rc1 for regtest mode.


Title: Re: Testnet in a box
Post by: eigenjoy on June 03, 2014, 07:27:13 PM
I just finished a video on how to setup a 2-node local testnet using Docker. In the video, I setup the testnet on the container and then make transactions with Bitcoin-Qt on the host. You can watch the video here: https://www.youtube.com/watch?v=LLZNvl90PC0

If you have docker installed, it's pretty straightforward. Essentially you:

Code:
# pull the testnet box
docker pull freewil/bitcoin-testnet-box

# run our box. map an extra port
docker run -t -i --name bitcoind -P -p 49020:19000 freewil/bitcoin-testnet-box

I'll write up a blog post describing all of the commands shortly. I'm doing a whole series of videos on how to get started programming bitcoin transactions, so if this interests you, subscribe to the channel. (https://www.youtube.com/channel/UCK-cOrTiQKgX1g7XMRqfFvQ)


Title: Re: Testnet in a box
Post by: Muhammed Zakir on July 22, 2014, 02:05:09 AM
The testnet difficulty has risen again - people use GPUs to speed up their testing and then the network adapts.

To solve this I've put together testnet-in-a-box. It's a zip file you can extract locally, run a couple of commands and you have a difficulty-1, private testnet instance with a few thousand coins for you to spend. You can then use CPU mining to create blocks every 10 minutes as normal or a GPU miner for blocks every few seconds.

Get it here:

  http://sourceforge.net/projects/bitcoin/files/Bitcoin/testnet-in-a-box/

The README file contains instructions on how to use it.

Thanks! :)

Quote
The testnet difficulty has risen again - people use GPUs to speed up their testing and then the network adapts.

Why doesn't they care about others? ???

Kindly,
      MZ


Title: Re: Testnet in a box
Post by: rapport on July 23, 2014, 07:37:51 AM
The testnet difficulty has risen again - people use GPUs to speed up their testing and then the network adapts.

To solve this I've put together testnet-in-a-box. It's a zip file you can extract locally, run a couple of commands and you have a difficulty-1, private testnet instance with a few thousand coins for you to spend. You can then use CPU mining to create blocks every 10 minutes as normal or a GPU miner for blocks every few seconds.

Get it here:

  http://sourceforge.net/projects/bitcoin/files/Bitcoin/testnet-in-a-box/

The README file contains instructions on how to use it.

Thanks! :)

Did you see Mike's comment above with regtest?
We have something better now anyway. Grab git master, build it (or wait for the next Bitcoin release) and then run it with the -regtest flag:
./bitcoind -regtest &