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

Total Balance in node info API #868

Open
spikeekips opened this issue Dec 5, 2018 · 2 comments
Open

Total Balance in node info API #868

spikeekips opened this issue Dec 5, 2018 · 2 comments

Comments

@spikeekips
Copy link
Contributor

spikeekips commented Dec 5, 2018

Total increased balance = Initial balance + block inflation + PF inflation

@spikeekips
Copy link
Contributor Author

I am a little bit confused about this feature; it also can be served by explorer like 3rd party service.

@dahemmer
Copy link

dahemmer commented Dec 6, 2018

I am a little bit confused about this feature; it also can be served by explorer like 3rd party service.

The total balance could indeed be calculated by third parties since we know all variables. The calculations will be pure, as they will always result in the same output based on those variables.

In its current state, third parties would need to do manual updates when inflation through PF occurs. A developer must know the information below before he can manually add the inflation:

  1. Inflation ratio
  2. Block height of the inflation start
  3. Block height of the inflation end (or duration in blocks)
  4. Current block height

For each new inflation, a developer would have to manually add it to the other inflation calculations, unless that information becomes available through some endpoint. The block inflation, for example, is currently available through the GET https://mainnet.blockchainos.org endpoint:

{
  ...
  "policy": {
    ...
    "initial-balance": "5000000000000000",
    "inflation-ratio": "0.00000010000000000",
    "block-height-end-of-inflation": 36000000
  },
  "block": {
    ...
    "height": 152964
  }
}

Information like this allows third parties to calculate rewards in an automated way (the only thing missing in the above example is the start block height of inflation). If an endpoint or json object would be added to get all inflation variables (for block inflation, PF inflation, ...), third parties could automatically calculate the inflation at any given block height.

The question is, would it be worth the hassle to actually build and provide such endpoints / json objects to calculate the total supply if the API itself can actually do that? It might be worth it if you ever need to be able to provide information about all past, current and present inflations.

It basically comes down to where you want to put the responsibility of calculating the supply:

  1. Do you want to make it easy for third parties?
    Calculate and provide the total supply through the API.
  2. Do you want third parties to be able to calculate the supply in an automated way?
    Provide the inflation information through the API.
  3. Do you want third parties to be able to calculate the supply in a manual way?
    Provide the inflation information through public channels such as the official websites.

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

No branches or pull requests

2 participants