20 "Verify a signed message.",
30 "\nUnlock the wallet for 30 seconds\n" 32 "\nCreate the signature\n" 33 +
HelpExampleCli(
"signmessage",
"\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\" \"my message\"") +
34 "\nVerify the signature\n" 35 +
HelpExampleCli(
"verifymessage",
"\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\" \"signature\" \"my message\"") +
36 "\nAs a JSON-RPC call\n" 37 +
HelpExampleRpc(
"verifymessage",
"\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\", \"signature\", \"my message\"")
41 std::string strAddress = request.params[0].
get_str();
42 std::string strSign = request.params[1].get_str();
43 std::string strMessage = request.params[2].get_str();
67 "\nSign a message with the private key of an address\n",
76 "\nCreate the signature\n" 77 +
HelpExampleCli(
"signmessagewithprivkey",
"\"privkey\" \"my message\"") +
78 "\nVerify the signature\n" 79 +
HelpExampleCli(
"verifymessage",
"\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\" \"signature\" \"my message\"") +
80 "\nAs a JSON-RPC call\n" 81 +
HelpExampleRpc(
"signmessagewithprivkey",
"\"privkey\", \"my message\"")
85 std::string strPrivkey = request.params[0].
get_str();
86 std::string strMessage = request.params[1].get_str();
93 std::string signature;
110 for (
const auto& c : commands) {
111 t.appendCommand(c.name, &c);
The provided signature couldn't be parsed (maybe invalid base64).
static RPCHelpMan verifymessage()
MessageVerificationResult MessageVerify(const std::string &address, const std::string &signature, const std::string &message)
Verify a signed message.
bool MessageSign(const CKey &privkey, const std::string &message, std::string &signature)
Sign a message.
const std::string & get_str() const
The message verification was successful.
std::string HelpExampleRpc(const std::string &methodname, const std::string &args)
UniValue JSONRPCError(int code, const std::string &message)
Unexpected type was passed as parameter.
static RPCHelpMan signmessagewithprivkey()
std::string HelpExampleCli(const std::string &methodname, const std::string &args)
The message was not signed with the private key of the provided address.
void RegisterSignMessageRPCCommands(CRPCTable &t)
The provided address is invalid.
An encapsulated private key.
CKey DecodeSecret(const std::string &str)
A public key could not be recovered from the provided signature and message.
The provided address is valid but does not refer to a public key.
bool IsValid() const
Check whether this private key is valid.