i am looking for a .csv file of every block timestamp in bitcoin history with the block height. i can get one day at a time from bitcoin.info but i dont fancy manually copying and pasting over 3000 days worth and cleaning that data up. Does anyone know an efficient way to obtain this? i'll even settle for the daily block count, as long as its back to the genesis block and in .csv format.
You can use https://blockchair.com/bitcoin/blocks. It is limited to 1 million cells for free, but as you only need "Time" and "Height", just:
- deselect all checkboxes but "Height", and click on "Export" selecting then "csv". Open this file with your spreadsheet app.
- deselect "Height" and select only "Time". Export.
- Open the file from (2), copy the column, and paste it next to the first column in file from (1).
- as the results are both ordered by time, rows coincide and you already have the desired data!
You can export them from the node using this tool https://github.com/blockchain-etl/bitcoin-etl
> pip install bitcoin-etl > bitcoinetl export_blocks_and_transactions --start-block 0 --end-block 500000 \ --provider-uri http://user:pass@localhost:8332 \ --blocks-output blocks.csv