From d6eed07b83c5f1b1cdcf91b9dec7074f4472e1a5 Mon Sep 17 00:00:00 2001 From: Shannon Appelcline Date: Fri, 24 Feb 2017 16:21:23 -0800 Subject: [PATCH] 1C Signatures --- 3_Playing_with_Bitcoin.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/3_Playing_with_Bitcoin.md b/3_Playing_with_Bitcoin.md index 9e46ce7..2cabe31 100644 --- a/3_Playing_with_Bitcoin.md +++ b/3_Playing_with_Bitcoin.md @@ -307,4 +307,20 @@ Usually you would not want to share this with anyone! ### Sign a Message +Alternatively, you can just directly sign a message using your address (and your bitcoind) without saving the private key. You do with with "bitcoin-cli signmessage [address] [message]". For example: +``` +$ bitcoin-cli signmessage $NEW_ADDRESS_1 "Hello, World" +HzF7EWicHjDBf9faRTF5O7Q1+iSOunAYyV2880Yz0T/eaUELCukg2hGlJXj9/kptMBu2wf4DEuS8fnoq2QpvSo8= +``` +This verifies that the message for the address was signed by the person who knew the address' private key. A recipient can verify it: +``` +$ bitcoin-cli verifymessage $NEW_ADDRESS_1 "HzF7EWicHjDBf9faRTF5O7Q1+iSOunAYyV2880Yz0T/eaUELCukg2hGlJXj9/kptMBu2wf4DEuS8fnoq2QpvSo8=" "Hello, World" +true +``` +If some black hat was making up signatures, they'd instead get a negative result: +``` +$ bitcoin-cli verifymessage $NEW_ADDRESS_1 "FAKEEWicHjDBf9faRTF5O7Q1+iSOunAYyV2880Yz0T/eaUELCukg2hGlJXj9/kptMBu2wf4DEuS8fnoq2QpvSo8=" "Hello, World" +false +``` +