Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev Docs: Describe Serialized Block Header And Block Format #638

Merged
merged 2 commits into from
Nov 9, 2014

Conversation

harding
Copy link
Contributor

@harding harding commented Nov 8, 2014

Preview: http://dg0.dtrt.org/en/developer-reference#block-chain

  • Replace current description of the block header with a better description.
  • Describe the serialized block format used to calculate max block size.

Similar to pull #631, this is background documentation about the consensus-covered stuff for the upcoming non-consensus P2P reference section. Specificially, the goal here is to document the header format used in the P2P headers message and the serialized block format used in the P2P blocks message.

* Replace current description of the block header with a better
description.

    * Describe the various version numbers.

    * Describe how the merkle root is constructed.

    * Describe how nBits is parsed and how to correctly create it to
      avoid negative values.

* Describe the serialized block format used to calculate max block size.

{% autocrossref %}

The target threshold is a 256-bit unsigned integer compared the 256-bit
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@harding Perhaps I'm missing something, but is there some wrong formulation or missing word in this sentence? I don't get what "compared the..." means in this context.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@saivann How about:

The target threshold is a 256-bit unsigned integer which a header hash must be equal to or below in order for that header to be a valid part of the block chain.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@harding Sounds good to me!

@ghost1542
Copy link
Contributor

Will read everything tomorrow, but looks awesome at a first glance! Thanks for sharing work and questions with @minium, perhaps both projects can benefit from each other.

@minium
Copy link

minium commented Nov 8, 2014

@saivann They sure will, I'm already on it!

|-------|---------------------|-----------|----------------
| 4 | version | uint32_t | The [block version][]{:#term-block-version}{:.term} number indicates which set of block validation rules to follow. See the list of block versions below.
| 32 | previous block hash | char[32] | A SHA256(SHA256()) hash in internal byte order of the previous block's header. This ensures no previous block can be changed without also changing this block's header.
| 32 | merkle root hash | char[32] | A SHA256(SHA256()) hash in internal byte order. The merkle root is derived from hashes of all transaction included in this block, ensuring none of those transactions can be modified without modifying the header. See the [merkle trees section][section merkle trees] below.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/all transaction included/all transactions included/ ?

@ghost1542
Copy link
Contributor

@harding Except the small issues above, LGTM, thanks!

@minium Nice! :)

@harding
Copy link
Contributor Author

harding commented Nov 8, 2014

@saivann thanks for the review! I think commit 63b4d03 addresses all of your feedback; I also updated the preview.

In the absence of critical feedback, this pull will be merged around 22:00 UTC Sunday.

@harding harding merged commit 63b4d03 into bitcoin-dot-org:master Nov 9, 2014
harding added a commit that referenced this pull request Nov 9, 2014
@harding harding deleted the serialized-blocks branch February 25, 2015 01:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants