16 "Sign a message with the private key of an address" +
20 "The bitcoin address to use for the private key."},
22 "The message to create a signature of."},
25 "The signature of the message encoded in base 64"},
27 "\nUnlock the wallet for 30 seconds\n" +
29 "\nCreate the signature\n" +
32 "\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\" \"my message\"") +
33 "\nVerify the signature\n" +
35 "\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\" "
36 "\"signature\" \"my message\"") +
37 "\nAs a JSON-RPC call\n" +
40 "\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\", \"my message\"")},
43 std::shared_ptr<CWallet>
const wallet =
54 std::string strAddress = request.params[0].get_str();
55 std::string strMessage = request.params[1].get_str();
63 const PKHash *pkhash = std::get_if<PKHash>(&dest);
66 "Address does not refer to key");
69 std::string signature;
71 pwallet->
SignMessage(strMessage, *pkhash, signature);
A CWallet maintains a set of transactions and balances, and provides the ability to create new transa...
SigningResult SignMessage(const std::string &message, const PKHash &pkhash, std::string &str_sig) const
CTxDestination DecodeDestination(const std::string &addr, const CChainParams ¶ms)
std::string SigningResultString(const SigningResult res)
UniValue JSONRPCError(int code, const std::string &message)
@ RPC_TYPE_ERROR
Unexpected type was passed as parameter.
@ RPC_WALLET_ERROR
Wallet errors Unspecified problem with wallet (key not found etc.)
@ 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)
bool IsValidDestination(const CTxDestination &dest)
Check whether a CTxDestination is a CNoDestination.
std::variant< CNoDestination, PKHash, ScriptHash > CTxDestination
A txout script template with a specific destination.
const UniValue NullUniValue
void EnsureWalletIsUnlocked(const CWallet *pwallet)
std::shared_ptr< CWallet > GetWalletForJSONRPCRequest(const JSONRPCRequest &request)
Figures out what wallet, if any, to use for a JSONRPCRequest.
const std::string HELP_REQUIRING_PASSPHRASE