|
|
@ -85,65 +85,6 @@ void ScriptPubKeyToJSON(const CScript& scriptPubKey, UniValue& out, bool fInclud |
|
|
|
out.push_back(Pair("addresses", a)); |
|
|
|
} |
|
|
|
|
|
|
|
UniValue TxJoinSplitToJSON(const CTransaction& tx) { |
|
|
|
bool useGroth = tx.fOverwintered && tx.nVersion >= SAPLING_TX_VERSION; |
|
|
|
UniValue vjoinsplit(UniValue::VARR); |
|
|
|
for (unsigned int i = 0; i < tx.vjoinsplit.size(); i++) { |
|
|
|
const JSDescription& jsdescription = tx.vjoinsplit[i]; |
|
|
|
UniValue joinsplit(UniValue::VOBJ); |
|
|
|
|
|
|
|
joinsplit.push_back(Pair("vpub_old", ValueFromAmount(jsdescription.vpub_old))); |
|
|
|
joinsplit.push_back(Pair("vpub_oldZat", jsdescription.vpub_old)); |
|
|
|
joinsplit.push_back(Pair("vpub_new", ValueFromAmount(jsdescription.vpub_new))); |
|
|
|
joinsplit.push_back(Pair("vpub_newZat", jsdescription.vpub_new)); |
|
|
|
|
|
|
|
joinsplit.push_back(Pair("anchor", jsdescription.anchor.GetHex())); |
|
|
|
|
|
|
|
{ |
|
|
|
UniValue nullifiers(UniValue::VARR); |
|
|
|
BOOST_FOREACH(const uint256 nf, jsdescription.nullifiers) { |
|
|
|
nullifiers.push_back(nf.GetHex()); |
|
|
|
} |
|
|
|
joinsplit.push_back(Pair("nullifiers", nullifiers)); |
|
|
|
} |
|
|
|
|
|
|
|
{ |
|
|
|
UniValue commitments(UniValue::VARR); |
|
|
|
BOOST_FOREACH(const uint256 commitment, jsdescription.commitments) { |
|
|
|
commitments.push_back(commitment.GetHex()); |
|
|
|
} |
|
|
|
joinsplit.push_back(Pair("commitments", commitments)); |
|
|
|
} |
|
|
|
|
|
|
|
joinsplit.push_back(Pair("onetimePubKey", jsdescription.ephemeralKey.GetHex())); |
|
|
|
joinsplit.push_back(Pair("randomSeed", jsdescription.randomSeed.GetHex())); |
|
|
|
|
|
|
|
{ |
|
|
|
UniValue macs(UniValue::VARR); |
|
|
|
BOOST_FOREACH(const uint256 mac, jsdescription.macs) { |
|
|
|
macs.push_back(mac.GetHex()); |
|
|
|
} |
|
|
|
joinsplit.push_back(Pair("macs", macs)); |
|
|
|
} |
|
|
|
|
|
|
|
CDataStream ssProof(SER_NETWORK, PROTOCOL_VERSION); |
|
|
|
auto ps = SproutProofSerializer<CDataStream>(ssProof, useGroth); |
|
|
|
boost::apply_visitor(ps, jsdescription.proof); |
|
|
|
joinsplit.push_back(Pair("proof", HexStr(ssProof.begin(), ssProof.end()))); |
|
|
|
|
|
|
|
{ |
|
|
|
UniValue ciphertexts(UniValue::VARR); |
|
|
|
for (const ZCNoteEncryption::Ciphertext ct : jsdescription.ciphertexts) { |
|
|
|
ciphertexts.push_back(HexStr(ct.begin(), ct.end())); |
|
|
|
} |
|
|
|
joinsplit.push_back(Pair("ciphertexts", ciphertexts)); |
|
|
|
} |
|
|
|
|
|
|
|
vjoinsplit.push_back(joinsplit); |
|
|
|
} |
|
|
|
return vjoinsplit; |
|
|
|
} |
|
|
|
|
|
|
|
uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue,int32_t tipheight); |
|
|
|
|
|
|
|
UniValue TxShieldedSpendsToJSON(const CTransaction& tx) { |
|
|
@ -309,9 +250,6 @@ void TxToJSONExpanded(const CTransaction& tx, const uint256 hashBlock, UniValue& |
|
|
|
} |
|
|
|
entry.push_back(Pair("vout", vout)); |
|
|
|
|
|
|
|
UniValue vjoinsplit = TxJoinSplitToJSON(tx); |
|
|
|
entry.push_back(Pair("vjoinsplit", vjoinsplit)); |
|
|
|
|
|
|
|
if (tx.fOverwintered && tx.nVersion >= SAPLING_TX_VERSION) { |
|
|
|
entry.push_back(Pair("valueBalance", ValueFromAmount(tx.valueBalance))); |
|
|
|
UniValue vspenddesc = TxShieldedSpendsToJSON(tx); |
|
|
@ -393,9 +331,6 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry) |
|
|
|
} |
|
|
|
entry.push_back(Pair("vout", vout)); |
|
|
|
|
|
|
|
UniValue vjoinsplit = TxJoinSplitToJSON(tx); |
|
|
|
entry.push_back(Pair("vjoinsplit", vjoinsplit)); |
|
|
|
|
|
|
|
if (tx.fOverwintered && tx.nVersion >= SAPLING_TX_VERSION) { |
|
|
|
entry.push_back(Pair("valueBalance", ValueFromAmount(tx.valueBalance))); |
|
|
|
UniValue vspenddesc = TxShieldedSpendsToJSON(tx); |
|
|
@ -481,33 +416,6 @@ UniValue getrawtransaction(const UniValue& params, bool fHelp, const CPubKey& my |
|
|
|
" }\n" |
|
|
|
" ,...\n" |
|
|
|
" ],\n" |
|
|
|
" \"vjoinsplit\" : [ (array of json objects, only for version >= 2)\n" |
|
|
|
" {\n" |
|
|
|
" \"vpub_old\" : x.xxx, (numeric) public input value\n" |
|
|
|
" \"vpub_new\" : x.xxx, (numeric) public output value\n" |
|
|
|
" \"anchor\" : \"hex\", (string) the anchor\n" |
|
|
|
" \"nullifiers\" : [ (json array of string)\n" |
|
|
|
" \"hex\" (string) input note nullifier\n" |
|
|
|
" ,...\n" |
|
|
|
" ],\n" |
|
|
|
" \"commitments\" : [ (json array of string)\n" |
|
|
|
" \"hex\" (string) output note commitment\n" |
|
|
|
" ,...\n" |
|
|
|
" ],\n" |
|
|
|
" \"onetimePubKey\" : \"hex\", (string) the onetime public key used to encrypt the ciphertexts\n" |
|
|
|
" \"randomSeed\" : \"hex\", (string) the random seed\n" |
|
|
|
" \"macs\" : [ (json array of string)\n" |
|
|
|
" \"hex\" (string) input note MAC\n" |
|
|
|
" ,...\n" |
|
|
|
" ],\n" |
|
|
|
" \"proof\" : \"hex\", (string) the zero-knowledge proof\n" |
|
|
|
" \"ciphertexts\" : [ (json array of string)\n" |
|
|
|
" \"hex\" (string) output note ciphertext\n" |
|
|
|
" ,...\n" |
|
|
|
" ]\n" |
|
|
|
" }\n" |
|
|
|
" ,...\n" |
|
|
|
" ],\n" |
|
|
|
" \"blockhash\" : \"hash\", (string) the block hash\n" |
|
|
|
" \"confirmations\" : n, (numeric) The number of notarized DPoW confirmations\n" |
|
|
|
" \"rawconfirmations\" : n, (numeric) The number of raw confirmations\n" |
|
|
@ -936,33 +844,6 @@ UniValue decoderawtransaction(const UniValue& params, bool fHelp, const CPubKey& |
|
|
|
" }\n" |
|
|
|
" ,...\n" |
|
|
|
" ],\n" |
|
|
|
" \"vjoinsplit\" : [ (array of json objects, only for version >= 2)\n" |
|
|
|
" {\n" |
|
|
|
" \"vpub_old\" : x.xxx, (numeric) public input value in HUSH\n" |
|
|
|
" \"vpub_new\" : x.xxx, (numeric) public output value in HUSH\n" |
|
|
|
" \"anchor\" : \"hex\", (string) the anchor\n" |
|
|
|
" \"nullifiers\" : [ (json array of string)\n" |
|
|
|
" \"hex\" (string) input note nullifier\n" |
|
|
|
" ,...\n" |
|
|
|
" ],\n" |
|
|
|
" \"commitments\" : [ (json array of string)\n" |
|
|
|
" \"hex\" (string) output note commitment\n" |
|
|
|
" ,...\n" |
|
|
|
" ],\n" |
|
|
|
" \"onetimePubKey\" : \"hex\", (string) the onetime public key used to encrypt the ciphertexts\n" |
|
|
|
" \"randomSeed\" : \"hex\", (string) the random seed\n" |
|
|
|
" \"macs\" : [ (json array of string)\n" |
|
|
|
" \"hex\" (string) input note MAC\n" |
|
|
|
" ,...\n" |
|
|
|
" ],\n" |
|
|
|
" \"proof\" : \"hex\", (string) the zero-knowledge proof\n" |
|
|
|
" \"ciphertexts\" : [ (json array of string)\n" |
|
|
|
" \"hex\" (string) output note ciphertext\n" |
|
|
|
" ,...\n" |
|
|
|
" ]\n" |
|
|
|
" }\n" |
|
|
|
" ,...\n" |
|
|
|
" ],\n" |
|
|
|
"}\n" |
|
|
|
|
|
|
|
"\nExamples:\n" |
|
|
|