Bitcoin Forum
December 12, 2017, 01:03:18 AM *
News: Latest stable version of Bitcoin Core: 0.15.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Is the blockchain available somewhere as one giant JSON object?  (Read 1492 times)
iain
Jr. Member
*
Offline Offline

Activity: 33



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.

Bitcoin - changing the world one transaction at a time.
1513040598
Hero Member
*
Offline Offline

Posts: 1513040598

View Profile Personal Message (Offline)

Ignore
1513040598
Reply with quote  #2

1513040598
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1513040598
Hero Member
*
Offline Offline

Posts: 1513040598

View Profile Personal Message (Offline)

Ignore
1513040598
Reply with quote  #2

1513040598
Report to moderator
1513040598
Hero Member
*
Offline Offline

Posts: 1513040598

View Profile Personal Message (Offline)

Ignore
1513040598
Reply with quote  #2

1513040598
Report to moderator
gweedo
Legendary
*
Offline Offline

Activity: 1246


Java, PHP, HTML/CSS Programmer for Hire!


View Profile WWW
August 02, 2012, 03:46:18 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

Want to earn 2500 SATOSHIS per hour? Come Chat and Chill in https://goseemybits.com/lobby
iain
Jr. Member
*
Offline Offline

Activity: 33



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

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!)

Bitcoin - changing the world one transaction at a time.
gweedo
Legendary
*
Offline Offline

Activity: 1246


Java, PHP, HTML/CSS Programmer for Hire!


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

https://github.com/jtobey/bitcoin-abe probably what you want, it is in python

Want to earn 2500 SATOSHIS per hour? Come Chat and Chill in https://goseemybits.com/lobby
Mike Hearn
Legendary
*
expert
Offline Offline

Activity: 1526


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

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:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!