MCPcopy Create free account
hub / github.com/ElementsProject/elements / unblindrawtransaction

Function unblindrawtransaction

src/wallet/rpc/elements.cpp:1304–1344  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1302}
1303
1304RPCHelpMan unblindrawtransaction()
1305{
1306 return RPCHelpMan{"unblindrawtransaction",
1307 "\nRecovers unblinded transaction outputs from blinded outputs and issuance inputs when possible using wallet's known blinding keys, and strips related witness data.\n",
1308 {
1309 {"hex", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The hex string of the raw transaction."},
1310 },
1311 RPCResult{
1312 RPCResult::Type::OBJ, "", "",
1313 {
1314 {RPCResult::Type::STR_HEX, "hex", "unblinded raw transaction"},
1315 }
1316 },
1317 RPCExamples{
1318 HelpExampleCli("unblindrawtransaction", "\"blindedtransactionhex\"")
1319 },
1320 [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
1321{
1322 std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
1323 if (!wallet) return NullUniValue;
1324 CWallet* const pwallet = wallet.get();
1325
1326 RPCTypeCheck(request.params, {UniValue::VSTR});
1327
1328 CMutableTransaction tx;
1329 if (!DecodeHexTx(tx, request.params[0].get_str()))
1330 throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed");
1331
1332 std::vector<uint256> output_value_blinds;
1333 std::vector<uint256> output_asset_blinds;
1334 std::vector<CPubKey> output_pubkeys;
1335 std::vector<CKey> asset_keys;
1336 std::vector<CKey> token_keys;
1337 FillBlinds(pwallet, tx, output_value_blinds, output_asset_blinds, output_pubkeys, asset_keys, token_keys);
1338
1339 UniValue result(UniValue::VOBJ);
1340 result.pushKV("hex", EncodeHexTx(CTransaction(tx)));
1341 return result;
1342},
1343 };
1344}
1345
1346static CTransactionRef SendGenerationTransaction(const CScript& asset_script, const CPubKey &asset_pubkey, const CScript& token_script, const CPubKey &token_pubkey, CAmount asset_amount, CAmount token_amount, IssuanceDetails* issuance_details, CWallet* pwallet)
1347{

Callers

nothing calls this directly

Calls 10

HelpExampleCliFunction · 0.85
RPCTypeCheckFunction · 0.85
DecodeHexTxFunction · 0.85
JSONRPCErrorFunction · 0.85
FillBlindsFunction · 0.85
EncodeHexTxFunction · 0.85
CTransactionClass · 0.50
getMethod · 0.45
pushKVMethod · 0.45

Tested by

no test coverage detected