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

Function signrawtransactionwithwallet

src/wallet/rpc/spend.cpp:846–944  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

844}
845
846RPCHelpMan signrawtransactionwithwallet()
847{
848 return RPCHelpMan{"signrawtransactionwithwallet",
849 "\nSign inputs for raw transaction (serialized, hex-encoded).\n"
850 "The second optional argument (may be null) is an array of previous transaction outputs that\n"
851 "this transaction depends on but may not yet be in the block chain." +
852 HELP_REQUIRING_PASSPHRASE,
853 {
854 {"hexstring", RPCArg::Type::STR, RPCArg::Optional::NO, "The transaction hex string"},
855 {"prevtxs", RPCArg::Type::ARR, RPCArg::Optional::OMITTED_NAMED_ARG, "The previous dependent transaction outputs",
856 {
857 {"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
858 {
859 {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id"},
860 {"vout", RPCArg::Type::NUM, RPCArg::Optional::NO, "The output number"},
861 {"scriptPubKey", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "script key"},
862 {"redeemScript", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "(required for P2SH) redeem script"},
863 {"witnessScript", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "(required for P2WSH or P2SH-P2WSH) witness script"},
864 {"amount", RPCArg::Type::AMOUNT, RPCArg::Optional::OMITTED, "The amount spent (required if non-confidential segwit output)"},
865 {"amountcommitment", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "The amount commitment spent (required if confidential segwit output)"},
866 },
867 },
868 },
869 },
870 {"sighashtype", RPCArg::Type::STR, RPCArg::Default{"DEFAULT for Taproot, ALL otherwise"}, "The signature hash type. Must be one of\n"
871 " \"DEFAULT\"\n"
872 " \"ALL\"\n"
873 " \"NONE\"\n"
874 " \"SINGLE\"\n"
875 " \"ALL|ANYONECANPAY\"\n"
876 " \"NONE|ANYONECANPAY\"\n"
877 " \"SINGLE|ANYONECANPAY\""},
878 },
879 RPCResult{
880 RPCResult::Type::OBJ, "", "",
881 {
882 {RPCResult::Type::STR_HEX, "hex", "The hex-encoded raw transaction with signature(s)"},
883 {RPCResult::Type::BOOL, "complete", "If the transaction has a complete set of signatures"},
884 {RPCResult::Type::ARR, "errors", /*optional=*/true, "Script verification errors (if there are any)",
885 {
886 {RPCResult::Type::OBJ, "", "",
887 {
888 {RPCResult::Type::STR_HEX, "txid", "The hash of the referenced, previous transaction"},
889 {RPCResult::Type::NUM, "vout", "The index of the output to spent and used as input"},
890 {RPCResult::Type::ARR, "witness", "",
891 {
892 {RPCResult::Type::STR_HEX, "witness", ""},
893 }},
894 {RPCResult::Type::STR_HEX, "scriptSig", "The hex-encoded signature script"},
895 {RPCResult::Type::NUM, "sequence", "Script sequence number"},
896 {RPCResult::Type::STR, "error", "Verification or signing error related to the input"},
897 }},
898 }},
899 {RPCResult::Type::STR, "warning", "Warning that a peg-in input signed may be immature. This could mean lack of connectivity to or misconfiguration of the daemon."},
900 }
901 },
902 RPCExamples{
903 HelpExampleCli("signrawtransactionwithwallet", "\"myhex\"")

Callers 1

claimpeginFunction · 0.85

Calls 14

HelpExampleCliFunction · 0.85
HelpExampleRpcFunction · 0.85
RPCTypeCheckFunction · 0.85
DecodeHexTxFunction · 0.85
JSONRPCErrorFunction · 0.85
EnsureWalletIsUnlockedFunction · 0.85
ParsePrevoutsFunction · 0.85
ParseSighashStringFunction · 0.85
findCoinsMethod · 0.80

Tested by

no test coverage detected