MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / signrawtransaction

Function signrawtransaction

src/rpc/rawtransaction.cpp:1002–1106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1000}
1001
1002UniValue signrawtransaction(const JSONRPCRequest& request)
1003{
1004#ifdef ENABLE_WALLET
1005 std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
1006 CWallet* const pwallet = wallet.get();
1007#endif
1008
1009 if (request.fHelp || request.params.size() < 1 || request.params.size() > 4)
1010 throw std::runtime_error(
1011 "signrawtransaction \"hexstring\" ( [{\"txid\":\"id\",\"vout\":n,\"scriptPubKey\":\"hex\",\"redeemScript\":\"hex\"},...] [\"privatekey1\",...] sighashtype )\n"
1012 "\nDEPRECATED. Sign inputs for raw transaction (serialized, hex-encoded).\n"
1013 "The second optional argument (may be null) is an array of previous transaction outputs that\n"
1014 "this transaction depends on but may not yet be in the block chain.\n"
1015 "The third optional argument (may be null) is an array of base58-encoded private\n"
1016 "keys that, if given, will be the only keys used to sign the transaction.\n"
1017#ifdef ENABLE_WALLET
1018 + HelpRequiringPassphrase(pwallet) + "\n"
1019#endif
1020 "\nArguments:\n"
1021 "1. \"hexstring\" (string, required) The transaction hex string\n"
1022 "2. \"prevtxs\" (string, optional) An json array of previous dependent transaction outputs\n"
1023 " [ (json array of json objects, or 'null' if none provided)\n"
1024 " {\n"
1025 " \"txid\":\"id\", (string, required) The transaction id\n"
1026 " \"vout\":n, (numeric, required) The output number\n"
1027 " \"scriptPubKey\": \"hex\", (string, required) script key\n"
1028 " \"redeemScript\": \"hex\", (string, required for P2SH or P2WSH) redeem script\n"
1029 " \"amount\": value (numeric, required) The amount spent\n"
1030 " }\n"
1031 " ,...\n"
1032 " ]\n"
1033 "3. \"privkeys\" (string, optional) A json array of base58-encoded private keys for signing\n"
1034 " [ (json array of strings, or 'null' if none provided)\n"
1035 " \"privatekey\" (string) private key in base58-encoding\n"
1036 " ,...\n"
1037 " ]\n"
1038 "4. \"sighashtype\" (string, optional, default=ALL) The signature hash type. Must be one of\n"
1039 " \"ALL\"\n"
1040 " \"NONE\"\n"
1041 " \"SINGLE\"\n"
1042 " \"ALL|ANYONECANPAY\"\n"
1043 " \"ALL|FORKID\"\n"
1044 " \"ALL|FORKID|ANYONECANPAY\"\n"
1045 " \"NONE|ANYONECANPAY\"\n"
1046 " \"NONE|FORKID\"\n"
1047 " \"NONE|FORKID|ANYONECANPAY\"\n"
1048 " \"SINGLE|ANYONECANPAY\"\n"
1049 " \"SINGLE|FORKID\"\n"
1050 " \"SINGLE|FORKID|ANYONECANPAY\"\n"
1051
1052 "\nResult:\n"
1053 "{\n"
1054 " \"hex\" : \"value\", (string) The hex-encoded raw transaction with signature(s)\n"
1055 " \"complete\" : true|false, (boolean) If the transaction has a complete set of signatures\n"
1056 " \"errors\" : [ (json array of objects) Script verification errors (if there are any)\n"
1057 " {\n"
1058 " \"txid\" : \"hash\", (string) The hash of the referenced, previous transaction\n"
1059 " \"vout\" : n, (numeric) The index of the output to spent and used as input\n"

Callers

nothing calls this directly

Calls 14

HelpRequiringPassphraseFunction · 0.85
HelpExampleCliFunction · 0.85
HelpExampleRpcFunction · 0.85
IsDeprecatedRPCEnabledFunction · 0.85
JSONRPCErrorFunction · 0.85
RPCTypeCheckFunction · 0.85
getMethod · 0.80
setArrayMethod · 0.80
isNullMethod · 0.80

Tested by

no test coverage detected