Bitcoin Forum
July 13, 2024, 07:01:33 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Is the blockchain available somewhere as one giant JSON object?  (Read 1594 times)
iain (OP)
Jr. Member
*
Offline Offline

Activity: 33
Merit: 7



View Profile WWW
August 02, 2012, 03:30:59 AM
 #1

Hello folks... is the blockchain available somewhere as one giant JSON object? I'd like to try my hand at some analysis of its structure (bitcoin days destroyed, lengths of txout/in/out/in chains, that sort of thing), and the Satoshi client's Berkeley DB format is utterly beyond me.
iain (OP)
Jr. Member
*
Offline Offline

Activity: 33
Merit: 7



View Profile WWW
August 02, 2012, 04:22:34 AM
 #2

what is better than learning about the blockchain how to convert a Bdb into a JSON Array Smiley (cause that makes better sense than a JSON object) btw a JSON array representation of the blockchain would be a disaster, and would be super long, remember the blockchain is now ~2.8gb so a JSON array of objects of the blockchain WOW that would not run good in php. Good luck with that

I'd really be happy with any "reasonably plain-text-ish" representation - JSON (object or array) is just the obvious leading candidate. This is of course, exactly as you say, a lot less space- and time-efficient to handle than a binary format (Berkeley DB in the Satoshi client, perhaps other binary formats in other clients). But it, uh, postpones my day of reckoning (of having to master Bdb)  Cheesy

(Just to clarify: I wouldn't be trying to respond interactively and quickly to web requests for a chart or whatever - I wouldn't be competing with the marvellous charts at https://blockchain.info/charts. I'd just like to analyse the blockchain [in various ways that go a bit beyond those charts] offline, at leisure, for my own interest. So, for now at least, efficiency is not so important for me!)
gweedo
Legendary
*
Offline Offline

Activity: 1498
Merit: 1000


View Profile
August 02, 2012, 04:29:09 AM
 #3

https://github.com/jtobey/bitcoin-abe probably what you want, it is in python
Mike Hearn
Legendary
*
expert
Offline Offline

Activity: 1526
Merit: 1129


View Profile
August 03, 2012, 05:24:05 PM
 #4

You don't have to parse BDB files to read the block chain. In fact the block chain isn't stored in a Berkeley DB, only an index is.

The blk0001.dat files are concatenated block messages with some goop between them. You could read them directly.

Alternatively, use something like bitcoinj and connect to a local peer. You'll get Java objects back representing the parsed block chain.

The block chain is an inherently binary data structure. You need to be comfortable working with binary or else you won't get very far.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!