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 =
self.Arg<std::string>(
"address");
42 std::string strSign =
self.Arg<std::string>(
"signature");
43 std::string strMessage =
self.Arg<std::string>(
"message");
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);
static RPCHelpMan verifymessage()
A public key could not be recovered from the provided signature and message.
The message verification was successful.
The provided address is invalid.
The provided signature couldn't be parsed (maybe invalid base64).
bool MessageSign(const CKey &privkey, const std::string &message, std::string &signature)
Sign a message.
const std::string & get_str() const
MessageVerificationResult MessageVerify(const std::string &address, const std::string &signature, const std::string &message)
Verify a signed message.
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)
void RegisterSignMessageRPCCommands(CRPCTable &t)
The message was not signed with the private key of the provided address.
The provided address is valid but does not refer to a public key.
An encapsulated private key.
CKey DecodeSecret(const std::string &str)
bool IsValid() const
Check whether this private key is valid.