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

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

@arrix

Description

@arrix

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions