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
  • 143
  • 5

1 Answers1

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
  • 1,479
  • 10
  • 25