chain-desktop-wallet
chain-desktop-wallet copied to clipboard
Problem: Potential lengthy transactions
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:
- Broadcast a transaction & receive the response
- Fetch latest data from node with API queries
- Update data in wallet DB
After that, we show the Success!
message

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.