Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: aitsam on November 25, 2019, 02:46:45 PM



Title: script to get only first block from all blk*.dat files
Post by: aitsam on November 25, 2019, 02:46:45 PM
Sorry if that question is already asked and answered earlier, but I couldn't find it in this forum.

I am testing bitcoin data by using different filters. Now I want to write a script which will only consider the first block in blk*.dat file. I am confused about where to start.
Your help will be highly appreciated.
Thank you


Title: Re: script to get only first block from all blk*.dat files
Post by: aitsam on November 26, 2019, 09:20:14 AM
I don't know the technical details, but for starters :
1. Bitcoin Core use LevelDB
2. blk*.dat have fixed maximum size, so you might only get partial data of the "first" block in a blk*.dat file
3. Bitcore Core use obfuscation key on LevelDB, see https://bitcoin.stackexchange.com/a/50902 (https://bitcoin.stackexchange.com/a/50902) for detailed info

P.S. this sounds like XY problem, what are you trying to accomplish by get only first block from all blk*.dat files

````````````````````````````````````
I am testing some filters and it turns out that at a specific block the code get stuck, I want to find that block and run test on it separately.