But now I want to connect to another node on the regtest mode so I am able to send him a freshly ''mined'' block. What do I have to do. What kind of new data directory do I have to setup and what files do I need? How do I do then the connection to this node?
You received quite a number of replies in your other thread, link:
How to add a node in regtest mode via GUI?In my reply specifically, you'll have to start bitcoin-qt with
--datadir and other parameters.
In the command line, use the same method but start bitcoind with the same parameters but you'll also have to add different
-rpcport -rpcuser -rpcpassword per instance
so that you can use bitcoin-cli RPC commands to specific nodes.
This is how I start my bitcoind Regtest 3-Nodes setup:
Node1:
bitcoind -regtest -port=8330 -datadir=E:\AppData\Bitcoin-altdir1 -rpcport=18001 -rpcuser=node1 -rpcpassword=node1
Node2:
bitcoind -regtest -port=8330 -connect=127.0.0.1:8330 -datadir=E:\AppData\Bitcoin-altdir2 -rpcport=18002 -rpcuser=node2 -rpcpassword=node2
Node3:
bitcoind -regtest -port=8330 -connect=127.0.0.1:8330 -datadir=E:\AppData\Bitcoin-altdir3 -rpcport=18003 -rpcuser=node3 -rpcpassword=node3
So, when using bitcoin-cli to use RPC commands, you'll have to add the specific
-rpcport -rpcuser -rpcpassword to tell which node to send the command.
Example for Node1:
bitcoin-cli -rpcport=18001 -rpcuser=node1 -rpcpassword=node1 getblockchaininfo