<p>The answer to that other question is only partly correct ie the <code>node</code> does make this data available, but not in an easy to digest manner.</p>
<p>The <code>node</code> does expose a local chain sync protocol. However this local chain sync protocol is written in Haskell and uses CBOR encoded data. It is theoretically possible to write code in another language that connects to this local chain sync protocol (I think there is Rust code somewhere to do this).</p>
<p>The local chain sync protocol <strong>only</strong> supports on-chain data. Data that is part of ledger state like epoch rewards and epoch stake distribution are not included.</p>

CC BY-SA 4.0
2022-07-20T09:35:21.073Z
Looking more into the chain-sync protocol, ogmios wraps it in a websocket API, so I think that's exactly what I am looking for, thanks!
alexk745
CC BY-SA 4.0
2022-07-19T22:57:38.237Z
2022-07-19T22:57:38.237Z
Erik de Castro Lopo
<p>I was trying to find a way to get raw block/transaction data and came across <a href="https://cardano.stackexchange.com/questions/8063/how-to-read-data-from-a-cardano-node-directly">this question</a>. The answer was that there is no way to do that currently but db-sync somehow does that. How does it do that? More specifically I was looking for some sort of documentation on how to do that myself (an API reference with the protocol specified).</p>

<cardano-node><cardano-db-sync>
How does db-sync query raw block data if cardano-node doesn't expose them?
# How does db-sync query raw block data if cardano-node doesn't expose them?

(Asked by: username_0 on 2022-07-19)

I was trying to find a way to get raw block/transaction data and came across [this question](https://cardano.stackexchange.com/questions/8063/how-to-read-data-from-a-cardano-node-directly). The answer was that there is no way to do that currently but db-sync somehow does that. How does it do that? More specifically I was looking for some sort of documentation on how to do that myself (an API reference with the protocol specified).

**Tags:** cardano-node, cardano-db-sync

---

## 1 answers

### Answer by username_1 on 2022-07-19. Score: 2 | Accepted answer

The answer to that other question is only partly correct ie the `node` does make this data available, but not in an easy to digest manner.

The `node` does expose a local chain sync protocol. However this local chain sync protocol is written in Haskell and uses CBOR encoded data. It is theoretically possible to write code in another language that connects to this local chain sync protocol (I think there is Rust code somewhere to do this).

The local chain sync protocol **only** supports on-chain data. Data that is part of ledger state like epoch rewards and epoch stake distribution are not included.

> **Comments:**
> **username_0**: Looking more into the chain-sync protocol, ogmios wraps it in a websocket API, so I think that's exactly what I am looking for, thanks!  

---

