Altalogy / tari

The Tari protocol
https://tari.com
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

[Mining] Statistics #42

Open tarnas14 opened 2 years ago

tarnas14 commented 2 years ago

image

ac:

filters:

Monthly filter: as on the screenshot above, if we only have data for one month, don't show "vs" comparisons Yearly filter: should show all months in the selected year, with values of mined xtr, xmr for each month, if we only have data for one year, don't show "vs" comparisons All filter: should be disabled if we only have data for only one year, otherwise show year by year results, don't show "vs" indicator on coin balances (nothing to compare)

tarnas14 commented 2 years ago

@alex1307 @CjS77

I assume blockchain stores the information about mined coins by each node should we assume that this information is available from backend and we can just request it?

tarnas14 commented 2 years ago

question ~pending~ about "all" and "yearly" filters answer included in description image

CjS77 commented 2 years ago

There are 2 ways of getting "blocks mined" information:

CjS77 commented 2 years ago

@alex1307 - We should add Tauri commands that make this a simple call. The FE should not be wrangling this data. Bear in mind that the historical events call is somewhat expensive, so some discussion on the API would serve us well.

How often will you be requesting the full history? Can we assume the FE caches previous calls, so we can return new changes since a given timestamp?

tarnas14 commented 2 years ago

since I don't think historical data ever changes in blockchain, it wouldn't hurt us to save the data somewhere

is it possible to make an API that would return results with daily resolution, called for specific windows, e.g. from=2022-04-01&to=2022-04-30? FE could then save the results internally and make sure never to call for that window again (assuming the window is in the past) and then when the user changes filters on the statistics view, and we don't have data to show to them, we would call the api for missing windows?

I don't know how the UTXO is queried and how expensive this API is, so all suggestions are welcome.

tarnas14 commented 2 years ago

@CjS77 @alex1307 do you have any new info on this?

CjS77 commented 2 years ago

@alex1307 is still busy with this.

tarnas14 commented 2 years ago

ok, I'll put backend integration on hold and wait till we get any info on the interface (y)

tarnas14 commented 2 years ago

~backend contract: GET method from=<Date>&to=<Date>&interval='monthly'|'yearly'|'all'~

~interval is optional, if not provided, data will be returned with values per day~ ~if it is provided, it will combine data yearly -> values per month, all -> values per year~

UPDATE: frontend will listen on transaction events and store them in sqlite (after #46 implements it)