Title: some python tools + offline blockexplorer Post by: JeromeS on October 14, 2012, 05:22:35 AM So... I started educating myself about Script and how raw blocks and transactions are stored recently, and I wrote a few python functions that I thought could be useful to me later (mostly reinventing the wheel to learn about wheels...)
Anyway, I ended up making this (http://www.bitbin.it/AJUiYzbX) and I thought it could be useful to others, so I'm posting it here. It contains a dict of Script opcodes, a jsonrpcserver class, a pure python function similar to bitcoind's decoderawtransaction, and a few other things. The last part is an HTTP server that uses these functions to mimic blockexplorer. blockexplorer.com/rawtx/ --> localhost:8334/rawtx/ blockexplorer.com/rawblock/ --> localhost:8334/rawblock/ blockexplorer.com/q/getblockcount --> localhost:8334/getblockcount blockexplorer.com/q/getblockhash/ --> localhost:8334/getblockhash/ I tested bxgetblock against blocks 1->100000 and blocks 199000-> 203198 on blockexplorer to weed out any bugs, so it's a safe assumption that they have the same outputs. (Don't forget to change the rpc password in line 311 to the one in your bitcoin.conf file before running.) ;) Title: Re: some python tools + offline blockexplorer Post by: JeromeS on October 16, 2012, 12:36:42 AM If anyone is interested, now there's this (http://www.bitbin.it/wkrLIugi) too. Python script to read blocks from blk0001.dat, etc...
I've already seen a few people here say they made something like this, but noone posted the code, so... |