Since they share several common addressing schemes, can I figure out in code how to send them to the right chain?
There are three partial remedies:
bech32addresses are invalid on BCH and BSV
CashAddris an alternative encoding (inspired by bech32) for
p2shaddresses that is only valid on BCH and BSV
- You can check whether the recipient address is subject to address reuse: if it was previously used on another network, you should request confirmation or another address from the recipient
Unfortunately, BSV and BCH share all address formats, so you cannot distinguish which network an address was generated for between the two.
Likewise, the original
p2sh addresses are valid on all three networks and there is no way to distinguish which network an address was intended for just from the address itself.