Which RPC may I use to query bitcoind for raw transactions coming through?

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?

Jane Wayne

Posted 2017-02-10T22:25:16.847

Reputation: 319

2bitcoin transactions comes in streams, its better to use ZMQ for this. Read doc/zmq.md in the bitcoin repository.renlord 2017-02-10T22:38:19.620

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 2017-02-10T22:45:04.827

its serialized hex, you'll have to de-serialize it. There are convenient functions with bitcoin-cli to do this.renlord 2017-02-10T23:24:57.613

Answers

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.

RedGrittyBrick

Posted 2017-02-10T22:25:16.847

Reputation: 4 815