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

Function signrawtransactionwithkey

src/rpc/rawtransaction.cpp:811–922  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

809}
810
811static RPCHelpMan signrawtransactionwithkey()
812{
813 return RPCHelpMan{"signrawtransactionwithkey",
814 "\nSign inputs for raw transaction (serialized, hex-encoded).\n"
815 "The second argument is an array of base58-encoded private\n"
816 "keys that will be the only keys used to sign the transaction.\n"
817 "The third optional argument (may be null) is an array of previous transaction outputs that\n"
818 "this transaction depends on but may not yet be in the block chain.\n",
819 {
820 {"hexstring", RPCArg::Type::STR, RPCArg::Optional::NO, "The transaction hex string"},
821 {"privkeys", RPCArg::Type::ARR, RPCArg::Optional::NO, "The base58-encoded private keys for signing",
822 {
823 {"privatekey", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "private key in base58-encoding"},
824 },
825 },
826 {"prevtxs", RPCArg::Type::ARR, RPCArg::Optional::OMITTED_NAMED_ARG, "The previous dependent transaction outputs",
827 {
828 {"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
829 {
830 {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id"},
831 {"vout", RPCArg::Type::NUM, RPCArg::Optional::NO, "The output number"},
832 {"scriptPubKey", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "script key"},
833 {"redeemScript", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "(required for P2SH) redeem script"},
834 {"witnessScript", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "(required for P2WSH or P2SH-P2WSH) witness script"},
835 {"amount", RPCArg::Type::AMOUNT, RPCArg::Optional::OMITTED, "The amount spent (required if non-confidential segwit output)"},
836 {"amountcommitment", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "The amount commitment spent (required if confidential segwit output)"},
837 },
838 },
839 },
840 },
841 {"sighashtype", RPCArg::Type::STR, RPCArg::Default{"DEFAULT for Taproot, ALL otherwise"}, "The signature hash type. Must be one of:\n"
842 " \"DEFAULT\"\n"
843 " \"ALL\"\n"
844 " \"NONE\"\n"
845 " \"SINGLE\"\n"
846 " \"ALL|ANYONECANPAY\"\n"
847 " \"NONE|ANYONECANPAY\"\n"
848 " \"SINGLE|ANYONECANPAY\"\n"
849 " \"ALL|RANGEPROOF\"\n"
850 " \"NONE|RANGEPROOF\"\n"
851 " \"SINGLE|RANGEPROOF\"\n"
852 " \"ALL|ANYONECANPAY|RANGEPROOF\"\n"
853 " \"NONE|ANYONECANPAY|RANGEPROOF\"\n"
854 " \"SINGLE|ANYONECANPAY|RANGEPROOF\"\n"
855 },
856 },
857 RPCResult{
858 RPCResult::Type::OBJ, "", "",
859 {
860 {RPCResult::Type::STR_HEX, "hex", "The hex-encoded raw transaction with signature(s)"},
861 {RPCResult::Type::BOOL, "complete", "If the transaction has a complete set of signatures"},
862 {RPCResult::Type::ARR, "errors", /*optional=*/true, "Script verification errors (if there are any)",
863 {
864 {RPCResult::Type::OBJ, "", "",
865 {
866 {RPCResult::Type::STR_HEX, "txid", "The hash of the referenced, previous transaction"},
867 {RPCResult::Type::NUM, "vout", "The index of the output to spent and used as input"},
868 {RPCResult::Type::ARR, "witness", "",

Callers

nothing calls this directly

Calls 13

HelpExampleCliFunction · 0.85
HelpExampleRpcFunction · 0.85
RPCTypeCheckFunction · 0.85
DecodeHexTxFunction · 0.85
JSONRPCErrorFunction · 0.85
DecodeSecretFunction · 0.85
FindCoinsFunction · 0.85
ParsePrevoutsFunction · 0.85
SignTransactionFunction · 0.70
sizeMethod · 0.45
IsValidMethod · 0.45
AddKeyMethod · 0.45

Tested by

no test coverage detected