What is the schema of the data stores used by the reference client?

5

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.

goodguys_activate

Posted 2012-12-23T00:12:45.287

Reputation: 11 898

Answers

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.

cdecker

Posted 2012-12-23T00:12:45.287

Reputation: 7 878