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 @Slf4j
public class ProvidersRepository { public class ProvidersRepository {
private static final List<String> DEFAULT_NODES = Arrays.asList( private static final List<String> DEFAULT_NODES = Arrays.asList(
"http://wizpriceje6q5tdrxkyiazsgu7irquiqjy2dptezqhrtu7l2qelqktid.onion/", // @wiz "http://gbmks3wzvdzu5xq6gnqpj2qz3262tcr36iltagk37udcbwzsbfazq3yd.onion/" // Haveno
"http://emzypricpidesmyqg2hc6dkwitqzaxrqnpkdg3ae2wef5znncu2ambqd.onion/", // @emzy
"http://aprcndeiwdrkbf4fq7iozxbd27dl72oeo76n7zmjwdi4z34agdrnheyd.onion/", // @mrosseel
"http://devinpndvdwll4wiqcyq5e7itezmarg7rzicrvf6brzkwxdm374kmmyd.onion/", // @devinbileck
"http://ro7nv73awqs3ga2qtqeqawrjpbxwarsazznszvr6whv7tes5ehffopid.onion/" // @alexej996
); );
private final Config config; 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 // 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 // Use localhost for using a locally running provider
// providerAsString = Collections.singletonList("http://localhost:8080/"); // providerAsString = Collections.singletonList("http://localhost:8080/");
providers = Collections.singletonList("https://price.bisq.wiz.biz/"); // @wiz providers = Collections.singletonList("https://price.haveno.network/"); // Haveno
} else { } else {
providers = DEFAULT_NODES; providers = DEFAULT_NODES;
} }

View file

@ -1,24 +1,21 @@
# bisq-pricenode # Haveno-pricenode
## Overview ## 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 exchange rates, available at `/getAllMarketPrices`, and
- Bitcoin mining fee rates, available at `/getFees` - 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 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. 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. 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.
Operating a production pricenode is a valuable service to the Bisq network, and operators should issue BSQ compensation requests accordingly.
## Prerequisites for running a pricenode ## Prerequisites for running a pricenode
@ -34,10 +31,10 @@ To run a pricenode, you will need:
Run the one-command installer: Run the one-command installer:
```bash ```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 ### 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 If you run a main pricenode, you also are obliged to activate the monitoring feed by running
```bash ```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 Furthermore, you are obliged to provide network size data to the monitor by running
```bash ```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 ### 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: Then build an updated pricenode:
```./gradlew :pricenode:installDist -x test``` ```./gradlew :pricenode:installDist -x test```
## How to deploy elsewhere ## How to deploy elsewhere
@ -79,7 +77,7 @@ Then build an updated pricenode:
## Bitcoin mining fee estimates ## 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. 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] [Service]
SyslogIdentifier=Haveno-pricenode SyslogIdentifier=Haveno-pricenode
EnvironmentFile=/etc/default/Haveno-pricenode.env EnvironmentFile=/etc/default/haveno-pricenode.env
ExecStart=/Haveno/Haveno/Haveno-pricenode 2 ExecStart=/pricenode/haveno/haveno-pricenode 2
ExecStop=/bin/kill -TERM ${MAINPID} ExecStop=/bin/kill -TERM ${MAINPID}
Restart=on-failure Restart=on-failure
User=Haveno User=pricenode
Group=Haveno Group=pricenode
PrivateTmp=true PrivateTmp=true
ProtectSystem=full ProtectSystem=full

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -e
echo "[*] Haveno haveno-pricenode installation script" echo "[*] haveno-pricenode installation script"
##### change as necessary for your system ##### change as necessary for your system
@ -12,11 +12,11 @@ ROOT_USER=root
ROOT_GROUP=root ROOT_GROUP=root
#ROOT_HOME=/root #ROOT_HOME=/root
HAVENO_USER=haveno HAVENO_USER=pricenode
HAVENO_GROUP=haveno HAVENO_GROUP=pricenode
HAVENO_HOME=/haveno 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_NAME=haveno
HAVENO_REPO_TAG=master HAVENO_REPO_TAG=master
HAVENO_LATEST_RELEASE=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" echo "[*] Adding Tor configuration"
if ! grep "${HAVENO_TORHS}" /etc/tor/torrc >/dev/null 2>&1;then 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 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}" sudo -H -i -u "${ROOT_USER}" sh -c "echo HiddenServiceVersion 3 >> ${TOR_CONF}"
fi fi