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 Answer 1

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.

3
  • how do I get my nodejs script to send a json-rpc method?
    – Satonamo
    Commented May 31, 2017 at 23:34
  • use any request package with which you can post data to any url Commented Jun 30, 2017 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
    Commented Jul 1, 2017 at 12:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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