Bitcoin Forum
December 08, 2016, 08:10:44 AM *
News: To be able to use the next phase of the beta forum software, please ensure that your email address is correct/functional.
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Blockchain in SQL format  (Read 3963 times)
Andrew Vorobyov
Hero Member
*****
Offline Offline

Activity: 565



View Profile
September 18, 2011, 05:35:39 PM
 #1

I would like to export blockchain transactions in SQL/CSV format. What is the best way to do it? Except scraping http://blockexplorer.com to death

1481184644
Hero Member
*
Offline Offline

Posts: 1481184644

View Profile Personal Message (Offline)

Ignore
1481184644
Reply with quote  #2

1481184644
Report to moderator
1481184644
Hero Member
*
Offline Offline

Posts: 1481184644

View Profile Personal Message (Offline)

Ignore
1481184644
Reply with quote  #2

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

Activity: 1428


Core Armory Developer


View Profile WWW
September 18, 2011, 05:52:59 PM
 #2

Do you want to maintain a running, up-to-date version of the blockchain in SQL?  Or are you looking for a snapshot of the blockchain at a point in time?

The reason I ask is because there's plenty of folks who could use their blockchain management code to give you an SQL snapshot, but if you want a persistent, updating SQL database, you're going to have to do something more creative.  Maybe modify and recompile the client to maintain a parallel SQL DB, to be updated when new blockdata is received.  Or, as you said, scrape a website/service that offers up-to-the-minute blockchain data.  I guess it depends on your application/requirements.

Founder and CEO of Armory Technologies, Inc.
Armory Bitcoin Wallet: Bringing cold storage to the average user!
Only use Armory software signed by the Armory Offline Signing Key (0x98832223)

Please donate to the Armory project by clicking here!    (or donate directly via 1QBDLYTDFHHZAABYSKGKPWKLSXZWCCJQBX -- yes, it's a real address!)
Andrew Vorobyov
Hero Member
*****
Offline Offline

Activity: 565



View Profile
September 18, 2011, 06:42:41 PM
 #3

I need snapshot and then will continue scraping.

etotheipi
Legendary
*
expert
Offline Offline

Activity: 1428


Core Armory Developer


View Profile WWW
September 18, 2011, 06:54:31 PM
 #4

So I haven't worked much with SQL other than the fact that I know SQLite is pretty convenient in python, and I can read the blockchain from python -- so I should be able to figure out how to put the two together.   If you write out explicitly what you want the database/tables to look like, and toss me a couple BTC (upon delivery) I should be able to produce a .sqlite file for you.

For instance, I assume you want two tables, one of block headers, one of transactions.  The headers table would have all the core information in it (hashes, difficulty, nonce, etc).  The transaction table would have the header hash, but be a little more complicated since each transaction actually has a variable list of inputs and outputs.   I suppose you could go a step further and add a table of TxIn objects and a table of TxOut objects, each of which contain the parent Tx hash.   

If it's not too intense, I can probably figure it out.  I already have most of the tools made to do it, I just gotta learn the python-sqlite interface (is simply including hashes of the parent objects enough to consider the DB "relational?")

-Eto 

Founder and CEO of Armory Technologies, Inc.
Armory Bitcoin Wallet: Bringing cold storage to the average user!
Only use Armory software signed by the Armory Offline Signing Key (0x98832223)

Please donate to the Armory project by clicking here!    (or donate directly via 1QBDLYTDFHHZAABYSKGKPWKLSXZWCCJQBX -- yes, it's a real address!)
Andrew Vorobyov
Hero Member
*****
Offline Offline

Activity: 565



View Profile
September 18, 2011, 07:04:22 PM
 #5

Something like this. http://awesomescreenshot.com/01aknhyc7. I don't care about normalization

Give me you paypal. I'm out of BTCs

Andrew Vorobyov
Hero Member
*****
Offline Offline

Activity: 565



View Profile
September 18, 2011, 07:17:34 PM
 #6

Wait a sec I will create DB structure dump for you.

Andrew Vorobyov
Hero Member
*****
Offline Offline

Activity: 565



View Profile
September 18, 2011, 07:48:27 PM
 #7

Sent you private message

genjix
Legendary
*
expert
Offline Offline

Activity: 1232


View Profile
September 18, 2011, 08:21:09 PM
 #8

Bitcoin network database dump in postgresql (download link inside)

https://bitcointalk.org/index.php?topic=38246
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!