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

Hashing random blocks failures and hard errors #1

Open
DawBin opened this issue Mar 8, 2018 · 3 comments
Open

Hashing random blocks failures and hard errors #1

DawBin opened this issue Mar 8, 2018 · 3 comments

Comments

@DawBin
Copy link

DawBin commented Mar 8, 2018

I'm running a script that selects random historical blocks. For each random block I am passing the correct nonce. Sometimes the hash is correct, sometimes it is not correct and other times there is an error. Here are repeatable samples using the example code...

CORRECT HASH:

    //
    //Target Block: 0000000099e42d2610bde471f80267d6e3393f8b653a45c3cb409ae870d4cdb1
    //Correct nonce will be: 1655861781
    //
    
    const block = {
            version: 1
            ,previousblockhash: '000000004b163c55c375213d53647f16d89fc6918b60afeaedc5bef848f813b5'
            ,merkleroot: 'b1ea695ce6cdd3acfdd4f59d247590a857ea02d3b7f99cff12a596f0bde62d49'
            ,time: 1259804330
            ,bits: '1d00ffff'
    }
    0000000099e42d2610bde471f80267d6e3393f8b653a45c3cb409ae870d4cdb1 1655861781 <-SUCCESS

INCORRECT HASH:

    //
    //Target Block: 000000000000000000937fa8b710d4acbe9dea7eb8f252b880f37d4439ccce19
    //Correct nonce will be: 2005385666
    //
    
    const block = {
            version: 536870914
            ,previousblockhash: '0000000000000000011449a27a730a8d03011dcd1eaec65c1b7f1c04649cd150'
            ,merkleroot: 'b80ece38e5be35fb7bceff6fb6754d876945ec917081aeab51dc9a91a6f36ba1'
            ,time: 1501985653
            ,bits: '18014735'
    }
    d8f689fb65f1d798c4827ba81d8ec740f37dd2d5158948b3636d0015d59c6393 2005385666 <-FAIL

ERROR (seems to be related to nonce value):

//
  //Target Block: 000000000000000002c098e283d0f186e3f0d591839c875572f8d0d02e08f35a
  //Correct nonce will be: 2382794207
  //
  
  const block = {
          version: 536870912
          ,previousblockhash: '000000000000000002c91a74eff899976e9738554f51c5673dbb4f4de3764b1f'
          ,merkleroot: '1ff8c9595b935f4566b0ef28a4304c06e98d4f3074c838a1b87453b23e9728da'
          ,time: 1485910721
          ,bits: '1802cc47'
  }
  TypeError: "value" argument is out of bounds
      at checkInt (buffer.js:1185:11)
      at Buffer.writeInt32LE (buffer.js:1375:5)
      at Miner.getHash (C:\Users\corbi\OneDrive\Documents\NodeJS\node_modules\bitcoin-miner\index.js:56:28)
      at miner (C:\Users\corbi\OneDrive\Documents\NodeJS\Miner\index.js:67:21)
      at C:\Users\corbi\OneDrive\Documents\NodeJS\Miner\index.js:50:11
      at C:\Users\corbi\OneDrive\Documents\NodeJS\node_modules\bitcoin\lib\index.js:37:8
      at C:\Users\corbi\OneDrive\Documents\NodeJS\node_modules\bitcoin\lib\jsonrpc.js:138:13
      at Array.forEach (<anonymous>)
      at IncomingMessage.<anonymous> (C:\Users\corbi\OneDrive\Documents\NodeJS\node_modules\bitcoin\lib\jsonrpc.js:127:15)
      at emitNone (events.js:111:20)
  buffer.js:405
      throw new TypeError('Arguments must be Buffers or Uint8Arrays');
      ^
  
  TypeError: Arguments must be Buffers or Uint8Arrays
      at Function.compare (buffer.js:405:11)
      at Miner.checkHash (C:\Users\corbi\OneDrive\Documents\NodeJS\node_modules\bitcoin-miner\index.js:93:17)
      at miner (C:\Users\corbi\OneDrive\Documents\NodeJS\Miner\index.js:68:16)
      at C:\Users\corbi\OneDrive\Documents\NodeJS\Miner\index.js:50:11
      at C:\Users\corbi\OneDrive\Documents\NodeJS\node_modules\bitcoin\lib\index.js:37:8
      at C:\Users\corbi\OneDrive\Documents\NodeJS\node_modules\bitcoin\lib\jsonrpc.js:138:13
      at Array.forEach (<anonymous>)
      at IncomingMessage.<anonymous> (C:\Users\corbi\OneDrive\Documents\NodeJS\node_modules\bitcoin\lib\jsonrpc.js:127:15)
      at emitNone (events.js:111:20)
      at IncomingMessage.emit (events.js:208:7)

@unitof
Copy link
Contributor

unitof commented May 19, 2018

Could you upload the code or snippet you're using to pull the random historic blocks? Going to take a crack at replicating.

@DawBin
Copy link
Author

DawBin commented May 19, 2018

Certainly, here it is...

test.txt

@JMoli
Copy link

JMoli commented Jun 8, 2018

the timestamp in mined blocks is often wrong

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

No branches or pull requests

3 participants