bitcore-lib
bitcore-lib copied to clipboard
Conflict between bitcore-lib and bitcore-lib-cash
There is a conflict between the two libs when used together. I found a work around by chaining the require() order. But it's worth digging the root cause to ensure correctness.
// Error: Point does not lie on the curve
var bch = require('bitcore-lib-cash')
var bc = require('bitcore-lib')
(new bch.PrivateKey).toPublicKey()
(new bc.PrivateKey).toPublicKey()
Note that bitcore-lib-cash/lib/publickey.js called into bitcore-lib/lib/crypto/point.js.
Error: Point does not lie on the curve at Point.validate (/xxx/node_modules/bitcore-lib/lib/crypto/point.js:119:11) at new PublicKey (/xxx/node_modules/bitcore-lib-cash/lib/publickey.js:53:14) at Function.PublicKey.fromPrivateKey (/xxx/node_modules/bitcore-lib-cash/lib/publickey.js:221:10) at PrivateKey.toPublicKey (/xxx/node_modules/bitcore-lib-cash/lib/privatekey.js:362:30)
If bitcore-lib is required before bitcore-lib-cash, it seems to work.
// seems to work
var bc = require('bitcore-lib')
var bch = require('bitcore-lib-cash')
(new bch.PrivateKey).toAddress()
(new bc.PrivateKey).toAddress()
bitcore-lib 0.15.0 bitcore-lib-cash 0.16.1
#238 fixes this