new address format for FIRO and ZEC
FIRO and ZEC (and maybe more privacy coins) have added a new address format, which is not supported by mm2. Problem is that eg Binance switched to the new address format, so it is not possible any more to deposit ZEC and FIRO from mm2 to Binance the error when you try is
"error" : "rpc:182] dispatcher_legacy:140] dispatcher_legacy:150] utxo_withdraw:131] utxo_common:367] Invalid address: Cannot determine format: [\"invalid address\", \"bech32: missing human-readable separator, \\\"1\\\"\", \"cashaddress contains mixed upper and lowercase characters\"]"
found this in FIRO wallet code
base58Prefixes[PUBKEY_ADDRESS] = std::vector < unsigned char > (1, 82);
base58Prefixes[SCRIPT_ADDRESS] = std::vector < unsigned char > (1, 7);
base58Prefixes[EXCHANGE_PUBKEY_ADDRESS] = {0x01, 0xb9, 0xbb}; // EXX prefix for the address
the new address on Binance is eg EXXPmtE..., so that seems to be it
82 is the "old" format, as of coins file "pubtype": 82
same on ZEC, found this in wallet code
keyConstants.bech32mHRPs[TEX_ADDRESS] = "tex";
and the address on Binance is tex15s3...
saw that ZEC has "segwit": true set in coins file (FIRO does not)
but adding "bech32_hrp": "tex" does not help, error is then
"error" : "rpc:182] dispatcher_legacy:140] dispatcher_legacy:150] utxo_withdraw:131] utxo_common:367] Invalid address: Cannot determine format: [\"invalid address\", \"address variant/format Bech32m is not supported yet!\", \"Invalid base32 input string\"]"
so either the bech32 in the name of the variable in ZEC is BS and it's not bech32, or mm2 does not support bech32 for ZEC for some other reasons
so big question is: how can we support this?
here is the ZIP for ZEC: https://zips.z.cash/zip-0320
hi @cipig, I want to pick this one up. do you still have the testcases that failed with those Invalid address errors? would be helpful to have them handy so I can test against them while working on the fix, because I’m not really sure how to write proper testcases for zec yet 😅
@BigFish2086
there is one in the zip (tex1s2rt77ggv6q989lr49rkgzmh5slsksa9khdgte)
also the reference impl in the zip could help u with this feat https://zips.z.cash/zip-0320#reference-implementation