3

Can anyone tell me where I can read about the structure of the files

 blk0001.dat 
 blk0002.dat
 blkindex.dat

I know that in these files bitcoin is saving all the information about transactions. I would like to parse the files and save the information from these files in my local database.

[Note-these files are no longer used for Bitcoin-Qt/bitcoind version 0.8 and above.]

  • 1
    Though those data files are BDB database files, the contents of blk000n.dat are simply raw concatenated bitcoin blocks: en.bitcoin.it/wiki/Data_directory So you are essentially asking what is the structure of the raw bitcoin blocks. – Stephen Gornick Oct 7 '12 at 16:26
  • Note - these files are no longer used in Bitcoin-Qt/bitcoind version 0.8 and above. – Stephen Gornick Mar 7 '13 at 8:18
2

While reading the blockchain data directly is possible, you can only do so against stale data files -- as you can't reliably read the files while the client is running.

PyWallet and BitcoinTools are two such methods to do this.

Instead, the Bitcoin.org client (v0.7 and above) provides Raw Transactions support, in which you can decode a transaction to learn of its inputs, outputs and other attributes. This, along with the rest of the API provides the ability to pull all the data from the blockchain that is needed, against a live instance:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.