scantxoutset
allows to retrieve UTXOs matching certain criteria, based on a whitelist of desired “addresses” (in a wider sense). However, as far as I see there is no way to use this command to retrieve the full UTXO set via the JSON-RPC interface.
I think that such a functionality would be useful for certain (non-mainstream) applications. For instance, block explorers, building rich lists and processing coin snapshots. I’ve seen multiple situations (and also done it myself) where applications like that either had to hack Bitcoin Core itself to add a custom-made RPC method for their task or read the full blockchain (rather than just the UTXO set) via RPC calls. Having the ability to process the full UTXO set by external tools hooking onto the RPC interface would be useful to have.
One big caveat with this is, of course, that the full UTXO set is very large and returning it from a single RPC call is probably not a good idea (if it is even possible). Thus we would need to make scantxoutset
“step-able”. For instance, a new optional argument could specify how many results the caller wants to get at most. Then the RPC would return those and remain with the operation in a “paused” state. Follow-up RPC calls would be needed to either “abort” or “continue” the paused scan. (With “continue” returning the next batch of results until the scan is done.)
What do you think about such an extension, would that be useful and fit into the general goal for scantxoutset
(which seems to be wallet support at the moment)? Is this already possible and I simply missed how to do it?