const std::string master_chain_code = "xpub68xePK7VvVcVQikShVGveYd8c7eTsU8VW2RmjVpfLuPn2v188qBeT9hhXTsDi3qrTQMj6uuvwMm4jtm6WiySEpSoF54fEaSmqs1mxP3v6W7";
std::string get_address(uint32_t user_id, uint32_t chain_index)
{
bc::wallet::hd_public master(master_chain_code,
bc::wallet::hd_public::mainnet);
auto user_chain = master.derive_public(user_id);
auto key_chain = user_chain.derive_public(chain_index);
bc::wallet::ec_public public_key(key_chain.point());
auto payaddr = public_key.to_payment_address();
return payaddr.encoded();
}
Am I doing this right?