Author

Topic: /////////////////////////////////////////////////// (Read 1050 times)

legendary
Activity: 2087
Merit: 1015
The nBits is a compressed form of the target, it's of type uint32_t, which on my own system is 4 bytes.
Are you implying there is some real word system, running today, where 8 bits != 1 byte ? Does it run bitcoin too ?
http://en.wikipedia.org/wiki/Byte#Common_uses
http://stackoverflow.com/questions/5516044/system-where-1-byte-8-bit/5516161#5516161

newbie
Activity: 32
Merit: 0
blk*.dat format is a repetition of:

- magic (uint32-le)
- size  (uint32-le) - bytes count of following block
- block (https://en.bitcoin.it/wiki/Protocol_specification#block)

The block spec points out that `bits` is a uint32-le.

`bits` represents difficulty in compact form and you can see how to expand it here https://en.bitcoin.it/wiki/Difficulty.

Quote
but it's funny that no comprehensive network protocol and file format description exists in the wild.

The wiki (https://en.bitcoin.it/wiki/Protocol_specification) is pretty comprehensive.
member
Activity: 98
Merit: 10
nearly dead

The nBits is a compressed form of the target, it's of type uint32_t, which on my own system is 4 bytes.


Are you implying there is some real word system, running today, where 8 bits != 1 byte ? Does it run bitcoin too ?
legendary
Activity: 1862
Merit: 1011
Reverse engineer from time to time
Hi everyone,

I'm trying to optimize the blockchain files.

What I found is interesting.
So for one thing is obvious - protocol is not optimized.
Why?
Well you have distinctive lengths IN the protocol description, and for some reason you still need the block length AND the delimiter (not to mention that the lock time might as well be a delimiter).

But first things first, the only descriptive information about the blocks I found is in this page http://james.lab6.com/2012/01/12/bitcoin-285-bytes-that-changed-the-world/
But it does not state the format of target bits field is it a varint or just a regular 4byte int?

For now you can safely delete the fields of of network id in the blockchain data as well as block length, sequence number and lock time.
Save the timestamp as difference from previous block - this can yield additional optimisation for 4 bytes in keys.
That frees just 16 bytes per block which is not too much, but I want to delve deeper into relations in the script of bitcoin transaction so we can build a relation database first to see how everything is connected and then just optimize by the lower numbered sequence of keys (the latter is obvious various hashes).

I'm doing this for fun, and not sure a drastic optimization can be done, but it's funny that no comprehensive network protocol and file format description exists in the wild.
The nBits is a compressed form of the target, it's of type uint32_t, which on my own system is 4 bytes. https://en.bitcoin.it/wiki/Protocol_specification#Block_Headers
newbie
Activity: 6
Merit: 100
H//////////////////////////////////////////////////
Jump to: