I’m trying to understand the format of key/value pairs in LevelDB for Bitcoin data storage.
Given the following raw key and value:
Raw Key: 6200005BD1B034B80F7C08EA312BBCDBCFDB647E366B85EC6B206F0D0000000000
Raw Value: 8EA010848A2D1D04008FDAEC0A81FAC8420100000093FC79C5606493FC6051E334231BC7B6E765BAE097A5A6A82D960500000000006ED298FA7CCD23916490EDB1D8DADF981FFB6A6CF99B518677A30CBAE04767A1B118A94CA3B2311B110468F0
https://bitcoin.stackexchange.com/a/67569/157164
https://bitcoin.stackexchange.com/a/29418/157164
From my understanding based on these two comments, I expected the value to contain, in this order:
Block header
Block height
Transaction count
Validation status
Data file
Data offset
Undo file
Undo offset
However, it appears the block header is at the end of the value instead of the beginning. After stripping the header bytes, I’m left with: 8EA010848A2D1D04008FDAEC0A81FAC842
I expected to extract block height, transaction count, validation status, etc., from this, but I can’t seem to do so, regardless of the endian format used.
Could someone clarify the correct structure of this value? Are these elements encoded as Varint or CompactSize? Any insight would be greatly appreciated!