I am working on a app in which my project communicates with the bitcoin server to get the details of a transaction with transaction id as the parameter. I have bitcoind, bitcoin-cli and bitcoin-qt installed on my system. When I run the bitcoin-qt in regtest mode, I am able to create test transactions in which I can send money to an address and get the transaction id for the same. I use this transaction id in my app, I am able to get the transaction details from bitcoin-qt. The problem is, now my testing is limited to only outward transactions wherein I transfer bitcoins to another account. How can I create some test transactions wherein bitcoins are credited to my wallet?
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:
Use something similar than:
Now you need to connect your first node with your 2nd node by sending a
addnode over the RPC interface.
bitcoin-cli addnode 127.0.0.1:10340 onetry
You can than distinct between both nodes with the
-datadir argument while calling
bitcoin-cli -datadir=/tmp/datadir2/ getinfo
generate coins in first node (50 BTC available)
bitcoin-cli generate 101
get address from 2nd node
bitcoin-cli -datadir=/tmp/datadir2/ getnewaddress
send coins to 2nd node
bitcoin-cli sendtoaddress <address> 10.0