Manages watch addresses and provides funding information via dashd
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
api
checker
cmd/watcher
logger
rpc
vendor
.editorconfig
.gitignore
LICENSE
Makefile
README.md
go.mod
go.sum

README.md

Address Watcher

Address Watcher is an HTTP JSON API that manages watch addresses and provides funding information via dashd.

Dependencies

The Address Watcher depends on a Dash Core node (dashd) with accessible RPC interface.

Building

make build
make build-linux

Both targets create binaries in the local dist directory.

Usage

→ ./dist/watcher --help
Address Watcher (0.0.7)

Usage:
  watcher --conf=<config-file-path>

Config

The Address Watcher requires a TOML configuration file via the --conf flag. The config file must contain the following values:

# address:port combination to bind to
bind = ":1337"

# HTTP basic auth username for this service
user = "admin"

# HTTP basic auth password for this service
pass = "pass"

# address of the dashd RPC server
rpc-server = "..."

# username for the dashd RPC server
rpc-user= "..."

# password for the dashd RPC server
rpc-pass = "..."

API Endpoints

GET /healthz

Returns the health status of the service. The health check queries the Dash block height to determine whether the RPC bridge is functional, and allow the caller to make their own determination about the freshness of the data.

Response:

{
    "version": "0.0.7",
    "agent": "/Dash Core:0.12.3.3/",
    "checks": {
        "rpc": {
            "blockheight": 940139,
            "passed": true
        }
    },
    "passed": true
}

POST /check

Attempts to retrieve the total received DASH for a collection of addresses.

This request can fail because the Dash Core node is still busy processing a blockchain rescan from a previous request. In such a case, the caller will receive a 503 response and a JSON error, and should simply retry the request again after some time.

Request:

{
  "addresses": [
    "XjoKfCv6rGUYsAa77KaFzrYMQdGWc27BqT",
    "XyLRGbNaySPL7GkLFmpa3xKCvBrBx8MFxg",
    "Xp293xgMMLsKtFnYaahcCFztN3A5hcv4pR"
  ]
}

Response:

{
  "results": [
    {
      "address": "XjoKfCv6rGUYsAa77KaFzrYMQdGWc27BqT",
      "received": 0.16409714
    },
    {
      "address": "XyLRGbNaySPL7GkLFmpa3xKCvBrBx8MFxg",
      "received": 0
    },
    {
      "address": "Xp293xgMMLsKtFnYaahcCFztN3A5hcv4pR",
      "received": 5.1
    }
  ]
}

Notes

If the Dash Core node is busy (having added new addresses in a previous request and still rescanning the blockchain), the server will respond with a 503 status code.