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?

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.

  • 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 Oct 15 '18 at 19:23
  • 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 Oct 15 '18 at 19:38
  • 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 Oct 15 '18 at 20:02
  • 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 Oct 15 '18 at 21:17

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.