jouir / mining-dashboards

Grafana dashboards for cryptocurrency miners
The Unlicense
16 stars 2 forks source link

Chia DB table flexpool_miner_paid showing same information for many times #10

Closed ebeng closed 10 months ago

ebeng commented 3 years ago

just checking here, why is this table showing a lot of the same information? every minute it logs the same info, but the panel with the UNPAID Balance is not being updated and also the payments Panels etc as well...

just trying the understand the base logics of the repo to get this working for anyone ;)

jouir commented 3 years ago

The flexpool_miner_paid measurement is gathered by the following Telegraf input:

[[inputs.http]]
  name_override = "flexpool_miner_paid"
  urls = ["https://api.flexpool.io/v2/miner/paymentsStats?coin=${COIN}&address=${MINER_ADDRESS}"]
  data_format = "json"
  tagexclude = ["url"]
  json_query = "result"
  [inputs.http.tags]
    miner = "${MINER_ADDRESS}"
    coin = "${COIN}"

Example:

$ curl -XGET -s "https://api.flexpool.io/v2/miner/paymentsStats?coin=xch&address=xch1psa092ln2ksvu64065m8e7p53yn3jvwjwev4z9ddl7rpkramvkvqwm7x3x" | jq
{
  "error": null,
  "result": {
    "countervalue": 255.43,
    "lastPayment": {
      "hash": "0x8523262c7bc6b8e348d66bc9fb713b162c9643822c8c6910203c2116b29b53cb",
      "timestamp": 1629405449,
      "value": 578563999993,
      "fee": 0,
      "feePercent": 0,
      "feePrice": 0,
      "duration": 191211,
      "confirmed": false,
      "confirmedTimestamp": 0
    },
    "stats": {
      "averageValue": 623326199991.4,
      "averageFee": 0,
      "averageFeePercent": 0,
      "averageDuration": 220049,
      "totalPaid": 3116630999957,
      "totalFees": 0,
      "transactionCount": 5
    }
  }
}

When mining with a pool, money is not directly mined on the miner/farmer crypto wallet. The pool has a wallet that receives the block rewards. The pool virtually distributes a subpart of the reward to miners/farmers depending on a lot of things to what's called the "unpaid" balance. When this balance reaches a given threshold (0.10 XCH by default but this can be changed, that's why Flexpool is called "Flex" pool), the pool sends the balance to the real wallet. This is a payment.

As you can see, a payment is not instantaneous. On Flexpool, payments checks happen every hour or so. So every time the Telegraf agent calls the API, the same data will often be returned. You'll see flat lines on the "paid by the pool" graphs.

Example:

Screenshot from 2021-08-20 18-01-44

On the other hand, the "Unpaid" balance use another measurement, the "flexpool_miner_balance" defined by this call:

[[inputs.http]]
  name_override = "flexpool_miner_balance"
  urls = ["https://api.flexpool.io/v2/miner/balance?coin=${COIN}&address=${MINER_ADDRESS}"]
  data_format = "json"
  tagexclude = ["url"]
  json_query = "result"
  [inputs.http.tags]
    miner = "${MINER_ADDRESS}"
    coin = "${COIN}"

Example:

$ curl -XGET -s "https://api.flexpool.io/v2/miner/balance?coin=xch&address=xch1psa092ln2ksvu64065m8e7p53yn3jvwjwev4z9ddl7rpkramvkvqwm7x3x" | jq
{
  "error": null,
  "result": {
    "balance": 302928499998,
    "balanceCountervalue": 77.45,
    "price": 255.68
  }
}

This balance updates shortly after a block is discovered. For Chia, there are between 12 and 29 blocks discovered by day by Flexpool for the last week. It's normal that your balance does not update very often. Here is my unpaid balance evolution for example:

Screenshot from 2021-08-20 18-00-28

ebeng commented 3 years ago

The problem is this is showing as "no data"... I'm not sure what is wrong...

image

I did arrange a new dashboard with new Panel... that is showing more info... Before the 19th I did change some code of your to the APIv2 and now I also added yours into my panel.

image

Problem is that within the repo this unpaid balance is not shown with the daahboard files.

jouir commented 10 months ago

Unfortunately, Flexpool has shut down so I can't reproduce.