Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

TypeError: Number must be less than N #16

Open
rhyek opened this issue Sep 14, 2018 · 0 comments
Open

TypeError: Number must be less than N #16

rhyek opened this issue Sep 14, 2018 · 0 comments

Comments

@rhyek
Copy link

rhyek commented Sep 14, 2018

Hi. I am trying to sign a transaction and I am getting the error mentioned in the title. This is my code:

const bitcore = require('litecore-lib');
const Mnemonic = require('litecore-mnemonic');

const words = 'something something ...';
const code = new Mnemonic(words);
const hdPrivateKey = code.toHDPrivateKey('password', "livenet");
const derivationPath = hdPrivateKey
  .derive(44, true)
  .derive(2, true)
  .derive(0, true)
  .derive(0);
const utxo = {
  ...
}
const originAddress = '..';
const destinationAddress = ',,';
const privateKey = derivationPath.derive(0).privateKey;

const tx = new bitcore.Transaction()
  .from(utxo)
  .to(destinationAddress, 0.001 * 100000000)
  .change(originAddress);

tx.sign(privateKey);

And the complete stack trace is:

TypeError: Number must be less than N
privatekey.js:55
    at new PrivateKey (/home/carlos/dev/xourse/testbn/node_modules/litecore-lib/lib/privatekey.js:55:11)
    at Transaction.getSignatures (/home/carlos/dev/xourse/testbn/node_modules/litecore-lib/lib/transaction/transaction.js:1141:13)
    at Transaction.sign (/home/carlos/dev/xourse/testbn/node_modules/litecore-lib/lib/transaction/transaction.js:1134:15)
    at Object.<anonymous> (/home/carlos/dev/xourse/testbn/ltc.js:81:12)
    at Module._compile (internal/modules/cjs/loader.js:651:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
    at Module.load (internal/modules/cjs/loader.js:566:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
    at Function.Module._load (internal/modules/cjs/loader.js:498:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:695:10)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant