public inbox for bitcoindev@googlegroups.com
 help / color / mirror / Atom feed
From: Bob McElrath <bob_bitcoin@mcelrath•org>
To: "mbde@bitwatch•co" <mbde@bitwatch•co>
Cc: Bitcoin-development@lists•sourceforge.net
Subject: Re: [Bitcoin-development] Synchronization: 19.5 % orphaned blocks at height 197'324
Date: Sun, 10 Aug 2014 14:07:19 +0000	[thread overview]
Message-ID: <20140810140719.GA20493@mcelrath.org> (raw)
In-Reply-To: <53E776D1.1010503@bitwatch.co>


[-- Attachment #1.1: Type: text/plain, Size: 2046 bytes --]

I had the same problem (repeatedly) which came down a hardware problem.  Bitcoin
more than other applications is very sensitive to single bit flips in memory or
during computation.  (In the end I under-clocked my CPU and RAM to fix the
problem)

Attached is a small python script which will run sha256 on random data
repeatedly and will print a message if a mismatch is found.  For me it took many
hours of running before a sha256 mismatch, but one is enough to fork the
blockchain.

mbde@bitwatch•co [mbde@bitwatch•co] wrote:
> Hello all,
> 
> I'm currently synchronizing a new node and right now, at a progress of a
> height of 197'324 blocks, I count in my debug.log an aweful amount of
> 38'447 orphaned blocks which is about 19.5 %.
> 
> It has been I while since I watched the synchronization process closely,
> but this number seems pretty high to me.
> 
> I'm wondering about the following: would it be possible for a malicious
> party to generate chains of blocks with low difficulity which are not
> part of the main chain to slow down the sync process?
> 
> 
> Build and version information:
> https://github.com/jmcorgan/bitcoin/tree/026686c7de76dfde6fcacfc3d667fb3418a946a7
> (sipa/jmcorgan address index)
> Rebased with:
> https://github.com/bitcoin/bitcoin/tree/94e1b9e05b96e4fe639e5b07b7a53ea216170962
> (almost up-to-date mainline)
> 
> Compressed debug.log attached:
> https://www.dropbox.com/s/uvtd91xiwmdmun7/debug.7z?m=
> (filesize: 7.67 MB, uncompressed: 41.3 MB)
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Bitcoin-development mailing list
> Bitcoin-development@lists•sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bitcoin-development
--
Cheers, Bob McElrath

"The individual has always had to struggle to keep from being overwhelmed by
the tribe.  If you try it, you will be lonely often, and sometimes frightened.
But no price is too high to pay for the privilege of owning yourself." 
    -- Friedrich Nietzsche

[-- Attachment #1.2: sha256check.py --]
[-- Type: text/x-python, Size: 792 bytes --]

#!/usr/bin/python

# Repeatedly run a sha256 on random data.  Keeps a rolling buffer of the last
# <buflen> hashes and re-checks them.  Prints an error ONLY if a mismatch is
# found.  If a mismatch is found, you have a hardware problem.

from hashlib import sha256
from collections import deque
import random

buflen = 100000
hashbuf = deque(maxlen=buflen)

for i in range(buflen):
    hashbuf.append([str(i), sha256(str(i)).hexdigest()])

while True:
    k, khash = hashbuf.popleft()
    pophash = sha256(k).hexdigest()
    if pophash != khash:
        print "ERROR: sha256(%s) = %s does not match:"%(k, khash)
        print "       sha256(%s) = %s"%(k, pophash)
    k = str(random.getrandbits(1000))
    khash = sha256(k).hexdigest()
    hashbuf.append([k, khash])

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2014-08-10 14:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-10 13:42 mbde
2014-08-10 14:07 ` Bob McElrath [this message]
2014-08-10 18:07   ` Pieter Wuille
2014-08-10 14:20 ` Jeff Garzik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140810140719.GA20493@mcelrath.org \
    --to=bob_bitcoin@mcelrath$(echo .)org \
    --cc=Bitcoin-development@lists$(echo .)sourceforge.net \
    --cc=mbde@bitwatch$(echo .)co \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox