Blockscout: Add the option for Transactions per day graph on the homepage

Created on 26 Sep 2018  Â·  27Comments  Â·  Source: blockscout/blockscout

Not all networks will have a coin that has a USD value or may just be a testnet or private network. In these cases the homepage graph does not make sense. Instead of the USD chart we should provide a graph showing transactions per minute. All networks will be able to show this. A configurable option in block_scout_web would be convenient as well :+1:

In this same issue, we should also remove the requirement to define a coin in apps/explorer/config/config.exs

design good first issue high developer

Most helpful comment

@Lokraan welcome back. I've attached a GitCoin bounty for the issue.
I'm very much looking forward to getting it done 👋

All 27 comments

@acravenho we have two questions:

  • Do you have a suggestion on the scale? Should we plot data minute by minute? For how many minutes?
  • At present, below the graph, we have the current price and market cap for that coin. What do you suggest us to do with them?

Also, we've noticed Etherescan features a 14-day transaction history graph, which seems to be interesting too (especially for networks with a smaller volume of transactions).

@gfreh

  1. I think we should plot the graph on a daily scale similar to what Etherscan offers. I feel this graph should update every 10 minutes similar to what the USD chart does now.
  1. We can provide 2 metrics where the MarketCap and Price are now such as Transactions Per Day and Transactions Per Second.

@acravenho so, just to confirm:

  1. For each day in the horizontal axis, we'll plot the tx/s for that day, which is the count of transactions divided by the count of seconds (= 86,400 seconds, except for the current day).

  2. Should we use Transactions Per Day and Transactions Per Second for the current day? Or should we use some average?

+1 on this feature.

+1 on this feature , anyone working on this at the moment @acravenho

@zachdaniel @gfreh @vaibhavchellani @acravenho would it be OK if I worked on this issue?

@Lokraan This is a very sought after feature. That would be great to have you work on it.

@vbaranov Any issues with this?

I have no concerns. We have no allocated resources for this task. Therefore, @Lokraan you're welcome to build it.

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


__This issue now has a funding of 1.457 ETH (199.98 USD @ $137.25/ETH) attached to it as part of the poanetwork fund.__

@Lokraan welcome back. I've attached a GitCoin bounty for the issue.
I'm very much looking forward to getting it done 👋

@igorbarinov this issue is still actual?

@gutsal-arsen yes it is

Hi. I am doing the initial leg work of getting my dev env setup for this and formulating a plan for what changes I will make.

I'm going to submit that plan sometime tomorrow through gitcoin and then start implementing.

@SlightlyCyborg good luck. @igorbarinov let @SlightlyCyborg do it, I won't participate. Just FYI

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


__Work has been started__.

These users each claimed they can complete the work by 2 weeks ago.
Please review their action plans below:

1) kuberlog has been approved to start work.

I have done the initial research work on how to implement this feature. What follows is my plan of action

Explorer
- add lib/chain/transaction_history.ex and lib/chain/transaction_history_cataloger.ex in explorer app
- add Explorer.Chain.Transaction.History.Cataloger to configurable_children in lib/application.ex
- enable Explorer.Transaction.History.Cataloger in config.exs
- add ecto migration for transaction history

Blockscout-Web
- add route /transaction_history_chart in lib/block_scout_web/router.ex
- add TransactionHistoryController in new file lib/block_scout_web/controllers/transaction_history_controller.ex based on market_history_controller.ex
- create transaction_history_chart.js in assets/js/lib/
- import transaction_history_chart.js in assets/js/app.js
- alter templates/chain/show.html.eex to switch between marketHistoryChart and transactionHistoryChart based on config
- alter controllers/chain_controller.ex to render chart_data_path using transaction_history_chart_path instead of market_history_chart_path based on config
- in config.exs, make chart_type that fetches env: CHART_TYPE. Default to market_hist

Learn more on the Gitcoin Issue Details page.

@igorbarinov sorry it took me so long to submit a plan. Anyway, if you approve the work, I will go ahead and get started.

My proposal includes caching the number of transactions in a new transaction_history table every 24 hours so months worth of blocks will not have to be queried and joined with transactions every time someone views the admin page.

Sounds good. I've approved you.

I think the cached transaction table should be updated more frequent, e.g. every significant point on axis x
what do you think @vbaranov

Yes, I'd divide txs chart cache update into 2 types of updates:

  • update every 24h
  • and, if there are no performance concerns here, hourly update if delta from the previously cached value exceeds the definite value, let's say 20%. It would be great also if this limit can be made configurable through an environment variable.

Alright thanks @igorbarinov.

@vbaranov, the current market price graph caches every 60 minutes, so this should be fine. I can definitely make it configurable.

@slightlycyborg Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • [x] reminder (3 days)
  • [ ] escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

Yep. I am still working on it.

@slightlycyborg Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • [x] reminder (3 days)
  • [ ] escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

I'll submit a PR either tonight or tomorrow morning (EDIT: Probably a bit later. Sorry).

Ok. So I have the Explorer portion of this implemented and I am halfway through the Blockscout web portion. I just have 1 question: time-scale. Right now my code has time granularity at 1day. Are we wanting a 1 day granularity like in Etherscan or a 1 minute granularity like mentioned in OP? A 1 minute granularity would create ~500k db rows per year for the statistic, but I could also delete the old statistics as they expire out of the chart time domain. Also, a 1 hour granularity may be of interest because it is the same time interval as the history statistic updater genserver process.

I'm linking to my fork if anyone wants to do a pre-PR review:

I don’t think we need per minute update. The suggestion was to update once per day and increase update frequency if some big change of the transactions number.

update every 24h
and, if there are no performance concerns here, hourly update if delta from the previously cached value exceeds the definite value, let's say 20%. It would be great also if this limit can be made configurable through an environment variable.

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


__Work for 1.457 ETH (311.56 USD @ $213.83/ETH) has been submitted by__:

  1. @slightlycyborg

@igorbarinov please take a look at the submitted work:

  • PR by @SlightlyCyborg

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


__The funding of 1.457 ETH (248.19 USD @ $170.34/ETH) attached to this issue has been approved & issued to @SlightlyCyborg.__

Was this page helpful?
0 / 5 - 0 ratings

Related issues

igorffs picture igorffs  Â·  7Comments

banteg picture banteg  Â·  6Comments

pedrouid picture pedrouid  Â·  4Comments

dwalintukan picture dwalintukan  Â·  4Comments

gfreh picture gfreh  Â·  4Comments