Skip to content

Polyfill the other secp256k1 libs#367

Open
Duddino wants to merge 7 commits into
masterfrom
secp256k1
Open

Polyfill the other secp256k1 libs#367
Duddino wants to merge 7 commits into
masterfrom
secp256k1

Conversation

@Duddino
Copy link
Copy Markdown
Member

@Duddino Duddino commented May 13, 2024

Abstract

Through various dependencies we are currently using 3 different secp256k1 libraries.
The aim of this PR is to remove these dependencies in favor of @noble/secp256k1.

tiny-secp256k1

A noble based library was already developed by bitcoiner lab

secp256k1

A replacement for this library was developed in-house here.
The original tests are being used to test this version of the library.

Why switch to a single secp256k1?

Using a single library allows us to reduce the bundle size, and the potential vulnerabilities.
The other libraries have a larger amount of dependencies, like elliptic.js and bn.js, and as far as I can tell have not been audited.

This brings the main bundle size down from 361KB to 325 KB(gzipped)

Testing

  • Test that hd keys work as expected
  • Test transactions

When testing is done, secp256k1-noble will be released on npm (With a better name)

@netlify
Copy link
Copy Markdown

netlify Bot commented May 13, 2024

Deploy Preview for cheery-moxie-4f1121 ready!

Name Link
🔨 Latest commit 4fcc4e3
🔍 Latest deploy log https://app.netlify.com/sites/cheery-moxie-4f1121/deploys/6728b7e6f4b1c8000876745f
😎 Deploy Preview https://deploy-preview-367--cheery-moxie-4f1121.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@Duddino Duddino added the Performance An improvement and/or suggestion regarding performance label May 13, 2024
@Duddino Duddino self-assigned this May 13, 2024
Copy link
Copy Markdown
Member

@JSKitty JSKitty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting this error when attempting to create a new HD wallet:
image

Uncaught (in promise) TypeError: secp256k1.privateKeyVerify is not a function
    set hdkey.js:36
    fromMasterSeed hdkey.js:193
    HdMasterKey masterkey.js:114
    f parsed_secret.js:77

Copy link
Copy Markdown
Member

@JSKitty JSKitty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK a50d16d

Tested both Import and Creation of HD wallets.
Received from Shield, sent to self, then sent to an external wallet - no issues.
Generated many addresses, checked the xpub on the explorer.

A-OK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Performance An improvement and/or suggestion regarding performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants