In my application the private keys are created and stored on a HSM. When a new private key is created on the HSM, it returns the corresponding public key. With this public key I create a bitcoin address. Since these externally generated addresses are not part of a wallet, I'm unable to get the UTXOs of this address. Now my big questions is: How can I get the UTXOs of this address without importing it into a wallet?
Bitcoin Core has a
scantxoutset command. You give it output script descriptors (which specify
scriptPubKeys) and it will scan the UTXO set and return the UTXOs that have
scriptPubKeys that match the given descriptors.