0
I've got this weird string for a utx message (not my code)
CTransaction(nVersion=1 vin=[CTxIn(prevout=COutPoint(hash=41caa5bf2b814135257b26e44b111f55c067f783e3cdf9bdf914e1ef7e403d05 n=0) scriptSig=47304402200910d62908c2f386008d024c3622cae2440338ea2f65ff970c6c4140704dadc20220636e346e716b93348aab1d01893379f21e7798870dd75d566d217784ea9e0925012103e7670f57af2bd9f601f32ea5b701140e478f0f3e06a1d23e47fc4af9d1965ae2 nSequence=4294967295), CTxIn(prevout=COutPoint(hash=e87b3bb5fd83baad8cfd621ab715b21daf44bbc6165b645f9fa1730d457623b0 n=1) scriptSig=483045022100e6429685c5a935c69659af47d2487f9252724b730eee087f75c81083ca3390860220653e3f0b53c9750c3c22d46ba0d7822e0a9661d717279ccddbfb94dfad10f330012102689f559da51e353cc1d34bd1436560b92a179646e5c5e2ae7dddf116a56656a0 nSequence=4294967295)] vout=[CTxOut(nValue=0.00061000 scriptPubKey=76a91497176e06ed3ebb9fc46d983f7e976046246b8eb388ac), CTxOut(nValue=0.03000000 scriptPubKey=76a9145414feb353a36043f5257366479389263b0cba5988ac)] nLockTime=0)
In each vout there is scriptPubKey that looks like a hex.
How to I use this information to get each vouts scriptPubKey.asm and scriptPubKey.hex
The code that produced this string is python but I could also manipulate this data in javascript! I'm stuck on first why does the scriptPubKey(s) look like this in the first place and second what do I do to get the asm and hex information
I found https://github.com/bitcoin/bitcoin/blob/master/src/rpc/rawtransaction.cpp
void ScriptPubKeyToJSON(const CScript& scriptPubKey, UniValue& out, bool fIncludeHex)
{
txnouttype type;
vector<CTxDestination> addresses;
int nRequired;
out.push_back(Pair("asm", ScriptToAsmStr(scriptPubKey)));
if (fIncludeHex)
out.push_back(Pair("hex", HexStr(scriptPubKey.begin(), scriptPubKey.end())));
if (!ExtractDestinations(scriptPubKey, type, addresses, nRequired)) {
out.push_back(Pair("type", GetTxnOutputType(type)));
return;
}
out.push_back(Pair("reqSigs", nRequired));
out.push_back(Pair("type", GetTxnOutputType(type)));
UniValue a(UniValue::VARR);
BOOST_FOREACH(const CTxDestination& addr, addresses)
a.push_back(CBitcoinAddress(addr).ToString());
out.push_back(Pair("addresses", a));
}
Which looks like its doing the action I require (but I don't understand the code / what's happening)