Bitcoin Forum
April 22, 2018, 10:50:48 PM *
News: Latest stable version of Bitcoin Core: 0.16.0  [Torrent]. (New!)
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: some python tools + offline blockexplorer  (Read 1693 times)
JeromeS
Jr. Member
*
Offline Offline

Activity: 55
Merit: 0


View Profile
October 14, 2012, 05:22:35 AM
 #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

1MHMLCSdxzyaBEYQsQYYNPYkaBjeV1aSNZ
1524437448
Hero Member
*
Offline Offline

Posts: 1524437448

View Profile Personal Message (Offline)

Ignore
1524437448
Reply with quote  #2

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

Posts: 1524437448

View Profile Personal Message (Offline)

Ignore
1524437448
Reply with quote  #2

1524437448
Report to moderator
1524437448
Hero Member
*
Offline Offline

Posts: 1524437448

View Profile Personal Message (Offline)

Ignore
1524437448
Reply with quote  #2

1524437448
Report to moderator
1524437448
Hero Member
*
Offline Offline

Posts: 1524437448

View Profile Personal Message (Offline)

Ignore
1524437448
Reply with quote  #2

1524437448
Report to moderator
JeromeS
Jr. Member
*
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...

1MHMLCSdxzyaBEYQsQYYNPYkaBjeV1aSNZ
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!