Bitcoin Forum
June 15, 2024, 04:22:15 AM *
News: Voting for pizza day contest
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Which files are used for storing information about vouts for a block?  (Read 68 times)
BoyFromDubai (OP)
Jr. Member
*
Offline Offline

Activity: 33
Merit: 22


View Profile
December 16, 2022, 02:50:00 PM
Merited by ABCbits (1)
 #1

I remember that I somewhere saw an article that not only files of blocks are stored, but also the information about vouts in these blocks. I mean file blk_n.dat and a file for blk_n.dat that stores all vouts for this block. It's used for situations when you got bigger chain, but your last block isn't in it and you have to restore your leveldb whic stores vouts with the help of this file.
And I can't find any information for this topic and that article I said about before
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3430
Merit: 6704


Just writing some code


View Profile WWW
December 16, 2022, 04:48:56 PM
Merited by ABCbits (1)
 #2

The undo data is stored in rev*.dat files.

BoyFromDubai (OP)
Jr. Member
*
Offline Offline

Activity: 33
Merit: 22


View Profile
December 16, 2022, 05:09:20 PM
 #3

But what kind of data is stored there? Vins, vouts or both?
n0nce
Hero Member
*****
Offline Offline

Activity: 882
Merit: 5829


not your keys, not your coins!


View Profile WWW
December 16, 2022, 09:03:06 PM
Merited by ABCbits (1)
 #4

But what kind of data is stored there? Vins, vouts or both?
A simple web search reveals your answer.

The rev*.dat files (the "undo files"), contain all UTXOs spent by the inputs of a block. It was introduced in Bitcoin Core 0.8, and contains a concatenation of records, one for each block. This mimicks the structure of the blk*.dat files which contain blocks.

Each block record consists of:
  • 4 bytes: network magic (0xf9,0xbe,0xb4,0xd9)
  • 4 bytes: size of the CBlockUndo record (LE32)
  • data_size bytes: CBlockUndo record
  • 32 bytes: double-SHA256 of the serialized CBlockUndo record
[...]

The block structure is explained here, by the way.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
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!