Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcdump.cpp
Show First 20 Lines • Show All 95 Lines • ▼ Show 20 Lines | UniValue importprivkey(const Config &config, const JSONRPCRequest &request) { | ||||
CWallet *const pwallet = wallet.get(); | CWallet *const pwallet = wallet.get(); | ||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
if (request.fHelp || request.params.size() < 1 || | if (request.fHelp || request.params.size() < 1 || | ||||
request.params.size() > 3) { | request.params.size() > 3) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
"importprivkey \"privkey\" ( \"label\" ) ( rescan )\n" | RPCHelpMan{"importprivkey", | ||||
"\nAdds a private key (as returned by dumpprivkey) to your wallet. " | "\nAdds a private key (as returned by dumpprivkey) to " | ||||
"Requires a new wallet backup.\n" | "your wallet. Requires a new wallet backup.\n", | ||||
{ | |||||
{"privkey", RPCArg::Type::STR, false}, | |||||
{"label", RPCArg::Type::STR, true}, | |||||
{"rescan", RPCArg::Type::BOOL, true}, | |||||
}} | |||||
.ToString() + | |||||
"Hint: use importmulti to import more than one private key.\n" | "Hint: use importmulti to import more than one private key.\n" | ||||
"\nArguments:\n" | "\nArguments:\n" | ||||
"1. \"privkey\" (string, required) The private key (see " | "1. \"privkey\" (string, required) The private key (see " | ||||
"dumpprivkey)\n" | "dumpprivkey)\n" | ||||
"2. \"label\" (string, optional, default=\"\") An " | "2. \"label\" (string, optional, default=\"\") An " | ||||
"optional label\n" | "optional label\n" | ||||
"3. rescan (boolean, optional, default=true) Rescan " | "3. rescan (boolean, optional, default=true) Rescan " | ||||
"the wallet for transactions\n" | "the wallet for transactions\n" | ||||
▲ Show 20 Lines • Show All 95 Lines • ▼ Show 20 Lines | |||||
UniValue abortrescan(const Config &config, const JSONRPCRequest &request) { | UniValue abortrescan(const Config &config, const JSONRPCRequest &request) { | ||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | ||||
CWallet *const pwallet = wallet.get(); | CWallet *const pwallet = wallet.get(); | ||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
if (request.fHelp || request.params.size() > 0) { | if (request.fHelp || request.params.size() > 0) { | ||||
throw std::runtime_error("abortrescan\n" | throw std::runtime_error( | ||||
RPCHelpMan{"abortrescan", | |||||
"\nStops current wallet rescan triggered by " | "\nStops current wallet rescan triggered by " | ||||
"an RPC call, e.g. by an importprivkey call.\n" | "an RPC call, e.g. by an importprivkey call.\n", | ||||
{}} | |||||
.ToString() + | |||||
"\nExamples:\n" | "\nExamples:\n" | ||||
"\nImport a private key\n" + | "\nImport a private key\n" + | ||||
HelpExampleCli("importprivkey", "\"mykey\"") + | HelpExampleCli("importprivkey", "\"mykey\"") + | ||||
"\nAbort the running wallet rescan\n" + | "\nAbort the running wallet rescan\n" + | ||||
HelpExampleCli("abortrescan", "") + | HelpExampleCli("abortrescan", "") + "\nAs a JSON-RPC call\n" + | ||||
"\nAs a JSON-RPC call\n" + | |||||
HelpExampleRpc("abortrescan", "")); | HelpExampleRpc("abortrescan", "")); | ||||
} | } | ||||
if (!pwallet->IsScanning() || pwallet->IsAbortingRescan()) { | if (!pwallet->IsScanning() || pwallet->IsAbortingRescan()) { | ||||
return false; | return false; | ||||
} | } | ||||
pwallet->AbortRescan(); | pwallet->AbortRescan(); | ||||
return true; | return true; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | UniValue importaddress(const Config &config, const JSONRPCRequest &request) { | ||||
CWallet *const pwallet = wallet.get(); | CWallet *const pwallet = wallet.get(); | ||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
if (request.fHelp || request.params.size() < 1 || | if (request.fHelp || request.params.size() < 1 || | ||||
request.params.size() > 4) { | request.params.size() > 4) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
"importaddress \"address\" ( \"label\" rescan p2sh )\n" | RPCHelpMan{"importaddress", | ||||
"\nAdds an address or script (in hex) that can be watched as if it " | "\nAdds an address or script (in hex) that can be " | ||||
"were in your wallet but cannot be used to spend. Requires a new " | "watched as if it were in your wallet but cannot be " | ||||
"wallet backup.\n" | "used to spend. Requires a new wallet backup.\n", | ||||
{ | |||||
{"address", RPCArg::Type::STR, false}, | |||||
{"label", RPCArg::Type::STR, true}, | |||||
{"rescan", RPCArg::Type::BOOL, true}, | |||||
{"p2sh", RPCArg::Type::BOOL, true}, | |||||
}} | |||||
.ToString() + | |||||
"\nArguments:\n" | "\nArguments:\n" | ||||
"1. \"address\" (string, required) The Bitcoin address " | "1. \"address\" (string, required) The Bitcoin address " | ||||
"(or hex-encoded script)\n" | "(or hex-encoded script)\n" | ||||
"2. \"label\" (string, optional, default=\"\") An " | "2. \"label\" (string, optional, default=\"\") An " | ||||
"optional label\n" | "optional label\n" | ||||
"3. rescan (boolean, optional, default=true) Rescan " | "3. rescan (boolean, optional, default=true) Rescan " | ||||
"the wallet for transactions\n" | "the wallet for transactions\n" | ||||
"4. p2sh (boolean, optional, default=false) Add " | "4. p2sh (boolean, optional, default=false) Add " | ||||
▲ Show 20 Lines • Show All 83 Lines • ▼ Show 20 Lines | UniValue importprunedfunds(const Config &config, | ||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | ||||
CWallet *const pwallet = wallet.get(); | CWallet *const pwallet = wallet.get(); | ||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
if (request.fHelp || request.params.size() != 2) { | if (request.fHelp || request.params.size() != 2) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
"importprunedfunds \"rawtransaction\" \"txoutproof\"\n" | RPCHelpMan{"importprunedfunds", | ||||
"\nImports funds without rescan. Corresponding address or script " | "\nImports funds without rescan. Corresponding address " | ||||
"must previously be included in wallet. Aimed towards pruned " | "or script must previously be included in wallet. Aimed " | ||||
"wallets. The end-user is responsible to import additional " | "towards pruned wallets. The end-user is responsible to " | ||||
"transactions that subsequently spend the imported outputs or " | "import additional transactions that subsequently spend " | ||||
"rescan after the point in the blockchain the transaction is " | "the imported outputs or rescan after the point in the " | ||||
"included.\n" | "blockchain the transaction is included.\n", | ||||
{ | |||||
{"rawtransaction", RPCArg::Type::STR_HEX, false}, | |||||
{"txoutproof", RPCArg::Type::STR_HEX, false}, | |||||
}} | |||||
.ToString() + | |||||
"\nArguments:\n" | "\nArguments:\n" | ||||
"1. \"rawtransaction\" (string, required) A raw transaction in hex " | "1. \"rawtransaction\" (string, required) A raw transaction in hex " | ||||
"funding an already-existing address in wallet\n" | "funding an already-existing address in wallet\n" | ||||
"2. \"txoutproof\" (string, required) The hex output from " | "2. \"txoutproof\" (string, required) The hex output from " | ||||
"gettxoutproof that contains the transaction\n"); | "gettxoutproof that contains the transaction\n"); | ||||
} | } | ||||
CMutableTransaction tx; | CMutableTransaction tx; | ||||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | UniValue removeprunedfunds(const Config &config, | ||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | ||||
CWallet *const pwallet = wallet.get(); | CWallet *const pwallet = wallet.get(); | ||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
if (request.fHelp || request.params.size() != 1) { | if (request.fHelp || request.params.size() != 1) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
"removeprunedfunds \"txid\"\n" | RPCHelpMan{ | ||||
"\nDeletes the specified transaction from the wallet. Meant for " | "removeprunedfunds", | ||||
"use with pruned wallets and as a companion to importprunedfunds. " | "\nDeletes the specified transaction from the wallet. Meant " | ||||
"This will affect wallet balances.\n" | "for use with pruned wallets and as a companion to " | ||||
"importprunedfunds. This will affect wallet balances.\n", | |||||
{ | |||||
{"txid", RPCArg::Type::STR_HEX, false}, | |||||
}} | |||||
.ToString() + | |||||
"\nArguments:\n" | "\nArguments:\n" | ||||
"1. \"txid\" (string, required) The hex-encoded id of " | "1. \"txid\" (string, required) The hex-encoded id of " | ||||
"the transaction you are deleting\n" | "the transaction you are deleting\n" | ||||
"\nExamples:\n" + | "\nExamples:\n" + | ||||
HelpExampleCli("removeprunedfunds", "\"a8d0c0184dde994a09ec054286f1" | HelpExampleCli("removeprunedfunds", "\"a8d0c0184dde994a09ec054286f1" | ||||
"ce581bebf46446a512166eae762873" | "ce581bebf46446a512166eae762873" | ||||
"4ea0a5\"") + | "4ea0a5\"") + | ||||
"\nAs a JSON-RPC call\n" + | "\nAs a JSON-RPC call\n" + | ||||
Show All 28 Lines | UniValue importpubkey(const Config &config, const JSONRPCRequest &request) { | ||||
CWallet *const pwallet = wallet.get(); | CWallet *const pwallet = wallet.get(); | ||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
if (request.fHelp || request.params.size() < 1 || | if (request.fHelp || request.params.size() < 1 || | ||||
request.params.size() > 4) { | request.params.size() > 4) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
"importpubkey \"pubkey\" ( \"label\" rescan )\n" | RPCHelpMan{"importpubkey", | ||||
"\nAdds a public key (in hex) that can be watched as if it were in " | "\nAdds a public key (in hex) that can be watched as if " | ||||
"your wallet but cannot be used to spend. Requires a new wallet " | "it were in your wallet but cannot be used to spend. " | ||||
"backup.\n" | "Requires a new wallet backup.\n", | ||||
{ | |||||
{"pubkey", RPCArg::Type::STR, false}, | |||||
{"label", RPCArg::Type::STR, true}, | |||||
{"rescan", RPCArg::Type::BOOL, true}, | |||||
}} | |||||
.ToString() + | |||||
"\nArguments:\n" | "\nArguments:\n" | ||||
"1. \"pubkey\" (string, required) The hex-encoded public " | "1. \"pubkey\" (string, required) The hex-encoded public " | ||||
"key\n" | "key\n" | ||||
"2. \"label\" (string, optional, default=\"\") An " | "2. \"label\" (string, optional, default=\"\") An " | ||||
"optional label\n" | "optional label\n" | ||||
"3. rescan (boolean, optional, default=true) Rescan " | "3. rescan (boolean, optional, default=true) Rescan " | ||||
"the wallet for transactions\n" | "the wallet for transactions\n" | ||||
"\nNote: This call can take minutes to complete if rescan is true, " | "\nNote: This call can take minutes to complete if rescan is true, " | ||||
▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | UniValue importwallet(const Config &config, const JSONRPCRequest &request) { | ||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | ||||
CWallet *const pwallet = wallet.get(); | CWallet *const pwallet = wallet.get(); | ||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
if (request.fHelp || request.params.size() != 1) { | if (request.fHelp || request.params.size() != 1) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
"importwallet \"filename\"\n" | RPCHelpMan{ | ||||
"\nImports keys from a wallet dump file (see dumpwallet). Requires " | "importwallet", | ||||
"a new wallet backup to include imported keys.\n" | "\nImports keys from a wallet dump file (see dumpwallet). " | ||||
"Requires a new wallet backup to include imported keys.\n", | |||||
{ | |||||
{"filename", RPCArg::Type::STR, false}, | |||||
}} | |||||
.ToString() + | |||||
"\nArguments:\n" | "\nArguments:\n" | ||||
"1. \"filename\" (string, required) The wallet file\n" | "1. \"filename\" (string, required) The wallet file\n" | ||||
"\nExamples:\n" | "\nExamples:\n" | ||||
"\nDump the wallet\n" + | "\nDump the wallet\n" + | ||||
HelpExampleCli("dumpwallet", "\"test\"") + "\nImport the wallet\n" + | HelpExampleCli("dumpwallet", "\"test\"") + "\nImport the wallet\n" + | ||||
HelpExampleCli("importwallet", "\"test\"") + | HelpExampleCli("importwallet", "\"test\"") + | ||||
"\nImport using the json rpc call\n" + | "\nImport using the json rpc call\n" + | ||||
HelpExampleRpc("importwallet", "\"test\"")); | HelpExampleRpc("importwallet", "\"test\"")); | ||||
▲ Show 20 Lines • Show All 179 Lines • ▼ Show 20 Lines | UniValue dumpprivkey(const Config &config, const JSONRPCRequest &request) { | ||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | ||||
CWallet *const pwallet = wallet.get(); | CWallet *const pwallet = wallet.get(); | ||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
if (request.fHelp || request.params.size() != 1) { | if (request.fHelp || request.params.size() != 1) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
"dumpprivkey \"address\"\n" | RPCHelpMan{"dumpprivkey", | ||||
"\nReveals the private key corresponding to 'address'.\n" | "\nReveals the private key corresponding to 'address'.\n" | ||||
"Then the importprivkey can be used with this output\n" | "Then the importprivkey can be used with this output\n", | ||||
{ | |||||
{"address", RPCArg::Type::STR, false}, | |||||
}} | |||||
.ToString() + | |||||
"\nArguments:\n" | "\nArguments:\n" | ||||
"1. \"address\" (string, required) The bitcoin address for the " | "1. \"address\" (string, required) The bitcoin address for the " | ||||
"private key\n" | "private key\n" | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"\"key\" (string) The private key\n" | "\"key\" (string) The private key\n" | ||||
"\nExamples:\n" + | "\nExamples:\n" + | ||||
HelpExampleCli("dumpprivkey", "\"myaddress\"") + | HelpExampleCli("dumpprivkey", "\"myaddress\"") + | ||||
HelpExampleCli("importprivkey", "\"mykey\"") + | HelpExampleCli("importprivkey", "\"mykey\"") + | ||||
Show All 28 Lines | UniValue dumpwallet(const Config &config, const JSONRPCRequest &request) { | ||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | ||||
CWallet *const pwallet = wallet.get(); | CWallet *const pwallet = wallet.get(); | ||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
if (request.fHelp || request.params.size() != 1) { | if (request.fHelp || request.params.size() != 1) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
"dumpwallet \"filename\"\n" | RPCHelpMan{"dumpwallet", | ||||
"\nDumps all wallet keys in a human-readable format to a " | "\nDumps all wallet keys in a human-readable format to " | ||||
"server-side file. This does not allow overwriting existing " | "a server-side file. This does not allow overwriting " | ||||
"files.\n" | "existing files.\n" | ||||
"Imported scripts are included in the dumpsfile, but corresponding " | "Imported scripts are included in the dumpsfile, but " | ||||
"addresses may not be added automatically by importwallet.\n" | "corresponding addresses may not be added automatically " | ||||
"Note that if your wallet contains keys which are not derived from " | "by importwallet.\n" | ||||
"your HD seed (e.g. imported keys), these are not covered by\n" | "Note that if your wallet contains keys which are not " | ||||
"only backing up the seed itself, and must be backed up too (e.g. " | "derived from your HD seed (e.g. imported keys), these " | ||||
"ensure you back up the whole dumpfile).\n" | "are not covered by\n" | ||||
"only backing up the seed itself, and must be backed up " | |||||
"too (e.g. ensure you back up the whole dumpfile).\n", | |||||
{ | |||||
{"filename", RPCArg::Type::STR, false}, | |||||
}} | |||||
.ToString() + | |||||
"\nArguments:\n" | "\nArguments:\n" | ||||
"1. \"filename\" (string, required) The filename with path " | "1. \"filename\" (string, required) The filename with path " | ||||
"(either absolute or relative to bitcoind)\n" | "(either absolute or relative to bitcoind)\n" | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"{ (json object)\n" | "{ (json object)\n" | ||||
" \"filename\" : { (string) The filename with full " | " \"filename\" : { (string) The filename with full " | ||||
"absolute path\n" | "absolute path\n" | ||||
"}\n" | "}\n" | ||||
▲ Show 20 Lines • Show All 512 Lines • ▼ Show 20 Lines | |||||
UniValue importmulti(const Config &config, const JSONRPCRequest &mainRequest) { | UniValue importmulti(const Config &config, const JSONRPCRequest &mainRequest) { | ||||
std::shared_ptr<CWallet> const wallet = | std::shared_ptr<CWallet> const wallet = | ||||
GetWalletForJSONRPCRequest(mainRequest); | GetWalletForJSONRPCRequest(mainRequest); | ||||
CWallet *const pwallet = wallet.get(); | CWallet *const pwallet = wallet.get(); | ||||
if (!EnsureWalletIsAvailable(pwallet, mainRequest.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, mainRequest.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
// clang-format off | if (mainRequest.fHelp || mainRequest.params.size() < 1 || | ||||
if (mainRequest.fHelp || mainRequest.params.size() < 1 || mainRequest.params.size() > 2) { | mainRequest.params.size() > 2) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
"importmulti \"requests\" ( \"options\" )\n" | RPCHelpMan{ | ||||
"\nImport addresses/scripts (with private or public keys, redeem script (P2SH)), rescanning all addresses in one-shot-only (rescan can be disabled via options). Requires a new wallet backup.\n\n" | "importmulti", | ||||
"\nImport addresses/scripts (with private or public keys, " | |||||
"redeem script (P2SH)), rescanning all addresses in " | |||||
"one-shot-only (rescan can be disabled via options). Requires " | |||||
"a new wallet backup.\n\n", | |||||
{ | |||||
{"requests", | |||||
RPCArg::Type::ARR, | |||||
{ | |||||
{"", | |||||
RPCArg::Type::OBJ, | |||||
{ | |||||
{ | |||||
{"scriptPubKey", RPCArg::Type::STR, false}, | |||||
{"timestamp", RPCArg::Type::NUM, false}, | |||||
{"redeemscript", RPCArg::Type::STR, true}, | |||||
{"pubkeys", | |||||
RPCArg::Type::ARR, | |||||
{ | |||||
{"pubkey", RPCArg::Type::STR, false}, | |||||
}, | |||||
true}, | |||||
{"keys", | |||||
RPCArg::Type::ARR, | |||||
{ | |||||
{"key", RPCArg::Type::STR, false}, | |||||
}, | |||||
true}, | |||||
{"internal", RPCArg::Type::BOOL, true}, | |||||
{"watchonly", RPCArg::Type::BOOL, true}, | |||||
{"label", RPCArg::Type::STR, true}, | |||||
}, | |||||
}, | |||||
false}, | |||||
}, | |||||
false, | |||||
"\"requests\""}, | |||||
{"options", | |||||
RPCArg::Type::OBJ, | |||||
{ | |||||
{"rescan", RPCArg::Type::BOOL, true}, | |||||
}, | |||||
true, | |||||
"\"options\""}, | |||||
}} | |||||
.ToString() + | |||||
"Arguments:\n" | "Arguments:\n" | ||||
"1. requests (array, required) Data to be imported\n" | "1. requests (array, required) Data to be imported\n" | ||||
" [ (array of json objects)\n" | " [ (array of json objects)\n" | ||||
" {\n" | " {\n" | ||||
" \"scriptPubKey\": \"<script>\" | { \"address\":\"<address>\" }, (string / json, required) Type of scriptPubKey (string for script, json for address)\n" | " \"scriptPubKey\": \"<script>\" | { " | ||||
" \"timestamp\": timestamp | \"now\" , (integer / string, required) Creation time of the key in seconds since epoch (Jan 1 1970 GMT),\n" | "\"address\":\"<address>\" }, (string / json, required) Type of " | ||||
" or the string \"now\" to substitute the current synced blockchain time. The timestamp of the oldest\n" | "scriptPubKey (string for script, json for address)\n" | ||||
" key will determine how far back blockchain rescans need to begin for missing wallet transactions.\n" | " \"timestamp\": timestamp | \"now\" , " | ||||
" \"now\" can be specified to bypass scanning, for keys which are known to never have been used, and\n" | "(integer / string, required) Creation time of the key in seconds " | ||||
" 0 can be specified to scan the entire blockchain. Blocks up to 2 hours before the earliest key\n" | "since epoch (Jan 1 1970 GMT),\n" | ||||
" creation time of all keys being imported by the importmulti call will be scanned.\n" | " or " | ||||
" \"redeemscript\": \"<script>\" , (string, optional) Allowed only if the scriptPubKey is a P2SH address or a P2SH scriptPubKey\n" | "the string \"now\" to substitute the current synced blockchain " | ||||
" \"pubkeys\": [\"<pubKey>\", ... ] , (array, optional) Array of strings giving pubkeys that must occur in the output or redeemscript\n" | "time. The timestamp of the oldest\n" | ||||
" \"keys\": [\"<key>\", ... ] , (array, optional) Array of strings giving private keys whose corresponding public keys must occur in the output or redeemscript\n" | " key " | ||||
" \"internal\": <true> , (boolean, optional, default: false) Stating whether matching outputs should be treated as not incoming payments aka change\n" | "will determine how far back blockchain rescans need to begin for " | ||||
" \"watchonly\": <true> , (boolean, optional, default: false) Stating whether matching outputs should be considered watched even when they're not spendable, only allowed if keys are empty\n" | "missing wallet transactions.\n" | ||||
" \"label\": <label> , (string, optional, default: '') Label to assign to the address, only allowed with internal=false\n" | " " | ||||
"\"now\" can be specified to bypass scanning, for keys which are " | |||||
"known to never have been used, and\n" | |||||
" 0 " | |||||
"can be specified to scan the entire blockchain. Blocks up to 2 " | |||||
"hours before the earliest key\n" | |||||
" " | |||||
"creation time of all keys being imported by the importmulti call " | |||||
"will be scanned.\n" | |||||
" \"redeemscript\": \"<script>\" , " | |||||
"(string, optional) Allowed only if the scriptPubKey is a P2SH " | |||||
"address or a P2SH scriptPubKey\n" | |||||
" \"pubkeys\": [\"<pubKey>\", ... ] , " | |||||
"(array, optional) Array of strings giving pubkeys that must occur " | |||||
"in the output or redeemscript\n" | |||||
" \"keys\": [\"<key>\", ... ] , " | |||||
"(array, optional) Array of strings giving private keys whose " | |||||
"corresponding public keys must occur in the output or " | |||||
"redeemscript\n" | |||||
" \"internal\": <true> , " | |||||
"(boolean, optional, default: false) Stating whether matching " | |||||
"outputs should be treated as not incoming payments aka change\n" | |||||
" \"watchonly\": <true> , " | |||||
"(boolean, optional, default: false) Stating whether matching " | |||||
"outputs should be considered watched even when they're not " | |||||
"spendable, only allowed if keys are empty\n" | |||||
" \"label\": <label> , " | |||||
"(string, optional, default: '') Label to assign to the address, " | |||||
"only allowed with internal=false\n" | |||||
" }\n" | " }\n" | ||||
" ,...\n" | " ,...\n" | ||||
" ]\n" | " ]\n" | ||||
"2. options (json, optional)\n" | "2. options (json, optional)\n" | ||||
" {\n" | " {\n" | ||||
" \"rescan\": <false>, (boolean, optional, default: true) Stating if should rescan the blockchain after all imports\n" | " \"rescan\": <false>, (boolean, optional, default: " | ||||
"true) Stating if should rescan the blockchain after all imports\n" | |||||
" }\n" | " }\n" | ||||
"\nNote: This call can take minutes to complete if rescan is true, during that time, other rpc calls\n" | "\nNote: This call can take minutes to complete if rescan is true, " | ||||
"may report that the imported keys, addresses or scripts exists but related transactions are still missing.\n" | "during that time, other rpc calls\n" | ||||
"may report that the imported keys, addresses or scripts exists " | |||||
"but related transactions are still missing.\n" | |||||
"\nExamples:\n" + | "\nExamples:\n" + | ||||
HelpExampleCli("importmulti", "'[{ \"scriptPubKey\": { \"address\": \"<my address>\" }, \"timestamp\":1455191478 }, " | HelpExampleCli( | ||||
"{ \"scriptPubKey\": { \"address\": \"<my 2nd address>\" }, \"label\": \"example 2\", \"timestamp\": 1455191480 }]'") + | "importmulti", | ||||
HelpExampleCli("importmulti", "'[{ \"scriptPubKey\": { \"address\": \"<my address>\" }, \"timestamp\":1455191478 }]' '{ \"rescan\": false}'") + | "'[{ \"scriptPubKey\": { \"address\": \"<my address>\" }, " | ||||
"\"timestamp\":1455191478 }, " | |||||
"\nResponse is an array with the same size as the input that has the execution result :\n" | "{ \"scriptPubKey\": { \"address\": \"<my 2nd address>\" }, " | ||||
" [{ \"success\": true } , { \"success\": false, \"error\": { \"code\": -1, \"message\": \"Internal Server Error\"} }, ... ]\n"); | "\"label\": \"example 2\", \"timestamp\": 1455191480 }]'") + | ||||
HelpExampleCli( | |||||
"importmulti", | |||||
"'[{ \"scriptPubKey\": { \"address\": \"<my address>\" }, " | |||||
"\"timestamp\":1455191478 }]' '{ \"rescan\": false}'") + | |||||
"\nResponse is an array with the same size as the input that has " | |||||
"the execution result :\n" | |||||
" [{ \"success\": true } , { \"success\": false, \"error\": { " | |||||
"\"code\": -1, \"message\": \"Internal Server Error\"} }, ... ]\n"); | |||||
} | } | ||||
// clang-format on | |||||
RPCTypeCheck(mainRequest.params, {UniValue::VARR, UniValue::VOBJ}); | RPCTypeCheck(mainRequest.params, {UniValue::VARR, UniValue::VOBJ}); | ||||
const UniValue &requests = mainRequest.params[0]; | const UniValue &requests = mainRequest.params[0]; | ||||
// Default options | // Default options | ||||
bool fRescan = true; | bool fRescan = true; | ||||
if (!mainRequest.params[1].isNull()) { | if (!mainRequest.params[1].isNull()) { | ||||
▲ Show 20 Lines • Show All 135 Lines • Show Last 20 Lines |