How to monitor Bitcoin address for new transactions? I have some generated Bitcoin addresses which I want to monitor for newly received transactions, I have a full node but I don't want to import those addresses to the node's wallet. I don't want to use any external service API like block.io or blockchain.com, I am working on my own code.

I want to keep this list of addresses in an external DB (MySql or Mongo) and I want to keep track of them until they receive let's say n confirmations.

I know I can user -blocknotify to receive information of newly mined blocks and with this new block I can scrape the transactions and look for the addresses I monitor. But how can I guarantee I will have all the UTXOs?

If the address is newly generated with the last block I can create my local DB with addresses information. But what should I do if I import (on my database, not Bitcoin Core wallet) an old address which had already been used, how can I check for UTXOs?

Also, how can I check if any of these monitored addresses have unconfirmed transactions?
It's possible to do this externally, but it's tricky to get right and a cause of loss of funds if you do. 


You need to correctly identify transactions you can spend. This is relatively trivial with P2PKH addresses, but a little more involved if using more exotic script types. You need to understand rules like transaction maturity before considering a UTXO to be spendable. 
You need to correctly handle reorganizations if a transaction changes its confirmation state or is invalidated by a change in its confirmation state and an alternative is included. 
You need to manually walk every single block to find old transactions, or use the UTXO scanning feature to find ones which may be unspent. This is very time consuming and requires full retention of all blocks since genesis (or at the very least, the birthdate of the wallet). Repeating this if you want to monitor a new address with potentially old entries. 
You need confidence that your code is correctly accounting, which is only something you can ensure. 


It's easier to use the built in wallet which handles all of this correctly, really.