<p>There are the <a href="https://github.com/gavinandresen/bitcointools" rel="nofollow">bitcoin-tools by Gavin Andresen</a> but they will only work up to version 0.7 of Bitcoin-QT. If your goal is to simply check whether the blocks are version 1 or 2 I suggest you do something like this:</p>

<pre><code>MAX_HEIGHT=`bitcoind getinfo | grep blocks | grep -oE '[0-9]+'`
MIN_HEIGHT=210000
for HEIGHT in `seq $MAX_HEIGHT -1 $MIN_HEIGHT`; do
  HASH=`bitcoind getblockhash $HEIGHT`
  VERSION=`bitcoind getblock $HASH | grep version | grep -oE '[0-9]+'`
  echo $HEIGHT,$HASH,$VERSION
done &gt;&gt; block-versions.csv
</code></pre>

<p>This will get you a Comma-Separated file with the block's height,its hash and version.</p>

CC BY-SA 3.0
2013-03-09T18:49:49.600Z
2013-03-09T18:49:49.600Z
cdecker
<p>I'm interested in seeing the schema (layout and indexes) that is used in the reference client.  Namely wallet.dat, the bk** files and also the in-memory uncommitted tx.</p>

<p>Does this exist anywhere for the 7.x client or the newer BerkleyDB format?</p>

<p>I'd like to see what, if any changes are being made to accommodate <a href="https://en.bitcoin.it/wiki/BIP_0034" rel="nofollow">BIP 0034</a>.</p>

<wallet><bitcoin-core><database><peers>
What is the schema of the data stores used by the reference client?
makerofthings7
# What is the schema of the data stores used by the reference client?

(Asked by: username_0 on 2012-12-23)

I'm interested in seeing the schema (layout and indexes) that is used in the reference client. Namely wallet.dat, the bk\*\* files and also the in-memory uncommitted tx.

Does this exist anywhere for the 7.x client or the newer BerkleyDB format?

I'd like to see what, if any changes are being made to accommodate [BIP 0034](https://en.bitcoin.it/wiki/BIP_0034).

**Tags:** wallet, bitcoin-core, database, peers


---

## 1 answers

### Answer by username_1 on 2013-03-09. Score: 1

There are the bitcoin-tools by Gavin Andresen but they will only work up to version 0.7 of Bitcoin-QT. If your goal is to simply check whether the blocks are version 1 or 2 I suggest you do something like this:
MAX_HEIGHT=`bitcoind getinfo | grep blocks | grep -oE '[0-9]+'`
MIN_HEIGHT=210000
for HEIGHT in `seq $MAX_HEIGHT -1 $MIN_HEIGHT`; do
  HASH=`bitcoind getblockhash $HEIGHT`
  VERSION=`bitcoind getblock $HASH | grep version | grep -oE '[0-9]+'`
  echo $HEIGHT,$HASH,$VERSION
done >> block-versions.csv

This will get you a Comma-Separated file with the block's height,its hash and version.


---

