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?

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.

  • how do I get my nodejs script to send a json-rpc method? – Satonamo May 31 '17 at 23:34
  • use any request package with which you can post data to any url – Shabahat M. Ayubi Jun 30 '17 at 12:02
  • Ah okay, I was hoping for some sort of a websocket connection/ ethereum .filter() function sort of a thing. Thanks though! – Satonamo Jul 1 '17 at 12:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.