lian/bitcoin-ruby — pull request #6 by mhanne (2011-11-29 21:30:57+00:00)
Title: Blockchain storage

Hi, I've been playing around and just want to let you know what I'm doing and ask what you think about it.

I've taken the database schema from libbitcoin and created activerecord objects that read Bitcoin::Protocol objects and store them into db. I'm not sure if this is the best way, it seems simpler if the parser objects just executed the sql queries directly, but this way the database stuff is separated.

There is a new script bin/blockchain that connects to a local node, downloads the blockchain and just stuffs it into the database, *without any validation* . I was able to sync the complete blockchain for test and mainnet (it took roughly 20 minutes and 13 hours respectively :)

Since it had trouble parsing some transactions the parser simply rescues and returns nil on any errors (mostly nil.unpack etc).

Also, i built a little blockchain browser using this database (or one created with libbitcoin), mainly to compare to blockexplorer.
One more thing it does is display a debug output of a script execution (op/stack log).

If you're interested in talking more directly you can catch me in the #bitcoin(-dev) irc as riush or jabber (marius@sourceagency.org), i'd also love to ask you some more questions ;)

Marius