Author

Topic: What is binary format blk00NNN.dat files (Read 906 times)

copper member
Activity: 1498
Merit: 1528
No I dont escrow anymore.
May 07, 2016, 01:46:37 AM
#10
I can not understand how to obtain multiple leading zeros in hash, while nonce is only 32-bit value
Miners manipulates hash of Merkle tree?

Yes, the merkle tree is indirectly "manipulated" by adding or removing transactions. The timestamp and the coinbase input can also be modified.
member
Activity: 138
Merit: 25
I can not understand how to obtain multiple leading zeros in hash, while nonce is only 32-bit value
Miners manipulates hash of Merkle tree?
staff
Activity: 3458
Merit: 6793
Just writing some code
Maybe is possible to avoid reading indices?
I first read headers of all block, next I compute hash (how fields use specifically to compute hash besides nonce?, next I will build chain tree and select the longest chain.

Sure, you can do it that way too. Each block is the 4 byte magic bytes, then the size of the block, then the block in raw format. The first 80 bytes is the header and that is hashed using sha256d. The output is then represented using little endian. The rest of the block is just the transactions. For full info on the serialized format, see https://bitcoin.org/en/developer-reference#serialized-blocks
member
Activity: 138
Merit: 25
Maybe is possible to avoid reading indices?
I first read headers of all block, next I compute hash (how fields use specifically to compute hash besides nonce?, next I will build chain tree and select the longest chain.
staff
Activity: 3458
Merit: 6793
Just writing some code
Is where description of indices files? I must maybe use https://github.com/google/leveldb to read.
There is no description of the format of leveldb files that I know of. You will have to write your own client which uses LevelDB in order to read the data from those db files.
member
Activity: 138
Merit: 25
Is where description of indices files? I must maybe use https://github.com/google/leveldb to read.
staff
Activity: 3458
Merit: 6793
Just writing some code
If I must read  specific block for example 200000, in which file and which position in this file this block begin?
I must read indices, where described is indices format?
In https://en.bitcoin.it/wiki/Block I can't see block heights
I can't see block hash, only previous hash.
In blockchain are also blocks from alternative branch?

The indices for the blocks are in a separate LevelDB database. The blk*.dat files are simply where the blocks are stored, but it means nothing to the software without the database which indexes the blocks. Those indices are kept in the index folder inside of the blocks folder. Bitcoin Core will write to the disk every valid block it receives, so this does include forks and stale blocks in case of blockchain reorgs.
member
Activity: 138
Merit: 25
If I must read  specific block for example 200000, in which file and which position in this file this block begin?
I must read indices, where described is indices format?
In https://en.bitcoin.it/wiki/Block I can't see block heights
I can't see block hash, only previous hash.
In blockchain are also blocks from alternative branch?
staff
Activity: 3458
Merit: 6793
Just writing some code
The blocks are written to the disk exactly in the way that Bitcoin Core receives them. It just writes the actually block messages. What exactly are you asking?
member
Activity: 138
Merit: 25
Blocks are described here : https://en.bitcoin.it/wiki/Block
There are chains of blocks , summary size < 128 MiB?
Jump to: