Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the wiki page describing how to use regtest #1833

Closed
devinbileck opened this issue Oct 29, 2018 · 2 comments
Closed

Update the wiki page describing how to use regtest #1833

devinbileck opened this issue Oct 29, 2018 · 2 comments

Comments

@devinbileck
Copy link
Member

Since I found the wiki documentation to be confusing and outdated, I have provided updated content below for the wiki page describing how to use regtest
https://github.com/bisq-network/bisq/wiki/4.2.1.-How-to-use-Bisq-with-regtest-(advanced)

Introduction

You can test Bisq locally without requiring a connection to the Tor-based P2P network and without requiring another trading partner by using regtest mode.

Note that this method is intended for developers and technical users only for the purpose of testing Bisq. You will need to edit lines in the source code of Bisq, requiring you to compile the code from source.

The regtest environment differs from the testnet and mainnet networks because it runs a local Bitcoin network on your computer and allows you to run multiple instances of Bisq to simulate each side of a trade. This environment is ideally suited for testing because you are able to create blocks on demand (no need to wait for confirmations) and you don't need to download the entire blockchain, therefore startup and trading is much faster.

You can find more information about the Bitcoin regtest mode here.

Before testing Bisq in regtest mode, read the Bisq wiki to learn about the basic setup process.

Run Bitcoin Core in Regtest Mode

Running Bitcoin Core in regtest mode does not require you to download the blockchain making 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.

Note that while testing the trade process, when you need a blockchain confirmation the command for creating a single block is: generate 1.

Read the bitcoinj wiki for more information about regtest mode.

Run the Seed Node

The seed node is required for the bootstrap process in the P2P network. It must be running before you start the Bisq application.

Run SeedNode.jar (after building from source, will be located in the seednode/build/libs folder) 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.

Setup the Arbitrator Instance

Before starting instances of the Bisq application as "traders", you will need to start and configure an instance of Bisq as an "arbitrator".

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 running, click the "Account" button and press Alt+R to reveal the hidden "Arbitrator Registration" tab and select it. The developer registration key will be pre-filled. Select your preferred language to complete the arbitrator registration.

At this point you can close the arbitrator instance, since it is not necessary to be running, and proceed to create the trader instances (see below), which will auto-select your registered arbitrator (provided a matching language is defined).

Launch the Trader Instances

Here we will launch two instances of the Bisq application as "traders" and refer to them as Alice (as a Bitcoin buyer) and Bob (as a Bitcoin seller).

Pass the following list of program arguments to the application instance to create Alice:
--baseCurrencyNetwork=BTC_REGTEST --useLocalhostForP2P=true --nodePort=3632 --appName=bisq-BTC_REGTEST_Ali --useDevPrivilegeKeys=true

Pass the following list of program arguments to the application instance to create Bob:
--baseCurrencyNetwork=BTC_REGTEST --useLocalhostForP2P=true --nodePort=3333 --appName=bisq-BTC_REGTEST_Bob --useDevPrivilegeKeys=true

Testing the Trading Process

At this point you can now perform trades between Alice and Bob using your local regtest environment and test from both the buyer's and seller's perspective.

Note, remember to generate a new block in the Bitcoin Core console after taking an offer using the command generate 1.

Testing Disputes/Arbitration

If you want to test disputes and the role of the arbitrator, you will need to navigate to the Portfolio/Open Trades tab as either Alice or Bob and press Ctrl+o or Cmd+o to manually open a dispute. You will then need to launch the arbitrator instance as described above.

@ManfredKarrer
Copy link
Contributor

Great thanks! Just updated wiki page with your text!

@mpolavieja
Copy link
Contributor

It is mandatory that these two parameters go together " baseCurrencyNetwork=BTC_REGTEST --useLocalhostForP2P=true" Otherwise trades do not get confirmed because somehow the Bitcoin network connected peer shows your local ip address instead of "[127.0.0.1]:18444"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants