Show more significant bytes of block hashes. #1426

pull rebroad wants to merge 1 commits into bitcoin:master from rebroad:MoreSignificantBits changing 7 files +38 −30
  1. rebroad commented at 10:44 PM on June 5, 2012: contributor

    On Mon Aug 16 20:55:54 2010, Satoshi modified the client to display 20 bytes of the block hash (up from 16 bytes). This pull request increases the number of significant bytes by 5, and reduces the number of insignificant bytes (almost always zeros) by 10, resulting in saved space in debug.log and improved uniqueness of block hashes.

  2. TheBlueMatt commented at 11:03 PM on June 5, 2012: member

    I'd like to keep one leading 0 on diff-1 blocks, instead of removing all the 0s, which would leave only 6 0s on current-diff blocks, which IMHO is acceptable, but ACK on the idea.

  3. gavinandresen commented at 12:09 AM on June 6, 2012: contributor

    I like the at-least-one leading 0 on min-difficulty blocks idea; I've spent a lot of time staring at min difficulty testnet block hashes.

  4. gavinandresen commented at 12:11 AM on June 6, 2012: contributor

    One downside of this change: it might break blockexplorer.com's block lookup (please test, I know it works with the existing lots-of-leading-zeroes format).

  5. rebroad commented at 8:51 AM on June 6, 2012: contributor

    I see what you mean re testnet. Perhaps I should code it so that it's one leading zero whatever the situation...?

  6. sipa commented at 2:12 PM on June 8, 2012: member

    Solution: use the low bits of block hashes to identify them, instead of high bits which contain several zeroes?

  7. luke-jr commented at 10:13 PM on June 8, 2012: member

    I definitely prefer showing the low bits over high ones.

  8. TheBlueMatt commented at 1:39 PM on June 9, 2012: member

    Agreed, as long as someone pings theymos et al to get bbe/blockchain.info updated to support low bit-searching implemented before release.

  9. luke-jr commented at 4:22 PM on June 9, 2012: member

    BBE doesn't care which bits you use. Blockchain.info doesn't accept partial matches/searches at all.

  10. TheBlueMatt commented at 5:55 PM on June 9, 2012: member

    Ah, well then I guess we should just switch to low bits.

  11. sipa commented at 3:54 PM on June 14, 2012: member

    Using the 14 lowest hex characters of a block as identifier should suffice for 100 years (0.2% chance for a collision after 5.46 million blocks). So I'd say use the 16 lowest ones.

  12. gmaxwell commented at 4:51 PM on June 14, 2012: contributor

    I'd somewhat prefer to show the full values, because thats what the getblock rpc needs. If we're concerned about space we should create rotation that doesn't stink.

  13. rebroad commented at 11:24 PM on June 14, 2012: contributor

    @sipa it's just a debug.log. I doubt anyone will have a debug.log file as long as 100 years, so 14 characters would be an extreme overkill. @gmaxwell it doesn't currently show full values and never has. The current requirement seems to be that the numbers don't want to be duplicated within the entirity of the debug.log file. For that, the last 14 hex characters are more than sufficient (as sipa pointed out).

  14. luke-jr commented at 10:24 PM on June 18, 2012: member

    @rebroad Are you going to update this to show the least-significant (end/tail) N?

  15. rebroad commented at 6:34 PM on June 21, 2012: contributor

    Yes, very likely, when i next get access to a computer (next week sometime).

  16. rebroad commented at 9:05 PM on July 2, 2012: contributor

    @luke-jr can I ask your opinion - is it better to hardcode the substr numbers or instead do it in a way that uses the length of the string?

  17. luke-jr commented at 9:13 PM on July 2, 2012: member

    I'd just go with substr(504)

  18. rebroad commented at 11:37 PM on July 2, 2012: contributor

    @luke-jr modified (not yet tested - compiling)

  19. sipa commented at 12:14 AM on July 3, 2012: member

    wth? 504? hex hashes are only 64 characters long.

  20. sipa commented at 12:16 AM on July 3, 2012: member

    @rebroad I prefer the reported hashes in the debug file to be globally and near-forever usable as unique identifiers. I'd just use the low 64 bits of the hash (i.e., the last 16 hex characters). .substr(48) i suppose.

  21. luke-jr commented at 12:22 AM on July 3, 2012: member

    ... yeah, not sure how I got 504 (except I know I forgot to divide by 8)... long day :(

    I meant .substr(56), but I don't mind 48

  22. gmaxwell commented at 1:03 AM on July 3, 2012: contributor

    @rebroad I know it doesn't currently show full values. @sipa I still think it should show the full value. The partial values are almost useless because there is no way to getblock by them. I don't think carrying another index for partial block values names sense, nor do I think precluding hash tables that require exact lookups makes sense. Reducing them by 1/4th while breaking lookup with getblock isn't a worthwhile tradeoff.

    (Of, course, I'll continue to patch my nodes to log the full value regardless, but I think its a reasonable default).

  23. Show more significant bytes of block hashes. 7a2670692e
  24. rebroad commented at 1:09 PM on July 3, 2012: contributor

    updated. now substr(48) (effectively). Next.. shall we shorten the work= field....?!

  25. sipa commented at 1:19 PM on July 3, 2012: member

    How about using the unit GHy? (gigahash year). We're currently at around 11874.5 GHy.

  26. rebroad commented at 10:02 PM on July 3, 2012: contributor

    @sipa how do you turn the current value into GHy?

  27. sipa commented at 12:21 AM on July 4, 2012: member

    Divide the bnWork number by 31556926000000000 (1 billion times the number of seconds in a year).

  28. rebroad commented at 6:30 PM on July 4, 2012: contributor

    @sipa Shall I add that change to this pull, or a separate pull (which would need to go in after this one?)

  29. midnightmagic commented at 7:21 PM on July 26, 2012: contributor

    Currently there is no way for a user to go from the entries in the debug.log, using bitcoind calls only, to useful information. Is there no intention of correcting the api calls so they accept whatever it is we're dumping into debug.log? This way we can do investigation without writing our own extensive tools or being forced to visit a website? How is it that you guys debug problematic blocks? Do you maintain extensive patchsets of your own that don't depend on behaviour in the base client?

  30. jgarzik commented at 4:54 PM on August 1, 2012: contributor

    Weak ACK, mostly don't care.

    BLOCKSUBSTR should be in a separate, zero-behavior-change commit.

  31. Diapolo commented at 5:54 PM on August 1, 2012: none

    BLOCKSUBSTR could take a little comment IMHO.

  32. luke-jr commented at 5:57 PM on August 1, 2012: member

    While we're fence-painting, it seems to me hash.ToString().substr(BLOCKSUBSTR).c_str() could be reduced to hash.BlockSubstr().c_str()

  33. BitcoinPullTester commented at 1:40 AM on August 10, 2012: none

    Automatic sanity-testing: FAILED MERGE, see http://jenkins.bluematt.me/pull-tester/7a2670692e7cf455899fdb3dafdff734ce2a794b for test log.

    This pull does not merge cleanly onto current master

  34. laanwj commented at 7:06 PM on August 20, 2012: member

    Closing this in favor of #1670

  35. laanwj closed this on Aug 20, 2012

  36. suprnurd referenced this in commit 86525601d5 on Dec 5, 2017
  37. lateminer referenced this in commit e5c6f93952 on Jan 22, 2019
  38. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-14 18:16 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me