Bitcoin Forum
September 27, 2020, 06:13:53 PM *
News: Latest Bitcoin Core release: 0.20.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How run multiple nodes in regtest/testnet mode on a single machine?  (Read 126 times)
Staizita
Newbie
*
Offline Offline

Activity: 13
Merit: 4


View Profile
October 24, 2018, 03:21:31 PM
 #1

OS:Windows 10
Bitcoin Core Version:0.16.0

How run multiple nodes in regtest/testnet mode on a single machine?
I want to test.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1601230433
Hero Member
*
Offline Offline

Posts: 1601230433

View Profile Personal Message (Offline)

Ignore
1601230433
Reply with quote  #2

1601230433
Report to moderator
1601230433
Hero Member
*
Offline Offline

Posts: 1601230433

View Profile Personal Message (Offline)

Ignore
1601230433
Reply with quote  #2

1601230433
Report to moderator
1601230433
Hero Member
*
Offline Offline

Posts: 1601230433

View Profile Personal Message (Offline)

Ignore
1601230433
Reply with quote  #2

1601230433
Report to moderator
AdolfinWolf
Legendary
*
Offline Offline

Activity: 1512
Merit: 1280


people run from rain but sit in bathtubs of water


View Profile
October 24, 2018, 03:39:34 PM
Last edit: October 25, 2018, 10:56:52 AM by AdolfinWolf
Merited by seoincorporation (1), Cryddit (1)
 #2

OS:Windows 10
Bitcoin Core Version:0.16.0

How run multiple nodes in regtest/testnet mode on a single machine?
I want to test.

You mean something like this? https://olivermouse.wordpress.com/2018/01/13/connecting-multiple-bitcoin-core-nodes-regtest/

This might be a better answer. https://bitcoin.stackexchange.com/a/39168

Quote from: https://bitcoin.stackexchange.com/a/39168 By Jonas Schnelli
You probably want to run multiple bitcoind instances in regtest to simulate multiple nodes. Thats pretty easy. You can run a second instance by starting bitcoind with a clean data directory and a different RPC and P2P port.

For that, you could create a 2nd data directory (example: /tmp/datadir2). Create /tmp/datadir2/bitcoin.conf.

Use something similar than
Code:
regtest=1
rpcuser=rt
rpcuser=rt
port=12340
rpcport=10340
discover=0
Now you need to connect your first node with your 2nd node by sending a addnode over the RPC interface.
Code:
bitcoin-cli addnode 127.0.0.1:10340 onetry

You can than distinct between both nodes with the -datadir argument while calling bitcoin-cli.
Code:
bitcoin-cli -datadir=/tmp/datadir2/ getinfo

Some examples:

generate coins in first node (50 BTC available)

Code:
bitcoin-cli generate 101

get address from 2nd node

Code:
bitcoin-cli -datadir=/tmp/datadir2/ getnewaddress

send coins to 2nd node

Code:
bitcoin-cli sendtoaddress <address> 10.0



I'm pretty sure you can add as many nodes as you want. Simply add another dir for each of them.

seoincorporation
Legendary
*
Offline Offline

Activity: 1848
Merit: 1648


BtcBoss


View Profile
October 25, 2018, 03:53:39 PM
 #3

OS:Windows 10
Bitcoin Core Version:0.16.0

How run multiple nodes in regtest/testnet mode on a single machine?
I want to test.

You mean something like this? https://olivermouse.wordpress.com/2018/01/13/connecting-multiple-bitcoin-core-nodes-regtest/

This might be a better answer. https://bitcoin.stackexchange.com/a/39168

Quote from: https://bitcoin.stackexchange.com/a/39168 By Jonas Schnelli
You probably want to run multiple bitcoind instances in regtest to simulate multiple nodes. Thats pretty easy. You can run a second instance by starting bitcoind with a clean data directory and a different RPC and P2P port.

For that, you could create a 2nd data directory (example: /tmp/datadir2). Create /tmp/datadir2/bitcoin.conf.

Use something similar than
Code:
regtest=1
rpcuser=rt
rpcuser=rt
port=12340
rpcport=10340
discover=0
Now you need to connect your first node with your 2nd node by sending a addnode over the RPC interface.
Code:
bitcoin-cli addnode 127.0.0.1:10340 onetry

You can than distinct between both nodes with the -datadir argument while calling bitcoin-cli.
Code:
bitcoin-cli -datadir=/tmp/datadir2/ getinfo

Some examples:

generate coins in first node (50 BTC available)

Code:
bitcoin-cli generate 101

get address from 2nd node

Code:
bitcoin-cli -datadir=/tmp/datadir2/ getnewaddress

send coins to 2nd node

Code:
bitcoin-cli sendtoaddress <address> 10.0



I'm pretty sure you can add as many nodes as you want. Simply add another dir for each of them.

Wise words from AdolfinWolf, I think this way is the best one but isn't the only one.

If you want to have more independence on each testnet, you can o it with virtual machines. First download VirtualBox, install the OS you want, then get bitcoin core. After your node gets updated you can clone that virtual machine, That way if you fuckup the core, the test net or the full os, you still have a clone of the machine when the configuration was fine.

I just love virtual machines, is awesome to run 20 PC's in the same computer, the only problem about that is you need nice hardware, a lot of RAM and a nice CPU  Tongue

.BitDice.               ▄▄███▄▄
           ▄▄██▀▀ ▄ ▀▀██▄▄
      ▄▄█ ▀▀  ▄▄█████▄▄  ▀▀ █▄▄
  ▄▄██▀▀     ▀▀ █████ ▀▀     ▀▀██▄▄
██▀▀ ▄▄██▀      ▀███▀      ▀██▄▄ ▀▀██
██  ████▄▄       ███       ▄▄████  ██
██  █▀▀████▄▄  ▄█████▄  ▄▄████▀▀█  ██
██  ▀     ▀▀▀███████████▀▀▀     ▀  ██
             ███████████
██  ▄     ▄▄▄███████████▄▄▄     ▄  ██
██  █▄▄████▀▀  ▀█████▀  ▀▀████▄▄█  ██
██  ████▀▀       ███       ▀▀████  ██
██▄▄ ▀▀██▄      ▄███▄      ▄██▀▀ ▄▄██
  ▀▀██▄▄     ▄▄ █████ ▄▄     ▄▄██▀▀
      ▀▀█ ▄▄  ▀▀█████▀▀  ▄▄ █▀▀
           ▀▀██▄▄ ▀ ▄▄██▀▀
               ▀▀███▀▀
        ▄▄███████▄▄
     ▄███████████████▄
    ████▀▀       ▀▀████
   ████▀           ▀████
   ████             ████
   ████ ▄▄▄▄▄▄▄▄▄▄▄ ████
▄█████████████████████████▄
██████████▀▀▀▀▀▀▀██████████
████                   ████
████                   ████
████                   ████
████                   ████
████                   ████
████▄                 ▄████
████████▄▄▄     ▄▄▄████████
  ▀▀▀█████████████████▀▀▀
        ▀▀▀█████▀▀▀
▄▄████████████████████████████████▄▄
██████████████████████████████████████
█████                            █████
█████                            █████
█████                            █████
█████                            █████
█████                     ▄▄▄▄▄▄▄▄▄▄
█████                   ▄█▀▀▀▀▀▀▀▀▀▀█▄
█████                   ██          ██
█████                   ██          ██
█████                   ██          ██
██████████████████▀▀███ ██          ██
 ████████████████▄  ▄██ ██          ██
   ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ██          ██
             ██████████ ██          ██
           ▄███████████ ██████▀▀██████
          █████████████  ▀████▄▄████▀
[/]
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!