1

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.

  • Not sure why it takes time. listunspent can also be used to get balance of imported address. Example: 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. – Prayank Oct 1 at 22:52
  • 1
    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. – Pieter Wuille Oct 2 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.