For one of our decentralized mobile wallet, We need to fetch balance of imported BTC address quickly.
After lot of research on google then I found Bitcoin deamon rpc command "scantxoutset", which give unspent outputs of imported address.
The only problem with this command is that it takes more than a minute to return the response, which is too slow. User will not wait for 1 minute.
Anyone, could you please suggest me, is there any alternative to fetch the balance of imported BTC address quickly from the BTC node. ( not from any third party api)
Thanks.
listunspent 1 9999999 "[\"tb1qyf69xlfvmm6s7a9rtjap2vdnfdmalp6zqutg73\"]"
Also if its slow because of lot of addresses or something else maybe you can manage the UX in a way that user can do something else while this is being done in the background.listunspent
is fast because it queries your own wallet, but it only works for addresses that are yours or otherwise imported (needing a very slow rescan first to find transactions that affect the wallet).scantxoutset
queries the blockchain database, works for any address, but has to read through the database, so it's faster than rescanning.