| 2699 | // ELEMENTS: |
| 2700 | |
| 2701 | static RPCHelpMan rawblindrawtransaction() |
| 2702 | { |
| 2703 | return RPCHelpMan{"rawblindrawtransaction", |
| 2704 | "\nConvert one or more outputs of a raw transaction into confidential ones.\n" |
| 2705 | "Returns the hex-encoded raw transaction.\n" |
| 2706 | "The input raw transaction cannot have already-blinded outputs.\n" |
| 2707 | "The output keys used can be specified by using a confidential address in createrawtransaction.\n" |
| 2708 | "If an additional blinded output is required to make a balanced blinding, a 0-value unspendable output will be added. Since there is no access to the wallet the blinding pubkey from the last output with blinding key will be repeated.\n" |
| 2709 | "You can not blind issuances with this call.\n", |
| 2710 | { |
| 2711 | {"hexstring", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "A hex-encoded raw transaction."}, |
| 2712 | {"inputamountblinders", RPCArg::Type::ARR, RPCArg::Optional::NO, "An array with one entry per transaction input.", |
| 2713 | { |
| 2714 | {"inputamountblinder", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "A hex-encoded blinding factor, one for each input." |
| 2715 | " Blinding factors can be found in the \"blinder\" output of listunspent."}, |
| 2716 | } |
| 2717 | }, |
| 2718 | {"inputamounts", RPCArg::Type::ARR, RPCArg::Optional::NO, "An array with one entry per transaction input.", |
| 2719 | { |
| 2720 | {"inputamount", RPCArg::Type::AMOUNT, RPCArg::Optional::NO, "An amount for each input."}, |
| 2721 | } |
| 2722 | }, |
| 2723 | {"inputassets", RPCArg::Type::ARR, RPCArg::Optional::NO, "An array with one entry per transaction input.", |
| 2724 | { |
| 2725 | {"inputasset", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "A hex-encoded asset id, one for each input."}, |
| 2726 | } |
| 2727 | }, |
| 2728 | {"inputassetblinders", RPCArg::Type::ARR, RPCArg::Optional::NO, "An array with one entry per transaction input.", |
| 2729 | { |
| 2730 | {"inputassetblinder", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "A hex-encoded asset blinding factor, one for each input."}, |
| 2731 | } |
| 2732 | }, |
| 2733 | {"totalblinder", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "Ignored for now."}, |
| 2734 | {"ignoreblindfail", RPCArg::Type::BOOL, RPCArg::Default{true}, "Return a transaction even when a blinding attempt fails due to number of blinded inputs/outputs."}, |
| 2735 | }, |
| 2736 | RPCResult{ |
| 2737 | RPCResult::Type::STR, "transaction", "hex string of the transaction" |
| 2738 | }, |
| 2739 | RPCExamples{""}, |
| 2740 | [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue |
| 2741 | { |
| 2742 | NodeContext& node = EnsureAnyNodeContext(request.context); |
| 2743 | ChainstateManager& chainman = EnsureChainman(node); |
| 2744 | std::vector<unsigned char> txData(ParseHexV(request.params[0], "argument 1")); |
| 2745 | CDataStream ssData(txData, SER_NETWORK, PROTOCOL_VERSION); |
| 2746 | CMutableTransaction tx; |
| 2747 | try { |
| 2748 | ssData >> tx; |
| 2749 | } catch (const std::exception &) { |
| 2750 | throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed"); |
| 2751 | } |
| 2752 | |
| 2753 | UniValue inputBlinds = request.params[1].get_array(); |
| 2754 | UniValue inputAmounts = request.params[2].get_array(); |
| 2755 | UniValue inputAssets = request.params[3].get_array(); |
| 2756 | UniValue inputAssetBlinds = request.params[4].get_array(); |
| 2757 | |
| 2758 | bool fIgnoreBlindFail = true; |
nothing calls this directly
no test coverage detected