<p>Using bitcoind and bitcoin-cli you can do it as follows:</p>

<pre><code>bitcoin-cli signmessage 1DiWX6p3FdHPZqN88vMeGVXSwAQ1h7BeVj 'Hello world!'
</code></pre>

CC BY-SA 3.0
2014-04-26T21:41:47.863Z
2014-04-26T21:41:47.863Z
Luca Venturini
<p>In Bitcoin-qt</p>

<p><a href="https://i.sstatic.net/tp0fK.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/tp0fK.png" alt="enter image description here"></a>
<a href="https://i.sstatic.net/TLlqq.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/TLlqq.png" alt="enter image description here"></a></p>

<p>Or you can do it in blockchain.info/wallet by clicking the menu above your addresses. </p>

<p>No need to do it manually.</p>

CC BY-SA 3.0
2014-02-04T13:33:38.677Z
2018-05-01T19:50:22.233Z
2018-05-01T19:50:22.233Z
SimplePi
<p>How does one create a proper signature for a given message using Bitcoin private keys?</p>

<p>I have an input address of</p>

<p>5JeWZ1z6sRcLTJXdQEDdB986E6XfLAkj9CgNE4EHzr5GmjrVFpf</p>

<p>or</p>

<pre><code>6d7f6815bd7927423a728db28c5f4ea4032a81ab8dbca06ec41476508de48a6d
</code></pre>

<p>I want to sign message:</p>

<pre><code>test
</code></pre>

<p>I convert it to hex:</p>

<pre><code>74657374
</code></pre>

<p>I feed it to a signing function of ECDSA library that uses secp256k1, and I get two outputs,</p>

<pre><code>r = D16A44BF1095FB7D517C7C4DD6A51E3EFD29548C5CAD8CA4AB763946D02AE0E8 
s = 2AB3E674B788804B87CED50619A1EFA267E17D20C016D0779BC3203D40E8105D 
</code></pre>

<p>If I marshal it with DER/asn1 as a list of Big Integers, I get a result of:</p>

<pre><code>MEUCIQDRakS/EJX7fVF8fE3WpR4+/SlUjFytjKSrdjlG0Crg6AIgKrPmdLeIgEuHztUGGaHvomfhfSDAFtB3m8MgPUDoEF0=
</code></pre>

<p>If I marshal them as a list of byte arrays, I get</p>

<pre><code>MEQEINFqRL8Qlft9UXx8TdalHj79KVSMXK2MpKt2OUbQKuDoBCAqs+Z0t4iAS4fO1QYZoe+iZ+F9IMAW0HebwyA9QOgQXQ==
</code></pre>

<p>if I marshal them as one long byte array, I get 0WpEvxCV+31RfHxN1qUePv0pVIxcrYykq3Y5RtAq4Ogqs+Z0t4iAS4fO1QYZoe+iZ+F9IMAW0HebwyA9QOgQXQ==</p>

<p>None of them appear to work as signatures when I try to verify the message signature using tools like <a href="http://brainwallet.org/#verify" rel="noreferrer">http://brainwallet.org/#verify</a> .</p>

<p>How do I properly sign messages using Bitcoin private keys to be compatible with BitcoinQT?</p>

CC BY-SA 3.0
2013-11-15T16:46:07.507Z
The ultimate documentation is the source...
Nate Eldredge
CC BY-SA 3.0
2014-04-05T20:19:34.597Z
What's wrong with `signmessage <bitcoinaddress> <message>`?
KJ O
CC BY-SA 3.0
2017-12-20T17:08:11.053Z
Have you found the signing algorithm? I tried doubleSha(msg.getBytes) (in Java). Verification fails.
Jus12
CC BY-SA 3.0
2018-03-27T18:24:51.243Z
For heavens sake the question is asked so things can be done manually with out using any programs such as bitcoin-qt its a technical question ! 

The user wants to sign a tx manually and check with bitcoin-qt or cli to make sure he signed is correct !
f4r4
<bitcoind><signature><algorithms><standard><message-signing>
How to sign a message using Bitcoin private key?
ThePiachu
# How to sign a message using Bitcoin private key?

(Asked by: username_0 on 2013-11-15)

How does one create a proper signature for a given message using Bitcoin private keys?
I have an input address of
5JeWZ1z6sRcLTJXdQEDdB986E6XfLAkj9CgNE4EHzr5GmjrVFpf
or
6d7f6815bd7927423a728db28c5f4ea4032a81ab8dbca06ec41476508de48a6d

I want to sign message:
test

I convert it to hex:
74657374

I feed it to a signing function of ECDSA library that uses secp256k1, and I get two outputs,
r = D16A44BF1095FB7D517C7C4DD6A51E3EFD29548C5CAD8CA4AB763946D02AE0E8 
s = 2AB3E674B788804B87CED50619A1EFA267E17D20C016D0779BC3203D40E8105D 

If I marshal it with DER/asn1 as a list of Big Integers, I get a result of:
MEUCIQDRakS/EJX7fVF8fE3WpR4+/SlUjFytjKSrdjlG0Crg6AIgKrPmdLeIgEuHztUGGaHvomfhfSDAFtB3m8MgPUDoEF0=

If I marshal them as a list of byte arrays, I get
MEQEINFqRL8Qlft9UXx8TdalHj79KVSMXK2MpKt2OUbQKuDoBCAqs+Z0t4iAS4fO1QYZoe+iZ+F9IMAW0HebwyA9QOgQXQ==

if I marshal them as one long byte array, I get 0WpEvxCV+31RfHxN1qUePv0pVIxcrYykq3Y5RtAq4Ogqs+Z0t4iAS4fO1QYZoe+iZ+F9IMAW0HebwyA9QOgQXQ==
None of them appear to work as signatures when I try to verify the message signature using tools like http://brainwallet.org/#verify .
How do I properly sign messages using Bitcoin private keys to be compatible with BitcoinQT?

**Tags:** bitcoind, signature, algorithms, standard, message-signing

> **Comments:**
> **username_1**: The ultimate documentation is the source...  
> **username_2**: What's wrong with `signmessage <bitcoinaddress> <message>`?  
> **username_3**: Have you found the signing algorithm? I tried doubleSha(msg.getBytes) (in Java). Verification fails.  
> **username_4**: For heavens sake the question is asked so things can be done manually with out using any programs such as bitcoin-qt its a technical question !   The user wants to sign a tx manually and check with bitcoin-qt or cli to make sure he signed is correct !  

---

## 2 answers

### Answer by username_5 on 2014-04-26. Score: 2

Using bitcoind and bitcoin-cli you can do it as follows:
bitcoin-cli signmessage 1DiWX6p3FdHPZqN88vMeGVXSwAQ1h7BeVj 'Hello world!'


---

### Answer by username_6 on 2014-02-04. Score: 1

In Bitcoin-qt

[![enter image description here](https://i.sstatic.net/tp0fK.png)](https://i.sstatic.net/tp0fK.png)
[![enter image description here](https://i.sstatic.net/TLlqq.png)](https://i.sstatic.net/TLlqq.png)

Or you can do it in blockchain.info/wallet by clicking the menu above your addresses.

No need to do it manually.


---

