use makefile for quick installation and deployment

- update docs/installing.md
- edit WalletConfig.java to point to monero-wallet-rpc in .localnet
- remove monerod and monero-wallet-rpc from .gitignore
This commit is contained in:
erciccione 2021-07-27 13:28:28 +02:00 committed by woodser
parent b72db7f20d
commit a74fac9646
6 changed files with 256 additions and 317 deletions

2
.gitignore vendored
View File

@ -35,5 +35,3 @@ deploy
.java-version
.localnet
/apitest/src/main/resources/dao-setup*
/monero-wallet-rpc
/monerod

348
Makefile
View File

@ -1,279 +1,155 @@
#
# INTRODUCTION
#
# This makefile is designed to help Bisq contributors get up and running
# as quickly as possible with a local regtest Bisq network deployment,
# or 'localnet' for short. A localnet is a complete and self-contained
# "mini Bisq network" suitable for development and end-to-end testing
# efforts.
#
#
# REQUIREMENTS
#
# You'll need the following to proceed:
#
# - Linux, macOS or similar *nix with standard tools like `make`
# - bitcoind and bitcoin-cli (`brew install bitcoin` on macOS)
# - JDK 11 to build and run Bisq binaries; see
# https://jdk.java.net/archive/
#
#
# USAGE
#
# The following commands (and a couple manual instructions) will get
# your localnet up and running quickly.
#
# STEP 1: Build all Bisq binaries and set up localnet resources. This
# will take a few minutes the first time through.
#
# $ make
#
# Notes:
#
# - When complete, you'll have a number of scripts available in the
# root directory. They will be used in the make targets below to start
# the various Bisq seed and desktop nodes that will make up your
# localnet:
#
# $ ls -1 haveno-*
# haveno-desktop
# haveno-monitor
# haveno-pricenode
# haveno-relay
# haveno-seednode
# haveno-statsnode
#
# - You will see a new '.localnet' directory containing the data dirs
# for your regtest Bitcoin and Bisq nodes. Once you've deployed them in
# the step below, the directory will look as follows:
#
# $ tree -d -L 1 .localnet
# .localnet
# ├── alice
# ├── bitcoind
# ├── bob
# ├── mediator
# ├── seednode
# └── seednode2
#
# STEP 2: Deploy the Bitcoin and Bisq nodes that make up the localnet.
# Run each of the following in a SEPARATE TERMINAL WINDOW, as they are
# long-running processes.
#
# $ make bitcoind
# $ make seednode
# $ make seednode2
# $ make mediator
# $ make alice
# $ make bob
#
# Tip: Those familiar with the `screen` terminal multiplexer can
# automate the above by running the `deploy` target found below.
#
# Notes:
#
# - The 'seednode' targets launch headless Bisq nodes that help
# desktop nodes discover other peers, as well as storing and
# forwarding p2p network messages for nodes as they go on and
# offline.
#
# - As you run the 'mediator', 'alice' and 'bob' targets above,
# you'll see a Bisq desktop node window appear for each. The Alice
# and Bob instances represent two traders who can make and take
# offers with one another. The Mediator instance represents a Bisq
# contributor who can help resolve any technical problems or disputes
# that come up between the two traders.
#
# STEP 3: Configure the mediator Bisq node. In order to make and take
# offers, Alice and Bob will need to have a mediator and a refund agent
# registered on the network. Follow the instructions below to complete
# that process:
#
# a) Go to the Account screen in the Mediator instance and press CMD+D
# and a popup will appear. Click 'Unlock' and then click 'Register' to
# register the instance as a mediator.
#
# b) While still in the Account screen, press CMD+N and follow the same
# steps as above to register the instance as a refund agent.
#
# When the steps above are complete, your localnet should be up and
# ready to use. You can now test in isolation all Bisq features and use
# cases.
#
# See docs/installing.md
# Set up everything necessary for deploying your localnet. This is the
# default target.
setup: build .localnet
build: nodes localnet build-haveno
clean: clean-build clean-localnet
clean-build:
clean:
./gradlew clean
clean-localnet:
rm -rf .localnet ./dao-setup
rm -rf .localnet
# Build Bisq binaries and shell scripts used in the targets below
build: seednode/build desktop/build
localnet:
mkdir -p .localnet
seednode/build:
./gradlew :seednode:build
nodes: localnet
./scripts/xmr_btc_deps.sh
desktop/build:
./gradlew :desktop:build
build-haveno:
./gradlew build
# Unpack and customize a Bitcoin regtest node and Alice and Bob Bisq
# nodes that have been preconfigured with a blockchain containing the
# BSQ genesis transaction
.localnet:
# Unpack the old dao-setup.zip and move things around for more
# concise and intuitive naming. This is a temporary measure until we
# clean these resources up more thoroughly.
unzip docs/dao-setup.zip
mv dao-setup .localnet
mv .localnet/Bitcoin-regtest .localnet/bitcoind
mv .localnet/bisq-XMR_STAGENET_Alice_dao .localnet/alice
mv .localnet/bisq-XMR_STAGENET_Bob_dao .localnet/bob
# Remove the preconfigured bitcoin.conf in favor of explicitly
# parameterizing the invocation of bitcoind in the target below
rm -v .localnet/bitcoind/bitcoin.conf
# Avoid spurious 'runCommand' errors in the bitcoind log when nc
# fails to bind to one of the listed block notification ports
echo exit 0 >> .localnet/bitcoind/blocknotify
# Alias '.localnet' to 'localnet' so the target is discoverable in tab
# completion
localnet: .localnet
# Deploy a complete localnet by running all required Bitcoin and Bisq
# nodes, each in their own named screen window. If you are not a screen
# user, you'll need to manually run each of the targets listed below
# commands manually in a separate terminal or as background jobs.
deploy: setup
deploy:
# create a new screen session named 'localnet'
screen -dmS localnet
# deploy each node in its own named screen window
for target in \
bitcoind \
seednode \
seednode2 \
alice \
bob \
mediator; do \
screen -S localnet -X screen -t $$target; \
screen -S localnet -p $$target -X stuff "make $$target\n"; \
done;
seednode \
alice-desktop \
bob-desktop \
arbitrator-desktop; do \
screen -S localnet -X screen -t $$target; \
screen -S localnet -p $$target -X stuff "make $$target\n"; \
done;
# give bitcoind rpc server time to start
sleep 5
# generate a block to ensure Bisq nodes get dao-synced
make block
# Undeploy a running localnet by killing all Bitcoin and Bisq
# node processes, then killing the localnet screen session altogether
undeploy:
# kill all Bitcoind and Bisq nodes running in screen windows
screen -S localnet -X at "#" stuff "^C"
# quit all screen windows which results in killing the session
screen -S localnet -X at "#" kill
bitcoind: .localnet
bitcoind \
-regtest \
-prune=0 \
-txindex=1 \
-peerbloomfilters=1 \
-server \
-rpcuser=bisqdao \
-rpcpassword=bsq \
-datadir=.localnet/bitcoind \
-blocknotify='.localnet/bitcoind/blocknotify %s'
seednode: seednode/build
seednode:
./haveno-seednode \
--baseCurrencyNetwork=XMR_STAGENET \
--useLocalhostForP2P=true \
--useDevPrivilegeKeys=true \
--fullDaoNode=true \
--rpcUser=bisqdao \
--rpcPassword=bsq \
--rpcBlockNotificationPort=5120 \
--nodePort=2002 \
--userDataDir=.localnet \
--appName=seednode
--appName=haveno-XMR_STAGENET_Seed_2002 \
--daoActivated=false
seednode2: seednode/build
./haveno-seednode \
--baseCurrencyNetwork=XMR_STAGENET \
--useLocalhostForP2P=true \
--useDevPrivilegeKeys=true \
--fullDaoNode=true \
--rpcUser=bisqdao \
--rpcPassword=bsq \
--rpcBlockNotificationPort=5121 \
--nodePort=3002 \
--userDataDir=.localnet \
--appName=seednode2
mediator: desktop/build
arbitrator-desktop:
# Arbitrator and mediator need to be registerd in the UI after launching it.
./haveno-desktop \
--baseCurrencyNetwork=XMR_STAGENET \
--useLocalhostForP2P=true \
--useDevPrivilegeKeys=true \
--nodePort=4444 \
--appDataDir=.localnet/mediator \
--appName=Mediator
--appName=haveno-XMR_STAGENET_arbitrator \
--daoActivated=false \
--apiPassword=apitest \
--apiPort=9998
alice: setup
alice-desktop:
./haveno-desktop \
--baseCurrencyNetwork=XMR_STAGENET \
--useLocalhostForP2P=true \
--useDevPrivilegeKeys=true \
--nodePort=5555 \
--fullDaoNode=true \
--rpcUser=bisqdao \
--rpcPassword=bsq \
--rpcBlockNotificationPort=5122 \
--genesisBlockHeight=111 \
--genesisTxId=30af0050040befd8af25068cc697e418e09c2d8ebd8d411d2240591b9ec203cf \
--appDataDir=.localnet/alice \
--appName=Alice
--appName=haveno-XMR_STAGENET_Alice \
--daoActivated=false \
--apiPassword=apitest \
--apiPort=9999
bob: setup
alice-daemon:
./haveno-daemon \
--baseCurrencyNetwork=XMR_STAGENET \
--useLocalhostForP2P=true \
--useDevPrivilegeKeys=true \
--nodePort=5555 \
--appName=haveno-XMR_STAGENET_Alice \
--daoActivated=false \
--apiPassword=apitest \
--apiPort=9999
bob-desktop:
./haveno-desktop \
--baseCurrencyNetwork=XMR_STAGENET \
--useLocalhostForP2P=true \
--useDevPrivilegeKeys=true \
--nodePort=6666 \
--appDataDir=.localnet/bob \
--appName=Bob
--appName=haveno-XMR_STAGENET_Bob \
--daoActivated=false \
--apiPassword=apitest \
--apiPort=10000
# Generate a new block on your Bitcoin regtest network. Requires that
# bitcoind is already running. See the `bitcoind` target above.
block:
bitcoin-cli \
bob-daemon:
./haveno-daemon \
--baseCurrencyNetwork=XMR_STAGENET \
--useLocalhostForP2P=true \
--useDevPrivilegeKeys=true \
--nodePort=6666 \
--appName=haveno-XMR_STAGENET_Bob \
--daoActivated=false \
--apiPassword=apitest \
--apiPort=10000
monero-shared:
./.localnet/monerod \
--stagenet \
--no-igd \
--hide-my-port \
--data-dir .localnet/stagenet \
--add-exclusive-node 136.244.105.131:38080 \
--rpc-login superuser:abctesting123 \
--rpc-access-control-origins http://localhost:8080 \
--fixed-difficulty 100
monero-private1:
./.localnet/monerod \
--stagenet \
--no-igd \
--hide-my-port \
--data-dir .localnet/stagenet/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 \
--fixed-difficulty 100
monero-private2:
./.localnet/monerod \
--stagenet \
--no-igd \
--hide-my-port \
--data-dir .localnet/stagenet/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 \
--fixed-difficulty 100
bitcoind:
./.localnet/bitcoind \
-regtest \
-rpcuser=bisqdao \
-rpcpassword=bsq \
getnewaddress \
| xargs bitcoin-cli \
-regtest \
-rpcuser=bisqdao \
-rpcpassword=bsq \
generatetoaddress 1
-peerbloomfilters=1 \
-datadir=.localnet/ \
-rpcuser=haveno \
-rpcpassword=1234
# Generate more than 1 block.
# Instead of running `make block` 24 times,
# you can now run `make blocks n=24`
blocks:
bitcoin-cli \
-regtest \
-rpcuser=bisqdao \
-rpcpassword=bsq \
getnewaddress \
| xargs bitcoin-cli \
-regtest \
-rpcuser=bisqdao \
-rpcpassword=bsq \
generatetoaddress $(n)
btc-blocks:
./.localnet/bitcoin-cli \
-regtest \
-rpcuser=haveno \
-rpcpassword=1234 \
generatetoaddress 101 bcrt1q6j90vywv8x7eyevcnn2tn2wrlg3vsjlsvt46qz
.PHONY: build seednode
.PHONY: build seednode localnet

View File

@ -130,7 +130,7 @@ public class WalletConfig extends AbstractIdleService {
private static final String MONERO_DAEMON_USERNAME = "superuser";
private static final String MONERO_DAEMON_PASSWORD = "abctesting123";
private static final MoneroWalletRpcManager MONERO_WALLET_RPC_MANAGER = new MoneroWalletRpcManager();
private static final String MONERO_WALLET_RPC_PATH = System.getProperty("user.dir") + "/monero-wallet-rpc"; // current working directory
private static final String MONERO_WALLET_RPC_PATH = System.getProperty("user.dir") + File.separator + ".localnet" + File.separator + "monero-wallet-rpc"; // use wallet rpc in .localnet
private static final String MONERO_WALLET_RPC_USERNAME = "rpc_user";
private static final String MONERO_WALLET_RPC_PASSWORD = "abc123";
private static final long MONERO_WALLET_SYNC_RATE = 5000l;

View File

@ -1,104 +1,58 @@
# Running a local Haveno test network
These are the steps needed to set up a local Haveno test network.
These are the steps needed to set up a local Haveno test network. You'll have the possibility to either connect to our shared Monero stagenet node or to create your own private stagenet.
## 1. Download dependencies
## 1. Install 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).
On Ubuntu: `sudo apt install make wget git git-lfs openjdk-11-jdk`. The Bitcoin and Monero binaries will be downloaded and verified automatically in the next step.
## 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.
1. Download this repository: `git clone https://github.com/haveno-dex/haveno.git`
2. Navigate to the root of the repository (`cd haveno`) and build the repository: run `make` in the terminal and wait until the process is completed (this will also download and verify the Monero and Bitcoin binaries).
## 3. Run Monero
## 3. Run Bitcoin
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:
Run each of these commands in their own terminal window:
```
./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
```
1. Run Bitcoin: `make bitcoind`
2. Create bitcoin blocks: `make btc-blocks` (after running the command, this terminal window can be closed)
Your daemon will connect to our private Monero stagenet and will be ready to be used by Haveno.
## 4. Connect to Monero stagenet
### Run private stagenet
The quickest way to get a Monero stagenet running is by connecting to our own shared instance (4a) so you won't have to do anything except mine coins for testing (step 6). If you prefer to have total control over the testing instance, you might prefer running your own private Monero stagenet (4b).
If you prefer you can use a local private stagenet for testing instead of our shared one. Run in a terminal window:
### 4a. Join our shared stagenet
```
./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 --fixed-difficulty 10
```
Run `make monero-shared`
and in a second window:
### 4b. Run your own private stagenet
```
./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 --fixed-difficulty 10
```
1. In a new terminal window run `make monero-private1`;
1. In a new terminal window run `make monero-private2`;
3. Now mine the first 130 blocks to a random address before using, so wallets only use the latest output type. Run in one of the terminal windows opened above:
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`
```
start_mining 56k9Yra1pxwcTYzqKcnLip8mymSQdEfA6V7476W9XhSiHPp1hAboo1F6na7kxTxwvXU6JjDQtu8VJdGj9FEcjkxGJfsyyah 1
```
## 5. Deploy
## 4. Run Bitcoin
If you are a *screen* user, simply run `make deploy`. This command will open all needed Haveno instances (seednode, Alice, Bob, arbitrator) using *screen*. If you don't use *screen*, open 4 terminal windows and run in each one of them:
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. `make seednode`
2. `make arbitrator-desktop`
1. After the user interface opens, go to the *Account* tab and press `cmd+n`. Confirm the registration of the arbitrator.
2. From the *Account* tab press `cmd+d` and confirm the registration of the mediator.
3. `make alice-desktop` or if you want to run Alice as a daemon: `make alice-daemon`
4. `make bob-desktop` or if you want to run Bob as a daemon: `make bob-daemon`
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`
## 6. Fund your wallets
## 5. Run Haveno
When running Alice and Bob, you'll see a Monero address prompted in the terminal. Send stagenet XMR to the addresses of both Alice and Bob to be able to initiate a trade.
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).
You can fund the two wallets by mining some stagenet XMR coins to those addresses. To do so, open a terminal where you ran monerod and run: `start_mining ADDRESS 1`.
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"`).
monerod will start mining stagenet coins on your device using one thread. Replace `ADDRESS` with the address of Alice first, and then Bob's.
1. Run the seed node in one terminal:
## 7. Start testing
```
./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 will 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.)
You are all set. Now that everything is running and your wallets are funded, you can create test trades between Alice and Bob. Remember to mine a few blocks after opening and accepting the test trade so the transaction will be confirmed.

BIN
monero-wallet-rpc Executable file

Binary file not shown.

111
scripts/xmr_btc_deps.sh Executable file
View File

@ -0,0 +1,111 @@
#!/bin/bash
is_mac() {
if [[ "$OSTYPE" == "darwin"* ]]; then
return 0
else
return 1
fi
}
is_linux() {
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
return 0
else
return 1
fi
}
dw_source() {
if command -v wget &> /dev/null; then
downloader="wget"
elif command -v curl &> /dev/null; then
downloader="curl -L -O"
else
echo "! curl or wget are not installed. Please install one of the two"
exit 1
fi
${downloader} "$1"
}
# Verify Monero hash
check_monero() {
if is_mac; then
shasum -a 256 -c <<<'94e8736bda6bd50120b6ce9fdbf0f3b6ae8961cc9e0a546e165f911e51b1afa9 *monero-bins-haveno-'"${platform}"'.tar.gz' || exit 1
else
echo "ec46095e55d981304470d5f6a539aecdd64c912d6b2fe5195536b40e4d0e0015 monero-bins-haveno-${platform}.tar.gz" | sha256sum -c || exit 1
fi
echo "-> Monero binaries downloaded and verified"
}
# Verify hashes of bitcoind and bitcoin-cli
check_bitcoin() {
if is_mac; then
shasum -a 256 -c <<<'1ea5cedb64318e9868a66d3ab65de14516f9ada53143e460d50af428b5aec3c7 *bitcoin-'"${btcversion}"'-'"${btc_platform}"'.tar.gz' || exit 1
else
echo "366eb44a7a0aa5bd342deea215ec19a184a11f2ca22220304ebb20b9c8917e2b bitcoin-${btcversion}-${btc_platform}.tar.gz" | sha256sum -c || exit 1
fi
echo "-> Bitcoin binaries downloaded and verified"
}
# Download Monero bins
dw_monero() {
if is_mac; then
platform="mac"
else
platform="linux"
fi
if [ -f monero-bins-haveno-${platform}.tar.gz ]; then
check_monero
else
dw_source https://github.com/haveno-dex/monero/releases/download/testing/monero-bins-haveno-${platform}.tar.gz || { echo "! something went wrong while downloading the Monero binaries. Exiting..."; exit 1; } && \
check_monero
fi
tar -xzf monero-bins-haveno-${platform}.tar.gz --strip-components 1 && \
chmod +x {monerod,monero-wallet-rpc} || exit 1
}
# Download Bitcoin bins
dw_bitcoin() {
btcversion=0.21.1
if is_mac; then
btc_platform="osx64"
else
btc_platform="x86_64-linux-gnu"
fi
if [ -f bitcoin-${btcversion}-${btc_platform}.tar.gz ]; then
check_bitcoin
else
dw_source https://bitcoin.org/bin/bitcoin-core-${btcversion}/bitcoin-${btcversion}-${btc_platform}.tar.gz || { echo "! something went wrong while downloading the Bitcoin binaries. Exiting..."; exit 1; } && \
check_bitcoin
fi
tar -xzf bitcoin-${btcversion}-${btc_platform}.tar.gz && \
cp bitcoin-${btcversion}/bin/{bitcoin-cli,bitcoind} . && \
rm -r bitcoin-${btcversion} || exit 1
}
while true; do
cd .localnet
if ! is_linux && ! is_mac; then
bins_deps=("bitcoind" "bitcoin-cli" "monerod" "monero-wallet-rpc")
for i in ${bins_deps[@]}; do
[ -f "$i" ] || { echo "${i} not found."; echo "Dependencies are installed automatically only on Linux and Mac. Please manually install bitcoind, bitcoin-cli, monerod, and monero-wallet-rpc executables into haveno/.localnet/ before running make."; exit 1; }
done
exit 0
fi
dw_monero
dw_bitcoin
exit 0
done