4

I need to capture and store the raw transactions coming through my local full-node bitcoin instance. I read here that it is possible, but there is no mention of the particular RPC calls. I also see the raw transaction JSON-RPC API, but it is still not clear how to use this to periodically query the raw transactions.

It seems like bitcoin-sniffer (written in python) is what I am trying to do and need, and since I am using Java, it seems bitcoinj can actually listen for incoming transactions, but I don't see example codes on how to do this.

My question is, how do I use the HTTP POST JSON RPC API back to my local bitcoin instance to query for transactions? Is there a tutorial?

I'd imagine I would be running in a continuous thread and periodically query bitcoind (the daemon) for the latest batch of transactions. Is this possible?

  • 2
    bitcoin transactions comes in streams, its better to use ZMQ for this. Read doc/zmq.md in the bitcoin repository. – renlord Feb 10 '17 at 22:38
  • Thanks. That seems like a viable alternative. Just to clarify, do you know if what's published from bitcoind to 0MQ is the raw transactions (the data and all its fields) in deserialized (JSON not hex) form? – Jane Wayne Feb 10 '17 at 22:45
  • its serialized hex, you'll have to de-serialize it. There are convenient functions with bitcoin-cli to do this. – renlord Feb 10 '17 at 23:24
0

Renlord commented

bitcoin transactions comes in streams, its better to use ZMQ for this. Read doc/zmq.md in the bitcoin repository

and

[the data is not json but] serialized hex, you'll have to de-serialize it. There are convenient functions with bitcoin-cli to do this.

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.