hey i am using https://github.com/Bitcoin-ABC/bitcoin-abc and trying to get bch adress form ecdsa public key.
I have this compressed public key:
publickKey = "02c0fe3501b514b1b2136b4d923de0907314a7c92499fd29a0cb7cf9f731711a19"
This is its bitcoin address: "39n8cpkeHhJDzhTVkboagHMbr9WYSLv2Yk"
And according to https://cashaddr.bitcoincash.org/ this is its bitcoin-cash address: "bitcoincash:ppvt3t9zkp3flgvgunp0wpp6l9t9tc85kvhtg5zkvr"
i tried to get the bch address like this:
const auto netParams = bCreateChainParams(bCBaseChainParams::MAIN);
CTxDestination dst = CKeyID(uint160S(publickKey));
std::string encoded = EncodeCashAddr(dst, *netParams);
and i get different bitcoincash address (and not the one above)
i also tried:
std::vector<uint8_t> hashVector = std::vector<uint8_t>(uncompressKey(publickKey));
bCashAddrContent keyContent{PUBKEY_TYPE, hashVector};
string encoded = EncodeCashAddr("bitcoincash", keyContent);
when uncompressKey function uncompressing the ecdsa key and removes the headres from it.
i also tried with SCRIPT_TYPE instead of PUBKEY_TYPE, yet i dont get the right address....
i also cant find any example code
any idea?