Skip to content

Copy utilized elliptic & bn.js external packages into bitcore-common#4179

Open
MichaelAJay wants to merge 28 commits into
bitpay:masterfrom
MichaelAJay:rm-elliptic-bitcore-lib
Open

Copy utilized elliptic & bn.js external packages into bitcore-common#4179
MichaelAJay wants to merge 28 commits into
bitpay:masterfrom
MichaelAJay:rm-elliptic-bitcore-lib

Conversation

@MichaelAJay
Copy link
Copy Markdown
Contributor

Description

Creates bitcore-common package with elliptic & bn.js internal implementations. Switches elliptic/bn.js usage in bitcore-lib to bitcore-common implementations, and fixes direct accessor issues in bitcore-lib. All tests pass.

Performance evaluation availabe and pertinent to direct accessor fix

Changelog

  • Create bitcore-common package and implement required functionality from elliptic & bn.js -- NOTE: currently uses ES6 export/import
  • bitcore-common test (bn, curve - base, secp256k1, short, point, jpoint, arith-paths, endomorphic edge cases)
  • remove elliptic & bn.js from bitcore-lib, add bitcore-common to bitcore-lib
  • replace external bn.js import in bitcore-lib/lib/crypto/bn.js with bitcore-common implementation
  • replace external elliptic import in bitcore-lib/lib/crypto/point.js with bitcore-common implementation
  • Replace all direct point component access in bitcore-lib with getter usage - crypto/schnorr.js, privatekey.js, publickey.js, test/publickey.js
  • Performance differences are not notable, with the exception of ECDSA recovery, which saw a 14% performance regression and high variability. Could be because of ES export/import change.

Testing Notes

All bitcore-lib tests Node tests pass.


Checklist

  • I have read CONTRIBUTING.md and verified that this PR follows the guidelines and requirements outlined in it.

commit ffe67ded4e6eda7c3ddcc8a84481ceeafdf250c3
Author: Michael Jay <mjay@bitpay.com>
Date:   Mon Jun 1 14:11:44 2026 -0400

    prototype cleanup (bitcore-lib Point implementation)

commit 2973b76649e918d4b218786cb11ccbaf9f8cc8ef
Author: Michael Jay <mjay@bitpay.com>
Date:   Mon Jun 1 14:08:47 2026 -0400

    import bitcore-common (also includes tmp scripts to remove)

commit 6f15618dd30b48f0af6614652e3f04a583d34f64
Author: Michael Jay <mjay@bitpay.com>
Date:   Mon Jun 1 14:07:08 2026 -0400

    bitcore-common cleanup

commit 70b73d5fb86d55526fa274df8f4906eb6addad24
Merge: 6b22fed03 ef22f5762
Author: Michael Jay <mjay@bitpay.com>
Date:   Mon Jun 1 12:50:00 2026 -0400

    Merge commit 'ef22f57626b359ee5da57cea4615a5e5a3622ef5' into tmp-perf-checking

commit 6b22fed0395f4a4fcec1cc752ba259fe02388e18
Author: Michael Jay <mjay@bitpay.com>
Date:   Mon Jun 1 12:17:45 2026 -0400

    add precomputed values in curve setup

commit fc20f537289072a0f44e6561cb24d177b249ae8d
Author: Michael Jay <mjay@bitpay.com>
Date:   Fri May 29 16:51:05 2026 -0400

    fix: change all Point direct accessors (.x/.y) with get accessors (getX(), getY())

commit ef22f57626b359ee5da57cea4615a5e5a3622ef5
Author: Michael Jay <mjay@bitpay.com>
Date:   Fri May 29 12:43:28 2026 -0400

    replace elliptic & bn.js dependencies with internal bitcore-common implementations

commit 47677b60f26fad33d904ec8bf9dd07f74759f1f4
Author: Michael Jay <mjay@bitpay.com>
Date:   Tue May 26 11:17:00 2026 -0400

    clean up weird edit artifact

commit bdb4843ffd5172f575310c24ec1fb36617d9410a
Author: Michael Jay <mjay@bitpay.com>
Date:   Tue May 26 10:14:21 2026 -0400

    skip test (add comments) for elliptic divergence

commit 9f92c85323e7ca59116f17a3a075a94c2a03df95
Author: Michael Jay <mjay@bitpay.com>
Date:   Mon May 25 22:03:41 2026 -0400

    consolidate endomorphic edge case tests

commit 959237ddfa465c1cdc8307e315161169e5d6fef5
Author: Michael Jay <mjay@bitpay.com>
Date:   Mon May 25 22:01:48 2026 -0400

    endomorphic edge case test implementation - preconsolidation

commit fbbd7fd0d4600e34c395e708c11c689d308981dc
Author: Michael Jay <mjay@bitpay.com>
Date:   Mon May 25 21:29:55 2026 -0400

    internal arithmetic test impelemtnation

commit 59ba0b37e90778a82690c3dd6320c5c806d7cc4d
Author: Michael Jay <mjay@bitpay.com>
Date:   Mon May 25 20:33:47 2026 -0400

    implement jacobian point tests

commit ad265de62f34481eabb8927544de6bbae5d4f753
Author: Michael Jay <mjay@bitpay.com>
Date:   Mon May 25 16:52:43 2026 -0400

    implement curve/point tests

commit ff2193d5237c60a62d4562e6f11cee3fab9f65d2
Author: Michael Jay <mjay@bitpay.com>
Date:   Mon May 25 14:24:18 2026 -0400

    implement base curve tests

commit e86ac6d335d25b8e3dec1a1af606a9af472e0d01
Author: Michael Jay <mjay@bitpay.com>
Date:   Mon May 25 12:30:44 2026 -0400

    Get hexToArray in parity w/ elliptic

commit 86ecf36c9486cdab0eb81275d5e6c2742796ef3a
Author: Michael Jay <mjay@bitpay.com>
Date:   Mon May 25 12:00:18 2026 -0400

    remove redundant tests and fix failing JPoint test

commit ff47a41ee9afbe403d0805581244ed9dacb74888
Author: Michael Jay <mjay@bitpay.com>
Date:   Mon May 25 11:58:57 2026 -0400

    fix tmp test script

commit 1bbde1952d58d99758bfd8a6faa6fbf3177ff617
Author: Michael Jay <mjay@bitpay.com>
Date:   Mon May 25 10:58:04 2026 -0400

    implement short weierstrass curve operation tests

commit 04e2842f804932da60547c32a5f95cfefa46c5c4
Author: Michael Jay <mjay@bitpay.com>
Date:   Fri May 22 15:24:07 2026 -0400

    implement secp256k1 tests

commit 6ce57fb18d4cf1eb061768c69baf1ffeef406ecb
Author: Michael Jay <mjay@bitpay.com>
Date:   Fri May 22 10:28:05 2026 -0400

    implement point tests

commit a2cb94c526108c08fcbd083eebbcb732f9d3a6e9
Author: Michael Jay <mjay@bitpay.com>
Date:   Thu May 21 17:48:30 2026 -0400

    Merge branch 'bn-test-fixes'

commit 7fbcbfa141079b141a0987fafdb0d809fd6e1d57
Author: Michael Jay <mjay@bitpay.com>
Date:   Thu May 21 15:16:27 2026 -0400

    rename index test file

commit ffadd21850a17a95d2443cb475a1a5351a2ee609
Author: Michael Jay <mjay@bitpay.com>
Date:   Wed May 20 19:56:15 2026 -0400

    test init
…e decodePoint does not validate curve membership for input
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant