-
Notifications
You must be signed in to change notification settings - Fork 0
4.2.1. How to use Bisq with regtest (advanced)
You can test Bisq locally without any connection to the Tor bases P2P network, and without another trading partner. Note that this method is intended for developers and technical users only.
Before testing Bisq in regtest mode, read the user guide to learn about the basic setup process.
The regtest differs from the testnet and mainnet networks because it runs a local Bitcoin network on your computer. You can find more information about the bitcoin regtest mode here.
You also need to change some lines in the source code of Bisq. Therefore you need to compile the code from source. Just read this article for more info.
If you run Bitcoin Core in regtest mode you don't download any blockchain. This makes the startup process quick.
To begin, navigate to the bitcoin.config file and set regtest=1, or add -regtest as a program argument when starting the Bitcoin Core binary.
On your first use, you need to create 101 blocks using generate 101
via the console inside Bitcoin Core. The command for creating a single block is: generate 1
. That will be needed to get a blockchain confirmation during the trade process.
Read here for more information.
The following need to be downloaded/installed to set up two Bisq instances:
-
Java (8u20 or better)
-
The latest SeedNode jar file: SeedNode.jar
The SeedNode is needed for the bootstrap process in the P2P network. It must be running before you start the Bisq application. Run the SeedNode.jar with the command: java -jar SeedNode.jar --baseCurrencyNetwork=BTC_REGTEST --useLocalhostForP2P=true --nodePort=2002 --myAddress=localhost:2002 --appName=bisq-BTC_REGTEST_Seed_2002 --useDevPrivilegeKeys=true
.
Before starting the trade instances you also need to set up an arbitrator. Activate the acceptance of developer keys by setting USE_DEV_PRIVILEGE_KEYS = true
in DevEnv.java. Pass the following list of program arguments to the application instance to create the arbitrator:
--baseCurrencyNetwork=BTC_REGTEST --useLocalhostForP2P=true --nodePort=9222 --appName=bisq-BTC_REGTEST_Arb --useDevPrivilegeKeys=true
Once the arbitrator instance is created, click the menu button "Account", press alt+R to reveal the hidden "Arbitrator Registration" tab and select it. Here you get prefilled the developer registration key. Select your preferred language to complete the arbitrator registration. Then you can close the instance and proceed to create the trader instances (see below), which will auto-select your registered arbitrator (provided a matching language is defined).
This instance features Alice as the bitcoin buyer:
--baseCurrencyNetwork=BTC_REGTEST --useLocalhostForP2P=true --nodePort=3632 --appName=bisq-BTC_REGTEST_Ali --useDevPrivilegeKeys=true
Instance for Bob as the bitcoin seller:
--baseCurrencyNetwork=BTC_REGTEST --useLocalhostForP2P=true --nodePort=3333 --appName=bisq-BTC_REGTEST_Bob --useDevPrivilegeKeys=true
With that setup you can do trades in regtest mode in localhost environment (not over Tor and therefor the startup is faster) and test from both the buyer's and seller's perspective on your local machine. Please remember to generate a new block in the Bitcoin Core console after taking an offer.
Of course you can run those instances from the development IDE (we recommend IntelliJ) and set the program arguments there.
If you want to test arbitration locally you need to navigate to the Portfolio/Open Trades tab and press Ctrl+o
or Cmd+o
to manually open a dispute.