In my application I would like to obtain the balance and UTXO set of some Bitcoin addresses. I'm primarily looking to achieve this using a full node (Bitcoin Core, RPC), but I am also open to other solutions. I run my own node.

Here are the solutions I have considered:

  1. Using scantxoutset RPC command. This works with any address, returns both UTXOs and total balance. However, it is rather slow (for testnet it is on the order of 1 minute, not sure on mainnet). Another disadvantage is that it does not show unconfirmed transactions.

  2. Using listunspent RPC command. Unfortunately this works only with addresses that are loaded in the wallet of the node, so not with any addresses.

  3. Using an external explorer site/API. This is not a good solution due to concerns about availability, trust (source of truth), and access (permissions, rate limits).

  4. Using blockbook on top of the BTC node (e.g. api/v2/utxo/<address>). This seems to be a good solution, but it requires an extra piece of software.

Eventually a notification solution for new transactions to a set of addresses would be also nice, but polling is a workable solution (e.g. every 10 secs, the set of addresses is typically small).

I would appreciate any other suggestions regarding how to achieve this with a full node, or involving some other available software.

I'm also curious how Lightning node implementations solve this, as they probably need very similar functionality (LND, C-lightning, LDK).

I include here for reference:



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.