Post
Topic
Board Development & Technical Discussion
Merits 4 from 2 users
Re: Extracting data from a blk file.
by
a_6apcyk
on 18/12/2020, 22:00:57 UTC
⭐ Merited by vapourminer (3) ,ETFbitcoin (1)
I understand that the question is about reading blk files, but why do you need it ? You can ask bitcoin RPC all the data stored in these files. 
Secondly, I was thinking of creating a different block explorer. Right now, block explorers respond with RPC commands and return their result to the client. I was thinking of inserting the blocks' information to a mysql database. This way, RPC is not needed.

I'm pretty sure that block explorers already use internally some database, I think it is NoSQL databases. I personally did this work some time before - I loaded BTC blockchain to Postgres and it was bad idea. Because for example 438 600 blocks contains  481 744 165 transactions and they contains 1 285 285 104 outputs. So you have huge tables and problems with indexing. Than i decided to use Elasticsearch and this was mush better. So you should think what database would be better to use to solve this problem.
As for RPC - I used bitcoin core rpc only to extract block data and write it to elastic. And I found bitcoinetl the best way to extract it.