chain-desktop-wallet icon indicating copy to clipboard operation
chain-desktop-wallet copied to clipboard

Problem: Potential lengthy transactions

Open crypto-matto opened this issue 3 years ago • 0 comments

Problem

Recently, a user takes around 20 seconds to finish whatever transactions on desktop wallet, which is pretty slow and foreseeably getting longer in the future as our chain grows.

Case Study

For every transactions on desktop wallet, when a user confirm a transaction, it goes through the below 3 steps:

  1. Broadcast a transaction & receive the response
  2. Fetch latest data from node with API queries
  3. Update data in wallet DB

After that, we show the Success! message

螢幕截圖 2021-04-22 下午4 49 21

While it may only takes a few seconds to finish a transaction broadcast, there are some bottlenecks that we found:

  • Some API queries have a long query time, e.g. https://mainnet.crypto.org:1317/cosmos/distribution/v1beta1/delegators/{delegator_address}/validators
  • Fetching all data every time, regardless of whether a specific transaction is necessary to update all data or not

Assuming more and more features to be developed on our chain, the above bottlenecks will get worse.

Propose Solution

  • Frontend side Instead of showing Success! after all the steps are done, we show it just after transaction is broadcasted successfully. After that, we have our loading spin on data that we are still fetching, until they are all updated
  • Backend side Instead of fetching all data every time, we study case by case on all different type of transactions & minimise the data fetching accordingly
  • Node / API endpoint side Optimise query loading speed.

crypto-matto avatar Apr 22 '21 08:04 crypto-matto