how to get realtime new transaction data in nodejs from bitcore

1

I want to run a private node, and use it to receive realtime unconfirmed transactions data into my nodejs script.

How do I go about this?

Satonamo

Posted 2017-05-29T13:16:29.433

Reputation: 43

Answers

1

Either you use some nodejs library which would give you a high level wrapper for the bitcoin core api getrawmempool, or make your script hit your local bitcoin instance in the json-rpc format to get the memorypool data your node has. The memory pool is basically where the transactions stay before getting confirmed in a block. So your script needs to run in regular intervals of time to keep track of the changes too.

url: http://<username>:<password>@localhost:18332/ post data:{"jsonrpc":1,"id":"curltext", "method":"getrawmempool", "payload":[]}

The username and password is checked from the bitcoin.conf file in the .bitcoin folder. Change the port number to 8332 in case you are running the mainnet daemon.

Shabahat M. Ayubi

Posted 2017-05-29T13:16:29.433

Reputation: 1 409

how do I get my nodejs script to send a json-rpc method?Satonamo 2017-05-31T23:34:12.937

use any request package with which you can post data to any urlShabahat M. Ayubi 2017-06-30T12:02:05.290

Ah okay, I was hoping for some sort of a websocket connection/ ethereum .filter() function sort of a thing. Thanks though!Satonamo 2017-07-01T12:40:23.357