#NEWLINE# def dump_block( block , network = 'BTC' ) : #NEWLINE# #INDENT# blob = stream_to_bytes ( block . stream ) #NEWLINE# print ( ( '%d bytes   block hash %s' % ( len ( blob ) , block . id ( ) ) ) ) #NEWLINE# print ( ( 'version %d' % block . version ) ) #NEWLINE# print ( ( 'prior block hash %s' % b2h_rev ( block . previous_block_hash ) ) ) #NEWLINE# print ( ( 'merkle root %s' % b2h ( block . merkle_root ) ) ) #NEWLINE# print ( ( 'timestamp %s' % datetime . datetime . utcfromtimestamp ( block . timestamp ) . isoformat ( ) ) ) #NEWLINE# print ( ( 'difficulty %d' % block . difficulty ) ) #NEWLINE# print ( ( 'nonce %s' % block . nonce ) ) #NEWLINE# print ( ( '%d transaction%s' % ( len ( block . txs ) , ( 's' if ( len ( block . txs ) != 1 ) else '' ) ) ) ) #NEWLINE# for ( idx , tx ) in enumerate ( block . txs ) : #NEWLINE# #INDENT# print ( ( 'Tx #%d:' % idx ) ) #NEWLINE# dump_tx ( tx , netcode = network )