How to watch for the transactions over blockchain via nodejs?
Consider using bcoin.js which is in pure JS. It fires events when a transaction takes place. Quite simply you can do:

node.on("tx", (tx) =&gt; {
   console.log(tx.outputs, tx.inputs)
})


Note that, in bitcoin, each transaction can have multiple outputs and inputs, so these are arrays of inputs and outputs. You can obtain the total output amount by summing across all output amounts. Additionally, in this case you wouldn't concern yourself with blocks - just transactions.