How to retrieve transactions in realtime from bitcoind .dat files

0

I want to get all the data from blocks as they get updated on my local node. Abe offers very poor performance, and fast-dat-parser creates other .dat files and doesn't have enough documentation for me to understand how to get data like block size, age, hash difficulty, Transactions and transaction fees. Is there an alternative tool, or at least a detailed documentation that would allow me to write a parser for content of .dat files?

Dario

Posted 2018-10-15T15:16:24.420

Reputation: 1

Why not use the Bitcoin Core RPC? It will handle the retrieval and decoding for youRaghav Sood 2018-10-15T16:53:18.770

Check this one https://github.com/normanvolt/blockchain-parser

D L 2018-10-15T21:32:45.020

Answers

0

Trying to read and parse the .dat files while bitcoind is running is likely a good way to have tons of errors due to partially written data. Instead of trying to read the .dat files, you can use bitcoind itself to notify you of new blocks and to use the RPC interface to decode and fetch the block information for you. You can start bitcoind with -blocknotify=<cmd> where <cmd> is a command that bitcoind will run every time a new block is accepted. You can read bitcoind -help for more information about what -blocknotify does. The command that is run can then be a script which calls the RPC interface and fetches the block data that you need by using the getblock RPC command.

Andrew Chow

Posted 2018-10-15T15:16:24.420

Reputation: 40 910

Thank you for the input. Is the RPC interface fast enough to get information about the trades as fast as possible? My idea was to access trades in a .dat file as soon as the new one is created, so I'm sure bitcoind has stopped writing in it.Dario 2018-10-15T19:23:42.077

It depends on how fast is "fast enough". The RPC interface is fairly fast. It will certainly be faster than only reading blocks when a new .dat is created as multiple blocks (hundreds, if not thousands) go into each .dat. To humans, it is unnoticeable. It takes a few milliseconds.Andrew Chow 2018-10-15T19:38:44.007

Ok, so RPC is faster than reading an old .dat file, and better than corrupting the one that's being written into at the moment. Thank you very much. Does any sort of a "listen" node exist, that serves to stream transaction data, instead of functioning as a full node and a wallet?Dario 2018-10-15T20:02:04.000

bitcoind has a ZMQ interface which streams blocks and transactions to a listener using the ZeroMQ messaging protocol. You can also just connect to the node using the Bitcoin P2P protocol and get blocks and transactions once they have been verified.

Andrew Chow 2018-10-15T21:17:39.333