Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

Conflict between bitcore-lib and bitcore-lib-cash #192

Open
arrix opened this issue Jan 17, 2018 · 1 comment
Open

Conflict between bitcore-lib and bitcore-lib-cash #192

arrix opened this issue Jan 17, 2018 · 1 comment

Comments

@arrix
Copy link

arrix commented Jan 17, 2018

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

@mohammadrafigh
Copy link

#238 fixes this

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

2 participants