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.

m...@bitwatch.co [m...@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
#!/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: signature.asc
Description: Digital signature

------------------------------------------------------------------------------
_______________________________________________
Bitcoin-development mailing list
Bitcoin-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bitcoin-development

Reply via email to