Detect received transactions of thousands of Bitcoin addresses
This doesn't sound correct to me.


You're relying on a centralized service to fetch blocks.  What if their system has an error and sends you incorrect data?
What if their service is unreachable?
It doesn't seem like you have any way to handle blockchain reorganization.  You might end up crediting a payment twice, or crediting where a double spend was successful in a competing chain.


Consider looking into something like BTCpay which FOSS self-hosted bitcoin payment processor.