HomePhabricator

[Cashtab] [BCH Deprecation] [HD Node] Pt 1/3 - Implement separate masterHDNode…

Description

[Cashtab] [BCH Deprecation] [HD Node] Pt 1/3 - Implement separate masterHDNode creation logic

Summary:
T2730

This is part 1 of the 3 part diff to deprecate the use of BCH-JS' BCH.HDNode object for generating the masterHDNode and downstream parameters.

  • Pt 1/3 - Implement separate masterHDNode creation logic
  • Pt 2/3 - Localize downstream logic from masterHDNode (add and compare local outputs for fromSeed, derivePath, toPublicKey, toCashaddress & toWIF)
  • Pt 3/3 - Deprecate BCH.HDNode (fromSeed, derivePath, toPublicKey, toCashAddress & toWIF)

Relies on the bitcoincashjs-lib library (115KB) (bch fork of bitcoinjs-lib). I originally tried to implement this from the ground up but the end to end logic to generate masterHDNode involves ~15 separate libraries (ecurve, secp256k1, create-hash...etc) which wasn't a good ROI.
With bitcoincashjs-lib it at least enables us to continue with the BCH-JS (1.29MB) deprecation process and we can revisit when there's a better alternative.

Note: bitcoincashjs-lib and coininfo libs will also be used to deprecate BCH.TransactionBuilder() in an unrelated diff.

Test Plan:

  • npm install
  • npm test
  • npm start
  • create a new wallet and observe the 'getWalletDetails(): BCH-JS masterHDNode matches localMasterHDNode from bitcoincashjs-lib' console log message

Reviewers: bytesofman, #bitcoin_abc

Reviewed By: bytesofman, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D12414

Details

Provenance
emackAuthored on Nov 2 2022, 08:41
emackPushed on Nov 14 2022, 11:32
Reviewer
Restricted Project
Differential Revision
D12414: [Cashtab] [BCH Deprecation] [HD Node] Pt 1/3 - Implement separate masterHDNode creation logic
Parents
rABC45404d3317c7: [Automated] Update timing.json
Branches
Unknown
Tags
Unknown