1

do you know any download site for full blockchain header data (6 variables) in CSV ASCII format ?

I would like to enter block header data for every block from No.0 to latest into mining simulator to let students see, every nonce calculated works and any other nonce, random selected fails.

thank you

1

For your purposes may be this dataset is sufficient: http://headers.electrum.org/blockchain_headers

It spans from block 0 to 477636 (2017-07-26 09:03 (just 9 months ago)) and contains just the block headers.

It is binary, but can be easily converted to a csv ASCII file with this Python script:

#!/usr/bin/env python
# convert binary file http://headers.electrum.org/blockchain_headers 
# to CSV ASCII

import binascii

STRUCT_OF_BLOCK = [ 4, 32, 32, 4, 4, 4 ] # blockchain_headers does not contain always "0x00" txn_count
BLOCK_SIZE = sum(STRUCT_OF_BLOCK)

FILE_OUT= open('blockchain_headers.csv','w')

FILE_OUT.write( "version,prev_block,merkle_root,timestamp,bits,nonce,txn_count\n" )

with open('blockchain_headers','rb') as FILE:
    block = FILE.read(BLOCK_SIZE)
    while block != b'':
        position = 0
        for i in STRUCT_OF_BLOCK:
            FILE_OUT.write( bytearray(binascii.hexlify( block[position:(position+i)][::-1] )).decode('ascii') + ',')
            position += i
            if position >= BLOCK_SIZE:
                FILE_OUT.write("00\n") # blockchain_headers does not contain always "0x00" txn_count
        block = FILE.read(BLOCK_SIZE)
  • thank you . No plans to have full block headers updated from time to time ? headers.electrum.org – darius May 8 '18 at 18:32
  • You can install electrum, and that very same file will be regenerated live on ~/.electrum after you add a wallet: any a public address will suffice for this purpose. – circulosmeos May 8 '18 at 21:41
  • @darius : has been the answer helpful? Please consider voting it in that case :-) – circulosmeos May 28 '18 at 20:59
  • I am really sorry for my late response but stackexchange log in fails if you start from email link, since my first log in is via StackOverflow and login credentials are not cashed for SE via cookies. Just let me to test your script for 1-2 days and let me to install electrum to get full and updated blockchain headers. Just give me 2 days. I am sure your answer is the best on our globe ;) – darius Jun 14 '18 at 17:32
  • electrum.com is alibaba company ;) Warning: A fake copy of Electrum, named 'Electrum Pro', is actually bitcoin-stealing malware. More information here electrum.org/#download My desktop win32 Win XP is no more supported, have number of Android tablets and the latest comes with Win 10 64bit, not sure what selection is best, since 3 tablets come with 3G support , so I need to move SIM card from 3G modem to 3G SIM slot in tablet. Win 10 tablet comes without 3G modem. Have another deskop Vista 32bit installed (P4), have 3G wireless router, . Any advice ? – darius Jun 14 '18 at 18:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.