Bitcoin Forum
May 06, 2024, 02:17:40 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Blockchain in SQL format  (Read 4737 times)
Andrew Vorobyov (OP)
Hero Member
*****
Offline Offline

Activity: 558
Merit: 500



View Profile
September 18, 2011, 05:35:39 PM
Last edit: September 18, 2011, 05:45:49 PM by Andrew Vorobyov
 #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
1715005060
Hero Member
*
Offline Offline

Posts: 1715005060

View Profile Personal Message (Offline)

Ignore
1715005060
Reply with quote  #2

1715005060
Report to moderator
"In a nutshell, the network works like a distributed timestamp server, stamping the first transaction to spend a coin. It takes advantage of the nature of information being easy to spread but hard to stifle." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
etotheipi
Legendary
*
expert
Offline Offline

Activity: 1428
Merit: 1093


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 (OP)
Hero Member
*****
Offline Offline

Activity: 558
Merit: 500



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
Merit: 1093


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 (OP)
Hero Member
*****
Offline Offline

Activity: 558
Merit: 500



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 (OP)
Hero Member
*****
Offline Offline

Activity: 558
Merit: 500



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

Wait a sec I will create DB structure dump for you.
Andrew Vorobyov (OP)
Hero Member
*****
Offline Offline

Activity: 558
Merit: 500



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

Sent you private message
genjix
Legendary
*
expert
Offline Offline

Activity: 1232
Merit: 1072


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:  

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