<p>Bitcoin Core uses <a href="https://www.rfc-editor.org/rfc/rfc6979" rel="nofollow noreferrer">RFC 6979</a> deterministic nonces when generating the nonce for an ECDSA signature. The nonce is essentially generated by hashing the private key with the message, so it will always generate the same nonce given the same key and message. This is not considered nonce reuse as the nonce is not reused across different keys or messages.</p>

CC BY-SA 4.0
2024-10-30T04:54:56.500Z
2024-10-30T04:54:56.500Z
Ava Chow
<p>I'm using bitcoin core 28.0 on Debian Bookworm. I enter the following into bash:</p>
<p><code>./bitcoin-cli signmessage &quot;p2pkh-address-here&quot; &quot;abc123&quot;</code></p>
<p>... and I get the signature output in the shell as expected. But if I then run exactly the same line again in bash, the newly outputted second signature matches the first signature. I thought this was not supposed to happen, and that core uses a different <code>k</code> for every signature, meaning every signature should be different even in cases where the privkey-and-message are identical.</p>
<p>Is my <code>k</code> being re-used, or am I missing something?</p>

<security><signature><nonce><message-signing>
Is my k nonce being re-used here?
Lilacrail
# Is my k nonce being re-used here?

(Asked by: username_0 on 2024-10-30)

I'm using bitcoin core 28.0 on Debian Bookworm. I enter the following into bash:

`./bitcoin-cli signmessage "p2pkh-address-here" "abc123"`

... and I get the signature output in the shell as expected. But if I then run exactly the same line again in bash, the newly outputted second signature matches the first signature. I thought this was not supposed to happen, and that core uses a different `k` for every signature, meaning every signature should be different even in cases where the privkey-and-message are identical.

Is my `k` being re-used, or am I missing something?

**Tags:** security, signature, nonce, message-signing


---

## 1 answers

### Answer by username_1 on 2024-10-30. Score: 3

Bitcoin Core uses [RFC 6979](https://www.rfc-editor.org/rfc/rfc6979) deterministic nonces when generating the nonce for an ECDSA signature. The nonce is essentially generated by hashing the private key with the message, so it will always generate the same nonce given the same key and message. This is not considered nonce reuse as the nonce is not reused across different keys or messages.


---

