Author

Topic: What is the format data in LevelDB that is for blocks? (Read 134 times)

legendary
Activity: 3500
Merit: 6320
Crypto Swap Exchange
Basically, if you were to save each block as an individual file with the block number as filename, it would be extremely inefficient for a multitude of reasons.

Since I deal with some things like this for work. I will have to say that this that is usually true it's not always true.
There are efficient ways of handling large amounts of flat data files even massive numbers of them.

Folder trees with a file that gives locations does work really well. So long as it's programmed properly.

The mail archive we run does this and I can pull one message out of millions that was received years ago that is buried in a zip file in a fraction of a second.
BUT, the entire app was written with that in mind.

So, no it's not that it cannot be done. Just that it should not be done unless you have a specific reason.

-Dave
hero member
Activity: 882
Merit: 5834
not your keys, not your coins!
Am I right that LevelDB stores information like number_of_block -> name_of_file_for_that_block and it's done for downloading blocks in parallel? If so, then what is the format of data in LevelDB for blocks? And why data of blocks are not sent like block_data + block_num so the receiver can save the file with the got number and we don't need a database?
The block index database tells you where to find a certain block. Those are stored as blk*.dat files on disk, which do contain the block number (in the header) and subsequently the block data.
The whole blk*.dat file structure is found here: https://learnmeabitcoin.com/technical/blkdat

The Bitcoin wiki has a whole page about Bitcoin Core's data storage setup.

Basically, if you were to save each block as an individual file with the block number as filename, it would be extremely inefficient for a multitude of reasons.
jr. member
Activity: 33
Merit: 22
Am I right that LevelDB stores information like number_of_block -> name_of_file_for_that_block and it's done for downloading blocks in parallel? If so, then what is the format of data in LevelDB for blocks? And why data of blocks are not sent like block_data + block_num so the receiver can save the file with the got number and we don't need a database?
Jump to: