<p>Consider using <a href="https://github.com/bitcoinjs/bitcoinjs-lib" rel="nofollow noreferrer">bcoin.js</a> which is in pure JS. It fires events when a transaction takes place. Quite simply you can do:</p>

<pre><code>node.on("tx", (tx) =&gt; {
   console.log(tx.outputs, tx.inputs)
})
</code></pre>

<p>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.</p>

CC BY-SA 4.0
2018-07-18T20:31:28.363Z
2018-07-18T20:31:28.363Z
dionyziz
<p>I am using this bitcore npm package.
<a href="https://bitcore.io/api/lib" rel="noreferrer">https://bitcore.io/api/lib</a></p>

<p>And i want to monitor all the transactions over the blockchain, and read the input address, output address and amount associated with that transaction.</p>

<p>But i am unable to find the javascript method to invoke to accomplish this.
Even i am not able to find a example for this.</p>

<p>I am looking for as short as something like </p>

<pre><code>var someLib = require('some-bitcore-lib')

someLib.on('block-recieved', function(){
   // print everything
   console.log(arguments);
   // do something else;
})
</code></pre>

<p>Any help?
Where can i find that <code>some-bitcore-lib</code> or how can i create that in nodejs?</p>

CC BY-SA 3.0
2017-08-04T18:16:27.747Z
I'm voting to close this question as off-topic because belongs on stackoverflow
deepbrook
CC BY-SA 3.0
2017-08-04T21:23:07.163Z
Have you tried reading https://bitcore.io/guides/satoshi-fire-alarm
Nick ODell
CC BY-SA 3.0
2018-02-15T07:36:05.180Z
@codeofnode: have found any solution for the same?
Codebrekers
<node.js>
How to watch for the transactions over blockchain via nodejs?
codeofnode
# How to watch for the transactions over blockchain via nodejs?

(Asked by: username_0 on 2017-08-04)

I am using this bitcore npm package.
<https://bitcore.io/api/lib>

And i want to monitor all the transactions over the blockchain, and read the input address, output address and amount associated with that transaction.

But i am unable to find the javascript method to invoke to accomplish this.
Even i am not able to find a example for this.

I am looking for as short as something like

```
var someLib = require('some-bitcore-lib')

someLib.on('block-recieved', function(){
   // print everything
   console.log(arguments);
   // do something else;
})

```

Any help?
Where can i find that `some-bitcore-lib` or how can i create that in nodejs?

**Tags:** node.js

> **Comments:**
> **username_1**: I'm voting to close this question as off-topic because belongs on stackoverflow  
> **username_2**: Have you tried reading https://bitcore.io/guides/satoshi-fire-alarm  
> **username_3**: @username_0: have found any solution for the same?  

---

## 1 answers

### Answer by username_4 on 2018-07-18. Score: 1

Consider using [bcoin.js](https://github.com/bitcoinjs/bitcoinjs-lib) which is in pure JS. It fires events when a transaction takes place. Quite simply you can do:

```
node.on("tx", (tx) => {
   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.


---

