haveno-dex / haveno

Decentralized P2P exchange platform built on Monero and Tor
https://haveno.exchange
GNU Affero General Public License v3.0
992 stars 110 forks source link

Support Cash Address format for Bitcoin Cash #256

Open woodser opened 2 years ago

woodser commented 2 years ago

This issue requests supporting only CashAddr format for Bitcoin Cash instead of the legacy format used by BTC.

The ui test needs updated to use a CashAddr address, which starts with 'q'.

Rucknium commented 2 years ago

Right. CashAddr should be the default. See:

https://bitcoincashstandards.org/

It is possible that there are a small number of BCH wallet implementations out there that still use the legacy address format. As you probably know, legacy BCH addresses can be dangerous since users can accidentally send BCH to a BTC address, or BTC to a BCH legacy address.

woodser commented 2 years ago

Good point. We should only support CashAddr. I've updated the issue description.

manesioz commented 2 years ago

Hey, I'm super new to the codebase so I have a quick question: in the HavenoDaemon.test.ts file I don't see where exactly the CashAddr format would need to be supported... I can't see any address-specific handling anywhere.

I see the line let name = testAccount.currencyCode + " " + testAccount.address.substr(0, 8) + "... " + GenUtils.getUUID(); which deals with the various addresses but it doesn't seem to have any build-in logic for specific address types. Where should I be looking?

Edit: Or is this simply just replacing the templated address with a CashAddr format?

woodser commented 2 years ago

@manesioz Sorry for the delay.

HavenoDaemon.test.ts are front-end tests to test the system end-to-end

In the front-end, this line needs updated in order to test the new address format, and we should test that the legacy format is not accepted.

In the backend, we need to replace this validator which is for the legacy format.