4

I'm looking for a way to use Bitcoin Core in Regtest in a WiFi network (educational purposes in classroom).

The goal is that students install Bitcoin Core, activate Regtest, generate coins and send them to each other.

The problem is, in my tests (on two separate laptops), the nodes don't find each other. When I want to use the console command addnode I assume I have to use an IPv4 address with port number but I can nowhere find the port number that is currently used for each machine.

Also, I don't know what de conf file should contain for this purpose. I hope someone can shed a light on this? Thank you.

4
  • 1
    This post from 2018 seems to have a .conf example for what you want to do. Commented Mar 28 at 9:03
  • Thank you I think it was really useful. In my home network test with 2 laptops, the nodes are "seeing" each other. These are the config files I used: 'Main PC: regtest=1 server=1 [regtest] port=18332 rpcport = 18333 rpcuser=bitcoinrpc rpcpassword=password rpcallowip=0.0.0.0/0 Other Nodes: regtest=1 server=1 [regtest] #change port number and rpcport for each machine in the network port=18443 rpcport = 18444 #edit ip-address and port number according to network config connect=192.168.xx.xx:18332 ' Generated coins are still immature though.
    – Bart DV
    Commented Mar 28 at 9:32
  • 1
    You can use something like bitcoin-cli generate 101 and be able to spend the first coins Commented Mar 28 at 9:40
  • Yes, I found out that they become mature after 100 blocks. So it's best to mine 101 blocks directly I guess. When we send tx to each other, I also guess I have to mine a block now and then via generatetoaddress...
    – Bart DV
    Commented Mar 28 at 9:46

2 Answers 2

2

You could consider using a custom signet instead. Other than regtest, it’s not a sandbox environment, but an actual network. I think you should for example not need to change ports for signet. You’d still need a way to get the initial connection to the network, though. A key difference would be that only the signet operator with the signing key can sign new blocks into existence, whereas anyone can generate blocks on regtest, if that is an important point.

4
  • Thanks for the input. I could try it but first I have to learn about signet though. After googling I've found: "Why run Signet? You are an Instructor, and want to run a controlled Bitcoin network environment for teaching purposes." -> Should try in that case. Many thanks!
    – Bart DV
    Commented Mar 28 at 12:41
  • I think you might have been looking at the same page already, but trying to find instructions on how to set up a custom signet, I found: en.bitcoin.it/wiki/Signet#Custom_Signet
    – Murch
    Commented Mar 28 at 12:49
  • Yes, same page but very challenging for me. I'm not good in terminal windows and the example is a Linux one I see.
    – Bart DV
    Commented Mar 28 at 13:01
  • 1
    If you want, you could ask a "How do I set up my own custom signet?" question here on BSE. I was surprised we didn’t have it yet.
    – Murch
    Commented Mar 28 at 13:20
2

It works with following configuration files (on different machines):

Main PC:

regtest=1  
server=1

[regtest] 
port=18332 
rpcport = 18333  
rpcuser=bitcoinrpc 
rpcpassword=password 
rpcallowip=0.0.0.0/0

Other Nodes:

regtest=1 
server=1

[regtest]
#edit ip-address and port number according to network config 
connect=192.168.xx.xx:18332

This way each PC (node) connects to the main computer (so each student only connects to the teacher's PC.) Each student could post his IP-address with a different Port Number in a Teams/Discord channel and add more nodes to the conf file. I also tested with addnode=x.x.x.x:18332 for the second PC and that also works.

1
  • Cool, I hope your students and you have a blast!
    – Murch
    Commented Apr 3 at 14:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.