Page MenuHomePhabricator

[Cashtab] [BCH deprecation] Pt 1/2 - Implement local toHash160 logic
ClosedPublic

Authored by emack on Oct 30 2022, 04:47.

Details

Summary

T2730

As a prerequisite to deprecating BCH.Address.toHash160(), this diff implements a local swiss army knife version of toHash160() that converts ecash, etoken, bitcoincash and simpleledger addresses to hash160.

Relies on the bs58 library (6KB).

Test Plan
  • npm install or npm i bs58
  • npm test and ensure all toHash160 unit tests pass
  • npm start
  • send a private message to another address and observe the 'getRecipientPublicKey(): recipientAddressHash160 matches localRecipientAddressHash160' console log message
  • create a new wallet and observe the 'deriveAccount(): hash160 matches localhash160' console log message'
  • send a private message using the new wallet and observe the 'getRecipientPublicKey(): recipientAddressHash160 matches localRecipientAddressHash160' console log message

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

emack requested review of this revision.Oct 30 2022, 04:47
emack updated this revision to Diff 36075.

updated package.json

Removed redundant validation

bytesofman added inline comments.
web/cashtab/src/utils/cashMethods.js
876 ↗(On Diff #36076)

Is this based off a reference function from bch-js? If so, please link

This revision is now accepted and ready to land.Oct 31 2022, 16:38
emack marked an inline comment as done.Nov 1 2022, 02:54
emack added inline comments.
web/cashtab/src/utils/cashMethods.js
876 ↗(On Diff #36076)

no not based off the bch-js function, this is just the standard approach outlined in the bs58 library readme https://www.npmjs.com/package/bs58

This revision was automatically updated to reflect the committed changes.
emack marked an inline comment as done.