Speeding up "getbalance <account>" calls



Summary:

In an email sent on June 23, 2011, the creator of Instawallet reached out to a mailing list asking for help on how to improve the speed of "getbalance" due to its bottleneck in processing time. One suggestion provided was to scan the wallet every time a block comes in or something else changes in the block chain, and then accumulate balances for all accounts using a hash_map. This method reduces the time the API takes to return the balance for an account to a predictable, very short time. Additionally, it is less bug-prone than incremental caching and does not require determining which accounts are influenced by a new block. Lastly, block chain reorgs are no problem with this suggested method.


Updated on: 2023-05-26T18:29:16.721145+00:00