Bitcoin Forum
May 14, 2024, 08:42:47 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: some python tools + offline blockexplorer  (Read 1828 times)
JeromeS (OP)
Newbie
*
Offline Offline

Activity: 55
Merit: 0


View Profile
October 14, 2012, 05:22:35 AM
Last edit: October 14, 2012, 05:39:48 AM by JeromeS
 #1

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

Wink
1715676167
Hero Member
*
Offline Offline

Posts: 1715676167

View Profile Personal Message (Offline)

Ignore
1715676167
Reply with quote  #2

1715676167
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
JeromeS (OP)
Newbie
*
Offline Offline

Activity: 55
Merit: 0


View Profile
October 16, 2012, 12:36:42 AM
 #2

If anyone is interested, now there's this 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...
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!