mimblewimble / grin

Minimal implementation of the Mimblewimble protocol.
https://grin.mw/
Apache License 2.0
5.04k stars 990 forks source link

grin wallet api slow when the number of txs become large #2828

Closed bitcodernull closed 5 years ago

bitcodernull commented 5 years ago

when my wallet have the hundreds of thousands txs, the wallet api is becoming slower

how to optimization it?

thanks

hashmap commented 5 years ago

@bitcodernull from my experience one of the reasons is the refresh we do in the wallet, during a request we ask a node for a state of each output. This is reasonable when you don't have many outputs or you don't send too many requests to your wallet. For "pro" wallet I'd choose a different strategy - refresh the full state in background (eg every minute ask your node) and store the data on the wallet side. Then when a requests come you are ready to serve it immediately without consulting with the node. The downside of this approach is obvious, you need to implement and maintain a custom version of the wallet or extract this logic to a separate component. We did it in our payment processor.

hashmap commented 5 years ago

If it's still valid please open it in grin-wallet repo