nasa8x / node-genesis-block

Create Genesis Block for Bitcoin, Litcoin, Dash, X11, X13, X15, X17, Geek, Quark, Keccak, Qubit, NeoScrypt, Scrypt...
https://morioh.com/topic/blockchain
39 stars 92 forks source link

Error with "byteLength" #23

Open tvl83 opened 5 years ago

tvl83 commented 5 years ago

No matter which algo I try i get the same error.

node genesis -a scrypt
/mnt/c/Users/tvle8/WebstormProjects/node-genesis-block/node_modules/yargs/yargs.js:1133
      else throw err
           ^

TypeError [ERR_INVALID_ARG_TYPE]: The "byteLength" argument must be of type number. Received type boolean
    at validateNumber (internal/validators.js:130:11)
    at boundsError (internal/buffer.js:42:5)
    at Buffer.writeIntLE (internal/buffer.js:674:3)
    at createTx (/mnt/c/Users/tvle8/WebstormProjects/node-genesis-block/genesis.js:91:8)
    at Object.require.alias.alias.alias.alias.alias.alias.alias.alias.alias.help.command [as handler] (/mnt/c/Users/tvle8/WebstormProjects/node-genesis-block/genesis.js:40:37)
    at Object.runCommand (/mnt/c/Users/tvle8/WebstormProjects/node-genesis-block/node_modules/yargs/lib/command.js:235:44)
    at Object.parseArgs [as _parseArgs] (/mnt/c/Users/tvle8/WebstormProjects/node-genesis-block/node_modules/yargs/yargs.js:1074:24)
    at Object.get [as argv] (/mnt/c/Users/tvle8/WebstormProjects/node-genesis-block/node_modules/yargs/yargs.js:989:21)
    at Object.<anonymous> (/mnt/c/Users/tvle8/WebstormProjects/node-genesis-block/genesis.js:55:5)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
node -v
v10.16.3
hashcrack256 commented 4 years ago

What's happening here is that the N and R parameters are missing from the call to get the scrypt proof of work. They can be hard-coded in to create a proof of work identical to that of Litecoin with N = 1024 and R = 1. So we get hash = Hash["scrypt"]( data, 1024, 1 ).

Please see modified version at my repository https://github.com/hashcrack256/node-genesis-block. You will want to upgrade to Node 12.x LTS.

HTH