<p>Found the logic for parsing the block index <a href="http://2.bp.blogspot.com/-DaJcdsyqQSs/UsiTXNHP-0I/AAAAAAAATC0/kiFRowh-J18/s1600/blockchain.png" rel="nofollow noreferrer">here</a></p>

CC BY-SA 4.0
2021-05-11T09:17:56.233Z
This logic for parsing is up to date already. If you need to know how to parse RAW data, you can try my parser https://github.com/ragestack/blockchain-parser/
Denis Leonov
CC BY-SA 4.0
2021-05-12T19:10:42.177Z
@DenisLeonov, your code talks about parsing the bat files however my question is on Block index
Ankit
CC BY-SA 4.0
2021-05-10T20:21:12.590Z
2021-05-10T20:21:12.590Z
Ankit
<p>I am trying to read the value against block hash in level DB of Bitcoin node database - Block/index. For Genesis block, I get 88 bytes which I want to parse. I tried to follow instructions in <a href="https://bitcoin.stackexchange.com/questions/28168/what-are-the-keys-used-in-the-blockchain-leveldb-ie-what-are-the-keyvalue-pair">https://bitcoin.stackexchange.com/questions/67515/format-of-a-block-keys-contents-in-bitcoinds-leveldb</a> but wasnt able to do that successfully as the first 4 bytes should be version but I get an invalid version.</p>
<p>I tried obfuscating the whole value as well but still the first 4 bytes does not give me a valid version. I must be doing something wrong but not able to identify that.</p>
<p>Value I get (in hex string)</p>
<pre><code>8be750000b0100080100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a29ab5f49ffff001d1dac2b7c
</code></pre>
<p>Additional resource I tried - <a href="https://bitcoin.stackexchange.com/questions/51387/how-does-bitcoin-read-from-write-to-leveldb/52167#52167">Link</a></p>
<p>Note: I am using c# to read and parse the data.</p>

<bitcoin-core><block><leveldb>
Bitcoin - Level DB - Block Index - Parsing value for block hash
Ankit
# Bitcoin - Level DB - Block Index - Parsing value for block hash

(Asked by: username_0 on 2021-05-10)

I am trying to read the value against block hash in level DB of Bitcoin node database - Block/index. For Genesis block, I get 88 bytes which I want to parse. I tried to follow instructions in [https://bitcoin.stackexchange.com/questions/67515/format-of-a-block-keys-contents-in-bitcoinds-leveldb](https://bitcoin.stackexchange.com/questions/28168/what-are-the-keys-used-in-the-blockchain-leveldb-ie-what-are-the-keyvalue-pair) but wasnt able to do that successfully as the first 4 bytes should be version but I get an invalid version.

I tried obfuscating the whole value as well but still the first 4 bytes does not give me a valid version. I must be doing something wrong but not able to identify that.

Value I get (in hex string)

```
8be750000b0100080100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a29ab5f49ffff001d1dac2b7c

```

Additional resource I tried - [Link](https://bitcoin.stackexchange.com/questions/51387/how-does-bitcoin-read-from-write-to-leveldb/52167#52167)

Note: I am using c# to read and parse the data.

**Tags:** bitcoin-core, block, leveldb


---

## 1 answers

### Answer by username_0 on 2021-05-10. Score: 0 | Accepted answer

Found the logic for parsing the block index [here](http://2.bp.blogspot.com/-DaJcdsyqQSs/UsiTXNHP-0I/AAAAAAAATC0/kiFRowh-J18/s1600/blockchain.png)

> **Comments:**
> **username_1**: This logic for parsing is up to date already. If you need to know how to parse RAW data, you can try my parser https://github.com/ragestack/blockchain-parser/  
> **username_0**: @username_1, your code talks about parsing the bat files however my question is on Block index  

---

