How to receive newly broadcasted transactions immediately with bitcoin-core RPC?
You can use the ZMQ interface to receive a ZMQ notification when a new transaction is received. You can have it give you the txid, the raw transaction, or both.