Bitcoin Forum
May 21, 2024, 08:34:54 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: What is the format data in LevelDB that is for blocks?  (Read 108 times)
BoyFromDubai (OP)
Jr. Member
*
Offline Offline

Activity: 33
Merit: 22


View Profile
May 22, 2023, 01:33:30 PM
Last edit: May 22, 2023, 02:11:20 PM by BoyFromDubai
 #1

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?
n0nce
Hero Member
*****
Offline Offline

Activity: 882
Merit: 5829


not your keys, not your coins!


View Profile WWW
May 23, 2023, 08:23:11 AM
Merited by hugeblack (4), DaveF (2), ABCbits (1), darkv0rt3x (1)
 #2

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.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
DaveF
Legendary
*
Offline Offline

Activity: 3486
Merit: 6303


Crypto Swap Exchange


View Profile WWW
May 26, 2023, 11:15:33 AM
Merited by n0nce (2)
 #3

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

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!