Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wallet: expose a coin distribution endpoint for utxo summary statistics #22

Merged
merged 1 commit into from
Jul 25, 2020

Conversation

turbomaze
Copy link

Usage:

curl http://x:apikey@localhost:14039/wallet/:wallet/coin-distribution\?bucketExponent\=10

Output:

{
  "distributions": [
    [
      {
        "minValue": 0,
        "maxValue": 100000,
        "counts": { "OPEN": 9, "REGISTER": 1, "RENEW": 1 },
        "totalValue": 0
      },
      {
        "minValue": 100000,
        "maxValue": 1000000,
        "counts": { "NONE": 4 },
        "totalValue": 3975060
      },
      {
        "minValue": 1000000,
        "maxValue": 10000000,
        "counts": { "REDEEM": 5, "REGISTER": 2, "NONE": 2 },
        "totalValue": 15990580
      },
      {
        "minValue": 10000000,
        "maxValue": 100000000,
        "counts": {},
        "totalValue": 0
      },
      {
        "minValue": 100000000,
        "maxValue": 1000000000,
        "counts": { "NONE": 1 },
        "totalValue": 100000000
      },
      {
        "minValue": 1000000000,
        "maxValue": 10000000000,
        "counts": { "NONE": 1831 },
        "totalValue": 3661854639960
      }
    ]
  ]
}

@turbomaze turbomaze requested a review from RevCBH July 25, 2020 03:38
@RevCBH
Copy link

RevCBH commented Jul 25, 2020

Presumably we will want to be able to get this information across backends, too. Right?

@turbomaze
Copy link
Author

Yes, I structured the response as an array of distributions so that the shape to the client is consistent if we're returning 1 distribution or 10. The load balancer layer can accumulate distributions in the same distribution key

Copy link

@RevCBH RevCBH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@turbomaze turbomaze merged commit fbb2a2a into production-namebase Jul 25, 2020
@turbomaze turbomaze deleted the anthony-utxo-metrics branch July 25, 2020 04:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants