Post
Topic
Board Development & Technical Discussion
Merits 4 from 3 users
Topic OP
ScriptHash to CKeyID
by
liorko87
on 24/05/2021, 09:47:34 UTC
⭐ Merited by NotATether (2) ,ETFbitcoin (1) ,Heisenberg_Hunter (1)
I have a valid base58 address that I got using getnewaddress command.
I'm trying to convert it to CKeyID object but I have some difficulties.

The problematic code:

Code:
string sKey = "my_address"; // it's not the real address
std::vector<unsigned char> prefix = std::vector<unsigned char>(1,5);
CTxDestination dest = ::DecodeAddressDestination(sKey, prefix);
CScript script = GetScriptForDestination(dest);
CKeyID key = CKeyID(script);

At the debugging I can see that dest value is ScriptHash
What I'm doing wrong?