17 "\nSign a message with the private key of an address" +
27 "\nUnlock the wallet for 30 seconds\n"
29 "\nCreate the signature\n"
30 +
HelpExampleCli(
"signmessage",
"\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\" \"my message\"") +
31 "\nVerify the signature\n"
32 +
HelpExampleCli(
"verifymessage",
"\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\" \"signature\" \"my message\"") +
33 "\nAs a JSON-RPC call\n"
34 +
HelpExampleRpc(
"signmessage",
"\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\", \"my message\"")
41 LOCK(pwallet->cs_wallet);
45 std::string strAddress = request.params[0].get_str();
46 std::string strMessage = request.params[1].get_str();
53 const PKHash* pkhash = std::get_if<PKHash>(&dest);
58 std::string signature;
59 SigningResult err = pwallet->SignMessage(strMessage, *pkhash, signature);
bool IsValidDestination(const CTxDestination &dest)
Check whether a CTxDestination corresponds to one with an address.
std::variant< CNoDestination, PubKeyDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessV1Taproot, PayToAnchor, WitnessUnknown > CTxDestination
A txout script categorized into standard templates.
std::string SigningResultString(const SigningResult res)
CTxDestination DecodeDestination(const std::string &str, std::string &error_msg, std::vector< int > *error_locations)
std::shared_ptr< CWallet > GetWalletForJSONRPCRequest(const JSONRPCRequest &request)
Figures out what wallet, if any, to use for a JSONRPCRequest.
void EnsureWalletIsUnlocked(const CWallet &wallet)
const std::string HELP_REQUIRING_PASSPHRASE
UniValue JSONRPCError(int code, const std::string &message)
@ RPC_TYPE_ERROR
Unexpected type was passed as parameter.
@ RPC_WALLET_ERROR
Wallet errors.
@ RPC_INVALID_ADDRESS_OR_KEY
Invalid address or key.
std::string HelpExampleCli(const std::string &methodname, const std::string &args)
std::string HelpExampleRpc(const std::string &methodname, const std::string &args)