Legacy Addresses
Closed this issue · 5 comments
I see Bitcoin cash has a new address format which has caused much confusion. It would be nice to still use legacy addresses as we move forward and transition into the future. On my platform for example, I will show the new address first, but give the customer the option of switching to legacy before I completely disable legacy.
Online Converter: https://cashaddr.bitcoincash.org/
New Address: bitcoincash:qp2kz4pd5q0u4tvafwhlgakkcceqdktteuee97aw2q
Legacy Address: moJQKtGF3nzhc4ssfdpgs2gexL9T2utRE4
We can merge this code in, it's just one JS file, and integrate a function to allow for easy conversions.
https://github.com/Ayms/cashaddress
I will get around to this sometime tonight or tomorrow. Posting it here first to see if anyone has any suggestions or objections (positive or negative) in regards to this. It would be an optional function, so I don't see how this could go wrong.
Looks like the function already exists?
translateAddress(address) {
In that case, nevermind! lol, I will test tonight to see if I get the appropriate output.
Hello, the translateAddress
was for the CoPay format.
I will need to update for the CashAddr format.
This is the regex i've been using meanwhile to check for the new format
const cashregex = /^((?:bitcoincash):)?(?:[023456789acdefghjklmnpqrstuvwxyz]){42}$/gi;
edit: the reasoning for just checking and not translating was because I was lazy and my node is running bitcoin ABC, so it can natively send the new CashAddr.
However, having it built into the library is a much better solution.
I also run a full Bitcoin ABC node and translateAddress worked perfectly! I am also accepting Litecoin and created an awesome code to handle receiving transactions no matter how many full nodes you are running on a single server. Maybe I put that code under the Wiki? and this post as well?
Seems like I can't add to Wiki, guess I have to be given permission? Never used it before, not sure how I write to Wiki.
Thanks for the access to the repo! I am going to fill up the Wiki with all sorts of useful codes so everyone can absorb the knowledge.