settings for pricenodes and add our pricenodes

This commit is contained in:
erciccione 2022-03-06 16:45:18 +01:00 committed by GitHub
parent 10f39aa65f
commit 07c48a04f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 51 deletions

View File

@ -36,11 +36,7 @@ import javax.annotation.Nullable;
@Slf4j
public class ProvidersRepository {
private static final List<String> DEFAULT_NODES = Arrays.asList(
"http://wizpriceje6q5tdrxkyiazsgu7irquiqjy2dptezqhrtu7l2qelqktid.onion/", // @wiz
"http://emzypricpidesmyqg2hc6dkwitqzaxrqnpkdg3ae2wef5znncu2ambqd.onion/", // @emzy
"http://aprcndeiwdrkbf4fq7iozxbd27dl72oeo76n7zmjwdi4z34agdrnheyd.onion/", // @mrosseel
"http://devinpndvdwll4wiqcyq5e7itezmarg7rzicrvf6brzkwxdm374kmmyd.onion/", // @devinbileck
"http://ro7nv73awqs3ga2qtqeqawrjpbxwarsazznszvr6whv7tes5ehffopid.onion/" // @alexej996
"http://gbmks3wzvdzu5xq6gnqpj2qz3262tcr36iltagk37udcbwzsbfazq3yd.onion/" // Haveno
);
private final Config config;
@ -109,7 +105,7 @@ public class ProvidersRepository {
// If we run in localhost mode we don't have the tor node running, so we need a clearnet host
// Use localhost for using a locally running provider
// providerAsString = Collections.singletonList("http://localhost:8080/");
providers = Collections.singletonList("https://price.bisq.wiz.biz/"); // @wiz
providers = Collections.singletonList("https://price.haveno.network/"); // Haveno
} else {
providers = DEFAULT_NODES;
}

View File

@ -1,24 +1,21 @@
# bisq-pricenode
# Haveno-pricenode
## Overview
The Bisq pricenode is a simple HTTP service that fetches, transforms and relays data from third-party price providers to Bisq exchange clients on request. Available prices include:
The Haveno pricenode is a simple HTTP service that fetches, transforms and relays data from third-party price providers to Haveno exchange clients on request. Available prices include:
- Bitcoin exchange rates, available at `/getAllMarketPrices`, and
- Bitcoin mining fee rates, available at `/getFees`
Pricenodes are deployed in production as Tor hidden services. This is not because the location of these nodes needs to be kept secret, but rather so that Bisq exchange clients do not need to exit the Tor network in order to get price data.
Pricenodes are deployed in production as Tor hidden services. This is not because the location of these nodes needs to be kept secret, but rather so that Haveno exchange clients do not need to exit the Tor network in order to get price data.
Anyone can run a pricenode, but it must be _discoverable_ in order for it to do any good. For exchange clients to discover your pricenode, its .onion address must be hard-coded in the Bisq exchange client's `ProvidersRepository` class. Alternatively, users can point explicitly to given pricenode (or set of pricenodes) with the exchange client's `--providers` command line option.
Anyone can run a pricenode, but it must be _discoverable_ in order for it to do any good. For exchange clients to discover your pricenode, its .onion address must be hard-coded in the Haveno exchange client's `ProvidersRepository` class. Alternatively, users can point explicitly to given pricenode (or set of pricenodes) with the exchange client's `--providers` command line option.
Pricenodes can be deployed anywhere Java and Tor binaries can be run. Instructions below cover deployment on localhost, and instructions [how to deploy on Heroku](README-HEROKU.md) are also available.
Pricenodes should be cheap to run with regard to both time and money. The application itself is non-resource intensive and can be run on the low-end of most providers' paid tiers.
A [pricenode operator](https://github.com/bisq-network/roles/issues/5)'s main responsibilities are to ensure their node(s) are available and up-to-date. Releases are currently source-only, with the assumption that most operators will favor Git-based "push to deploy" workflows. To stay up to date with releases, operators can [subscribe to this repository's releases.atom feed](https://github.com/bisq-network/pricenode/releases.atom) and/or get notifications in the `#pricenode` Slack channel.
Operating a production pricenode is a valuable service to the Bisq network, and operators should issue BSQ compensation requests accordingly.
A pricenode operator's main responsibilities are to ensure their node(s) are available and up-to-date. Releases are currently source-only, with the assumption that most operators will favor Git-based "push to deploy" workflows.
## Prerequisites for running a pricenode
@ -34,10 +31,10 @@ To run a pricenode, you will need:
Run the one-command installer:
```bash
curl -s https://raw.githubusercontent.com/bisq-network/bisq/master/pricenode/install_pricenode_debian.sh | sudo bash
curl -s https://raw.githubusercontent.com/haveno-dex/haveno/master/pricenode/install_pricenode_debian.sh | sudo bash
```
At the end of the installer script, it should print your Tor onion hostname.
This will install the pricenode under the user `pricenode`. At the end of the installer script, it should print your Tor onion hostname.
### Test
@ -55,20 +52,21 @@ curl http://localhost:8080/info
If you run a main pricenode, you also are obliged to activate the monitoring feed by running
```bash
bash <(curl -s https://raw.githubusercontent.com/bisq-network/bisq/master/monitor/install_collectd_debian.sh)
bash <(curl -s https://raw.githubusercontent.com/haveno-dex/haveno/master/monitor/install_collectd_debian.sh)
```
Follow the instruction given by the script and report your certificate to the [@bisq-network/monitoring](https://github.com/orgs/bisq-network/teams/monitoring-operators) team or via the [Keybase](https://keybase.io/team/bisq) `#monitoring` channel!
Furthermore, you are obliged to provide network size data to the monitor by running
```bash
curl -s https://raw.githubusercontent.com/bisq-network/bisq/master/pricenode/install_networksize_debian.sh | sudo bash
curl -s https://raw.githubusercontent.com/haveno-dex/Haveno/master/pricenode/install_networksize_debian.sh | sudo bash
```
### Updating
Update your bisq code in /bisq/bisq with ```git pull```
Update your Haveno code in /Haveno with ```git pull```
Then build an updated pricenode:
```./gradlew :pricenode:installDist -x test```
## How to deploy elsewhere
@ -79,7 +77,7 @@ Then build an updated pricenode:
## Bitcoin mining fee estimates
The pricenode exposes a service API to Bisq clients under `/getFees`.
The pricenode exposes a service API to Haveno clients under `/getFees`.
This API returns a mining fee rate estimate, representing an average of several mining fee rate values retrieved from different `mempool.space` instances.

View File

@ -1,20 +0,0 @@
# Refactorings
The list of stuff remaining to complete the PR at https://github.com/bisq-network/pricenode/pull/7
- Document provider implementations w/ links to API docs, etc
- Add integration tests
- Document / discuss how operators should (ideally) operate their pricenodes on a push-to-deploy model, e.g. how it's done on Heroku
## Non-refactorings
Most or all of these will become individual issues / PRs. Just capturing them here for convenience now. Not all may make sense.
- Deprecate existing get* endpoints (e.g. /getAllMarketPrices) in favor of '/exchange-rates', '/fee-estimate;
- Eliminate dependency on bisq-core (only real need now is CurrencyUtil for list of supported coins)
- Remove command line args for fee estimation params; hard-code these values and update them via commits, not via one-off changes by each operator
- Remove 'getParams' in favor of Boot actuator endpoint
- Update bisq-network/exchange to refer to 'provider' as 'pricenode'
- Invert the dependency arrangement. Move 'ProviderRepository' et al from bisq-network/exchange here into
bisq-network/pricenode and have bisq-network/exchange depend on it as a client lib
- Save bandwidth and be idiomatic by not pretty-printing json returned from /getAllMarketPrices et al

View File

@ -4,13 +4,13 @@ After=network.target
[Service]
SyslogIdentifier=Haveno-pricenode
EnvironmentFile=/etc/default/Haveno-pricenode.env
ExecStart=/Haveno/Haveno/Haveno-pricenode 2
EnvironmentFile=/etc/default/haveno-pricenode.env
ExecStart=/pricenode/haveno/haveno-pricenode 2
ExecStop=/bin/kill -TERM ${MAINPID}
Restart=on-failure
User=Haveno
Group=Haveno
User=pricenode
Group=pricenode
PrivateTmp=true
ProtectSystem=full

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -e
echo "[*] Haveno haveno-pricenode installation script"
echo "[*] haveno-pricenode installation script"
##### change as necessary for your system
@ -12,11 +12,11 @@ ROOT_USER=root
ROOT_GROUP=root
#ROOT_HOME=/root
HAVENO_USER=haveno
HAVENO_GROUP=haveno
HAVENO_HOME=/haveno
HAVENO_USER=pricenode
HAVENO_GROUP=pricenode
HAVENO_HOME=/pricenode
HAVENO_REPO_URL=https://github.com/haveno-network/haveno
HAVENO_REPO_URL=https://github.com/haveno-dex/haveno
HAVENO_REPO_NAME=haveno
HAVENO_REPO_TAG=master
HAVENO_LATEST_RELEASE=master
@ -45,7 +45,7 @@ sudo -H -i -u "${ROOT_USER}" DEBIAN_FRONTEND=noninteractive apt-get install -qq
echo "[*] Adding Tor configuration"
if ! grep "${HAVENO_TORHS}" /etc/tor/torrc >/dev/null 2>&1;then
sudo -H -i -u "${ROOT_USER}" sh -c "echo HiddenServiceDir ${TOR_RESOURCES}/${HAVENO_TORHS}/ >> ${TOR_CONF}"
sudo -H -i -u "${ROOT_USER}" sh -c "echo HiddenServicePort 80 127.0.0.1:8080 >> ${TOR_CONF}"
sudo -H -i -u "${ROOT_USER}" sh -c "echo HiddenServicePort 80 127.0.0.1:8078 >> ${TOR_CONF}"
sudo -H -i -u "${ROOT_USER}" sh -c "echo HiddenServiceVersion 3 >> ${TOR_CONF}"
fi