<p>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 <code>-blocknotify=&lt;cmd&gt;</code> where <code>&lt;cmd&gt;</code> is a command that bitcoind will run every time a new block is accepted. You can read <code>bitcoind -help</code> for more information about what <code>-blocknotify</code> 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 <code>getblock</code> RPC command.</p>

CC BY-SA 4.0
2018-10-15T19:23:42.077Z
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
CC BY-SA 4.0
2018-10-15T19:38:44.007Z
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.
Ava Chow
CC BY-SA 4.0
2018-10-15T20:02:04.000Z
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
CC BY-SA 4.0
2018-10-15T21:17:39.333Z
bitcoind has a [ZMQ](https://github.com/bitcoin/bitcoin/blob/master/doc/zmq.md) 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.
Ava Chow
CC BY-SA 4.0
2018-10-15T17:39:44.077Z
2018-10-15T17:39:44.077Z
Ava Chow
<p>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?</p>

CC BY-SA 4.0
2018-10-15T16:53:18.770Z
Why not use the Bitcoin Core RPC? It will handle the retrieval and decoding for you
Raghav Sood
CC BY-SA 4.0
2018-10-15T21:32:45.020Z
Check this one https://github.com/normanvolt/blockchain-parser
Denis Leonov
<bitcoin-core><raw-transaction><raw-data>
How to retrieve transactions in realtime from bitcoind .dat files
Dario
# How to retrieve transactions in realtime from bitcoind .dat files

(Asked by: username_0 on 2018-10-15)

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?

**Tags:** bitcoin-core, raw-transaction, raw-data

> **Comments:**
> **username_1**: Why not use the Bitcoin Core RPC? It will handle the retrieval and decoding for you  
> **username_2**: Check this one https://github.com/normanvolt/blockchain-parser  

---

## 1 answers

### Answer by username_3 on 2018-10-15. Score: 1

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.

> **Comments:**
> **username_0**: 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.  
> **username_3**: 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.  
> **username_0**: 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?  
> **username_3**: bitcoind has a [ZMQ](https://github.com/bitcoin/bitcoin/blob/master/doc/zmq.md) 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.  

---

