bitcoin core – CScript to CPubKey or derive CPubKey from CScript
Please can somebody advise whether it is attainable to derive the CPubKey from a CSript object? Offered i get it up with an handle earlier than hand,
I can use quite a few features to achieve all the information from the CPubKey utilizing features, however are you able to make a CPubKey from a CSript?
Or are they an excessive amount of chalk and cheese?
Following the primary reply I’ve tried the beneath to no pleasure. The script returns completely empty:
CScript scriptPubKey1; CBitcoinAddress handle("L4VPgtoBtuxsYMgyrRvQRadSV1Y139TDfd"); scriptPubKey1.SetDestination(handle.Get()); CScript::const_iterator it = scriptPubKey1.start(); // or particularly, the placement of the pubkey within the CScript object opcodetype opcode; std::vector<unsigned char> knowledge; scriptPubKey1.GetOp(it, opcode, knowledge); // knowledge now comprises the byte vector CPubKey pubkey3 = CPubKey(knowledge);