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)