update instructions for local testnet

- rewrite instructions to run local test network
- testers are now instructed to point their nodes to our private stagenet.
  this will make spinning up a test environment easier and faster.
- remove build instructions from the readme and move them to
  docs/installing.md.
This commit is contained in:
erciccione 2021-05-28 18:39:54 +02:00 committed by woodser
parent 369fc2946d
commit 0fc4b58e50
2 changed files with 106 additions and 50 deletions

View file

@ -45,7 +45,7 @@ Temporary email: havenodex@protonmail.com
### Styling guidelines ### Styling guidelines
See [CONTRIBUTING.md](docs/CONTRIBUTING.md) See [docs/CONTRIBUTING.md](docs/CONTRIBUTING.md)
## Bounties ## Bounties
@ -53,55 +53,7 @@ To incentivize development and reward contributors we adopt a simple bounty syst
## Running a local Haveno test network ## Running a local Haveno test network
1. Download [Monero CLI](https://www.getmonero.org/downloads/) for your system and sync Monero stagenet: `./monerod --stagenet --rpc-login superuser:abctesting123`, or alternatively, [set up a local Monero stagenet network](#running-a-local-monero-stagenet-network) (recommended) See [docs/install.md](docs/install.md)
2. Download and install [Bitcoin-Qt](https://bitcoin.org/en/download)
3. Run Bitcoin-Qt in regtest mode, e.g.: `./Bitcoin-Qt -regtest -peerbloomfilters=1`
4. In Bitcoin-Qt console, mine BTC regtest blocks: `generatetoaddress 101 bcrt1q6j90vywv8x7eyevcnn2tn2wrlg3vsjlsvt46qz`
5. Install [git lfs](https://git-lfs.github.com) for your system (Ubuntu: `sudo apt install git-lfs`)
6. `git clone https://github.com/Haveno-Dex/haveno`
7. Copy monero-wallet-rpc from step 1 to the haveno project root
8. Apply permission to run monero-wallet-rpc, e.g. `chmod 777 monero-wallet-rpc`
9. Optionally modify [WalletConfig.java](core/src/main/java/bisq/core/btc/setup/WalletConfig.java) with custom settings
10. `cd haveno`
11. `./gradlew build`
12. Start seed node, arbitrator, Alice, and Bob:
1. `./haveno-seednode --baseCurrencyNetwork=XMR_STAGENET --useLocalhostForP2P=true --useDevPrivilegeKeys=true --nodePort=2002 --appName=haveno-XMR_STAGENET_Seed_2002 --daoActivated=false`
2. `./haveno-desktop --baseCurrencyNetwork=XMR_STAGENET --useLocalhostForP2P=true --useDevPrivilegeKeys=true --nodePort=4444 --appName=haveno-XMR_STAGENET_arbitrator --daoActivated=false --apiPassword=apitest --apiPort=9998`
3. `./haveno-desktop --baseCurrencyNetwork=XMR_STAGENET --useLocalhostForP2P=true --useDevPrivilegeKeys=true --nodePort=5555 --appName=haveno-XMR_STAGENET_Alice --daoActivated=false --apiPassword=apitest --apiPort=9999`
4. `./haveno-desktop --baseCurrencyNetwork=XMR_STAGENET --useLocalhostForP2P=true --useDevPrivilegeKeys=true --nodePort=6666 --appName=haveno-XMR_STAGENET_Bob --daoActivated=false --apiPassword=apitest --apiPort=10000`
13. Arbitrator window > Account > cmd+n to register a new arbitrator
14. Arbitrator window > Account > cmd+d to register a new mediator
15. Deposit stagenet XMR to Alice and Bob's Haveno wallets (wallet address printed to terminal)
16. When deposited XMR is available, proceed to post offers, etc
### Running a local Monero stagenet network
1. Build [monero-project](https://github.com/monero-project/monero) with the following modification to the bottom of hardforks.cpp:
```c++
const hardfork_t stagenet_hard_forks[] = {
// version 1 from the start of the blockchain
{ 1, 1, 0, 1341378000 },
// versions 2-7 in rapid succession from March 13th, 2018
{ 2, 10, 0, 1521000000 },
{ 3, 20, 0, 1521120000 },
{ 4, 30, 0, 1521240000 },
{ 5, 40, 0, 1521360000 },
{ 6, 50, 0, 1521480000 },
{ 7, 60, 0, 1521600000 },
{ 8, 70, 0, 1537821770 },
{ 9, 80, 0, 1537821771 },
{ 10, 90, 0, 1550153694 },
{ 11, 100, 0, 1550225678 },
{ 12, 110, 0, 1571419280 },
{ 13, 120, 0, 1598180817 },
{ 14, 130, 0, 1598180818 }
};
```
2. Using the executables built in step 1:
* `./monerod --stagenet --no-igd --hide-my-port --data-dir node1 --p2p-bind-ip 127.0.0.1 --p2p-bind-port 48080 --rpc-bind-port 48081 --zmq-rpc-bind-port 48082 --add-exclusive-node 127.0.0.1:38080 --rpc-login superuser:abctesting123 --rpc-access-control-origins http://localhost:8080`
* `./monerod --stagenet --no-igd --hide-my-port --data-dir node2 --p2p-bind-ip 127.0.0.1 --rpc-bind-ip 0.0.0.0 --confirm-external-bind --add-exclusive-node 127.0.0.1:48080 --rpc-login superuser:abctesting123 --rpc-access-control-origins http://localhost:8080`
4. Mine the first 130 blocks to a random address before using so wallets only use the latest output type. For example, in a daemon: `start_mining 56k9Yra1pxwcTYzqKcnLip8mymSQdEfA6V7476W9XhSiHPp1hAboo1F6na7kxTxwvXU6JjDQtu8VJdGj9FEcjkxGJfsyyah 1`
## Sponsors ## Sponsors

104
docs/installing.md Normal file
View file

@ -0,0 +1,104 @@
# Running a local Haveno test network
These are the steps needed to set up a local Haveno test network.
## 1. Download dependencies
1. Install git, git-lfs, and Java. On Ubuntu: `sudo apt install git git-lfs openjdk-11-jdk`
2. Download the Monero binaries. To make things easier, we provide two custom Monero binaries: `monerod` and `monero-wallet-rpc`. You can directly [download the software (Linux and Mac)](https://github.com/haveno-dex/monero/releases/tag/testing) or build the binaries yourself by cloning and building the `release-v0.17` branch of this repository: https://github.com/haveno-dex/monero
3. Download and install [Bitcoin-Qt](https://bitcoin.org/en/download).
## 2. Build Haveno
1. Download this repository. Run `git clone https://github.com/haveno-dex/haveno.git`
2. Navigate inside the repository (`cd haveno`) and start the build: `./gradlew build`. It will take some minutes. If you know what you are doing you can modify [WalletConfig.java](core/src/main/java/bisq/core/btc/setup/WalletConfig.java) with custom settings before building.
## 3. Run Monero
1. Unpack the downloaded or built archives from step 1.2 and copy `monero-wallet-rpc` to the root of this repository. Make sure it has the right permissions (if you are in doubt, just run `chmod 777 monero-wallet-rpc`).
2. Now join our shared stagenet (skip this command and see the next section if you prefer to test Haveno using a local private stagenet). Navigate into the folder containing `monerod` and run:
```
./monerod --stagenet --no-igd --hide-my-port --data-dir stagenet --add-exclusive-node 136.244.105.131:38080 --rpc-login superuser:abctesting123 --rpc-access-control-origins http://localhost:8080 --fixed-difficulty 10
```
Your daemon will connect to our private Monero stagenet and will be ready to be used by Haveno.
### Run private stagenet
If you prefer you can use a local private stagenet for testing instead of our shared one. Run in a terminal window:
```
./monerod --stagenet --no-igd --hide-my-port --data-dir node1 --p2p-bind-ip 127.0.0.1 --p2p-bind-port 48080 --rpc-bind-port 48081 --zmq-rpc-bind-port 48082 --add-exclusive-node 127.0.0.1:38080 --rpc-login superuser:abctesting123 --rpc-access-control-origins http://localhost:8080
```
and in a second window:
```
./monerod --stagenet --no-igd --hide-my-port --data-dir node2 --p2p-bind-ip 127.0.0.1 --rpc-bind-ip 0.0.0.0 --confirm-external-bind --add-exclusive-node 127.0.0.1:48080 --rpc-login superuser:abctesting123 --rpc-access-control-origins http://localhost:8080
```
Now mine the first 130 blocks to a random address before using so wallets only use the latest output type. For example, in a daemon:
```
start_mining 56k9Yra1pxwcTYzqKcnLip8mymSQdEfA6V7476W9XhSiHPp1hAboo1F6na7kxTxwvXU6JjDQtu8VJdGj9FEcjkxGJfsyyah 1
```
## 4. Run Bitcoin
Haveno still relies on Bitcoin for its infrastructure. We will remove it soon. In the meantime, to run Haveno locally, you'll need to download Bitcoin QT and run it in regtest mode. Which means you won't need to download the Bitcoin blockchain.
1. Download and install [Bitcoin-Qt](https://bitcoin.org/en/download)
2. Run Bitcoin-Qt in regtest mode, e.g.: `./Bitcoin-Qt -regtest -peerbloomfilters=1`
3. Click on the *Console* tab and mine regtest blocks all at once. Run: `generatetoaddress 101 bcrt1q6j90vywv8x7eyevcnn2tn2wrlg3vsjlsvt46qz`
## 5. Run Haveno
Now that you have both Bitcoin and Monero running, it's time to spin up your testing instances. You'll need to open 4 terminal windows: 1 for the seed node, 1 for the arbitrator, 1 for Alice (trader 1) and 1 for Bob (trader 2).
It could be useful to rename the terminal to have a better overview of what terminal belongs to whom (on Ubuntu: echo -en "\033]0;NEW_TITLE\a").
1. Run the seed node in one terminal:
```
./haveno-seednode --baseCurrencyNetwork=XMR_STAGENET --useLocalhostForP2P=true --useDevPrivilegeKeys=true --nodePort=2002 --appName=haveno-XMR_STAGENET_Seed_2002 --daoActivated=false
```
2. Run the Arbitrator instance:
```
./haveno-desktop --baseCurrencyNetwork=XMR_STAGENET --useLocalhostForP2P=true --useDevPrivilegeKeys=true --nodePort=4444 --appName=haveno-XMR_STAGENET_arbitrator --daoActivated=false --apiPassword=apitest --apiPort=9998
```
The (temporary) Haveno user interface will open. Once Haveno launches:
3. Click on the *Account* tab and press `cmd+n`. Confirm the registration of the arbitrator.
4. From the *Account* tab press `cmd+d` and confirm the registration of the mediator.
Make sure to register arbitrator and mediator. Without them it's not possible to initiate a trade on the PoC.
5. Run Alice:
```
./haveno-desktop --baseCurrencyNetwork=XMR_STAGENET --useLocalhostForP2P=true --useDevPrivilegeKeys=true --nodePort=5555 --appName=haveno-XMR_STAGENET_Alice --daoActivated=false --apiPassword=apitest --apiPort=9999
```
6. Run Bob:
```
./haveno-desktop --baseCurrencyNetwork=XMR_STAGENET --useLocalhostForP2P=true --useDevPrivilegeKeys=true --nodePort=6666 --appName=haveno-XMR_STAGENET_Bob --daoActivated=false --apiPassword=apitest --apiPort=10000
```
## 5. Get yourself some stagenet coins
Alice and Bob's receiving address is printed to their terminal on startup.
Mining is the recommended method to receive new stagenet coins. The difficulty is locked to 10, so mining would be very fast. Go to your monerod instance and run `start_mining ADDRESS 1`. Monerod will start mining stagenet coins on your device using one thread. Replace `ADDRESS` with the address of Alice first, and then Bob's.
Alternatively, you can contact ErCiccione on Matrix (`@ErCiccione:haveno.network`) and give him a stagenet address.
Remember to send funds to both Alice and Bob.
## 6. Start trading
Now you can open and take offers using the Haveno PoC (which is still mostly Bisq in the user interface. The redesign is in progress.)