Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: irukandji on March 27, 2018, 02:00:38 AM



Title: Signing a message with a private key
Post by: irukandji on March 27, 2018, 02:00:38 AM
Gavin Andresen said that CSW used
Quote
the private key from the very first bitcoin block
  and signed messages with it.
https://www.youtube.com/watch?v=pNZyRMG2CjA

I send Bitcoin using private keys, but what does it mean to sign a message with a private key?


Title: Re: Signing a message with a private key
Post by: RGBKey on March 27, 2018, 02:22:44 AM
To sign a message with a private key is to provide cryptographic proof that the message signed is coming from the person in control of the private key. For example, if you sign a message with the private key belonging to one of your Bitcoin addresses, anybody could tell that the owner of a certain Bitcoin address (you) was the one that wrote that message.


Title: Re: Signing a message with a private key
Post by: irukandji on March 27, 2018, 02:39:51 AM
To sign a message with a private key is to provide cryptographic proof that the message signed is coming from the person in control of the private key. For example, if you sign a message with the private key belonging to one of your Bitcoin addresses, anybody could tell that the owner of a certain Bitcoin address (you) was the one that wrote that message.

Where do you write the message and where do you send it to?


Title: Re: Signing a message with a private key
Post by: bitmover on March 27, 2018, 02:45:51 AM
Where do you write the message and where do you send it to?

There are many wallets that are able to sign messages, and many that are not.

Segwit addresses can sign messages, but there is no standard to verify, so it's better to use a Legacy address (starting with 1).

The easiest way to sign I think is using Coinomi. Just download  Coinomi Wallet (https://play.google.com/store/apps/details?id=com.coinomi.wallet), click on the upper right corner and choose sign message

https://cdn-images-1.medium.com/max/800/1*pR37tdqnkC8FRdPHUwu5Vw.jpeg                        https://cdn-images-1.medium.com/max/800/1*BCGQCMAxiIOscq9XKHY0DA.jpeg                   https://cdn-images-1.medium.com/max/400/1*pC56NbZ_g_shJYO2TCvq2Q.jpeg

More details here:
https://medium.com/@bytether/how-to-sign-a-message-with-a-coinomi-android-wallet-9ebdda63e912 (https://medium.com/@bytether/how-to-sign-a-message-with-a-coinomi-android-wallet-9ebdda63e912)
Images from the site above.


Title: Re: Signing a message with a private key
Post by: nydiacaskey01 on March 27, 2018, 02:48:52 AM
Where do you write the message and where do you send it to?
Here's a complete step by step information on how to sign a message depending on what you are going to use. This is being updated from time to time by shorena https://bitcointalk.org/index.php?topic=990345.0


Title: Re: Signing a message with a private key
Post by: irukandji on March 27, 2018, 05:19:56 AM
Thanks for all the replies. :)

So if i send you some bitcoin and i sign a message.... like..."hello from Irukandji". Only the receiver will be able to see it?  And will it remain somewhere for ever or be deleted?


Title: Re: Signing a message with a private key
Post by: starmyc on March 27, 2018, 05:41:44 AM
Signing is not encryption. When you sign a message, you guarantee anyone that you and only you wrote it and sign it. The message can't be changed or the signature will become invalid. But the message won't be encrypted, and then everybody who gets it will be able to read it.

In Bitcoin, spent transactions are signed to prove than only the owner of the private key want to spend the transaction. But the transaction will still be clear and everybody will be able to see it (that's why the blockchain is said "public"). There is no encryption involved in Bitcoin (Edit: besides encrypting the wallet.dat file).


Title: Re: Signing a message with a private key
Post by: mocacinno on March 27, 2018, 05:45:43 AM
Thanks for all the replies. :)

So if i send you some bitcoin and i sign a message.... like..."hello from Irukandji". Only the receiver will be able to see it?  And will it remain somewhere for ever or be deleted?

starmyc already answered the first part of your question: he's correct, signing is not equal to encrypting.
As for the second part of your question: a signed message is just a piece of ascii text, it isn't automatically stored on the blockchain. Usually, you send a signed message to somebody to proof you own the private key to a certain (staked) address. The message will exist as long as you and the receiver don't delete said message from your sent messages/inbox (or whatever other way you used to send the signed message).

You CAN include some text in a transaction using op_return, but this is rather technical, you'd have to craft a transaction in a "non-standard" way in order to do this. (with non-standard, i mean that if you use a standard wallet like core or electrum in a standard-gui way, there won't be an option available afaik)
here's a funny website to look at op_return's in some of the latest transactions: http://coinsecrets.org/


Title: Re: Signing a message with a private key
Post by: HeRetiK on March 27, 2018, 10:01:08 AM
Thanks for all the replies. :)

So if i send you some bitcoin and i sign a message.... like..."hello from Irukandji". Only the receiver will be able to see it?  And will it remain somewhere for ever or be deleted?

It will only remain in the blockchain if you craft a special transaction as mentioned by mocacinno above.

While asymmetric encryption is sometimes used to ensure that only the receiver can decrypt the message, the use case you've been asking about is only about verifying the identity of the signer and the integrity of the message: https://simple.wikipedia.org/wiki/Digital_signature

Note that sending bitcoins is technically not different from signing a message -- the message effectively being "Irukandji is sending X BTC to Y".


Title: Re: Signing a message with a private key
Post by: leonair on March 27, 2018, 07:05:51 PM
Most of the people who told you about Signing a message is correct and will really help you out and I just would like to add up.

Signing a message with a private key is one of the best identifier here in the forum in case your account get hack by someone.
Theymos posted it here (https://bitcointalk.org/index.php?topic=497545.0)


You can verify signed messages here https://tools.bitcoin.com/verify-message/