diff options
author | azeteki <azeteki@safe-mail.net> | 2014-07-17 12:05:50 +0100 |
---|---|---|
committer | azeteki <azeteki@safe-mail.net> | 2014-07-17 12:05:50 +0100 |
commit | 6c53fc6778261d97ec1659836b63b4d9ae52e78d (patch) | |
tree | fb9f90148d8e37246eed59ee7bd5cea13eb1b6ae | |
parent | e0d5c3765ab3868beff794966f2d33a772609f9e (diff) |
Add -l, --labels switch for column labels
-rw-r--r-- | README.md | 19 | ||||
-rw-r--r-- | main.py | 14 |
2 files changed, 15 insertions, 18 deletions
@@ -11,33 +11,28 @@ produced by Amphibian (azeteki, atelopus_zeteki) rename example.conf to bitcoind-chainstats.conf and enter your details. the program will die hard if the config file is incorrect or it fails to connect. - -this will be improved in a later release. -## launch +## usage Replace 'python' with 'python2' if you also have python3 installed. ``` +main.py [-h] [-c CONFIG] [-l] [starting_block] [blocks_to_get] + # list all blocks $ python main.py -$ python main.py -c some_other_config_file.conf - -# list blocks in range 100000 - 100999 -$ python main.py 100000 1000 -# output to file -$ python main.py > some_data_file +# list from 200000 to 200999 with column labels +$ python main.py -l 200000 1000 ``` ## example output ``` -$ python main.py 200000 5 -# height hash time interval chainwork diff nethash144 nethash432 nethash1008 size tx coinbase fees fee_per_tx fee_per_kb +$ python main.py --labels 200000 5 +height hash time interval chainwork diff nethash144 nethash432 nethash1008 size tx coinbase fees fee_per_tx fee_per_kb 200000 000000000000034a7dedef4a161fa058a2d67a173a90155f3a2fe6fc132e0ebf 1348310759 0 68.741562 2864140 25105260243619 23066050181816 22281735686656 247533 388 50.63517500 0.63517500 0.00164128 0.00262761 200001 00000000000002e3269b8a00caf315115297c626f954770e8398470d7f387e1c 1348310843 84 68.741598 2864140 25576851568601 23096853150357 22299743830620 11068 32 50.00520000 0.00520000 0.00016774 0.00048110 200002 00000000000001d164de39e85839b49d68d55604415b264820de242cb3863f0e 1348312090 1247 68.741634 2864140 25499167450551 23020140938324 22249412353405 182188 18 50.09950000 0.09950000 0.00585294 0.00055925 200003 0000000000000566faa9fa71f77bf56b3494cbc56d5974b9f12cfb1969077582 1348311399 -691 68.741670 2864140 25780838043250 23023311177595 22279760035155 31501 85 50.04905000 0.04905000 0.00058393 0.00159446 200004 000000000000032e1219acd8cdda073f5cbb42a216fede788ad4b555e7969a26 1348311812 413 68.741706 2864140 26040825619842 23064916104200 22315676629662 3535 5 50.00000000 0.00000000 0.00000000 0.00000000 -# end ``` ## frog food @@ -15,10 +15,11 @@ def main_loop(rpchandle, args): block = rpc.getblock(rpchandle, args.starting_block) lastblock = block['time'] - header= "# height hash time interval" - header += " chainwork diff nethash144 nethash432 nethash1008 size" - header += " tx coinbase fees fee_per_tx fee_per_kb" - print header + if args.labels: + header= "height hash time interval" + header += " chainwork diff nethash144 nethash432 nethash1008 size" + header += " tx coinbase fees fee_per_tx fee_per_kb" + print header while block['height'] < args.starting_block + args.blocks_to_get: if block: @@ -61,14 +62,15 @@ def main_loop(rpchandle, args): string = "last: block " + "% 6d" % block['height'] + "\n" sys.stderr.write(string) - print "# end" - if __name__ == '__main__': # parse commandline arguments parser = argparse.ArgumentParser() parser.add_argument("-c", "--config", help="path to config file [bitcoind-chainstats.conf]", default="bitcoind-chainstats.conf") + parser.add_argument("-l", "--labels", + help="print column labels before data", + action="store_true") parser.add_argument('starting_block', type=int, nargs="?", help='block to start from', default=0) |