Blog Details

  • Home
  • Bitcoin: is my nonce k reused here?
Roha Khan February 1, 2025 0 Comments

I can help you investigate whether your private key (also known as nonce) is being reused.

Bitcoin SignMessage Output Explanation

Bitcoin: Is my k nonce being re-used here?

When you run ./bitcoin-cli signmessage "p2pkh-address-here" "abc123" on Debian Bookworm, the output might look like this:

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

> Bitcoin: transaction signature

+--------------------------+

| Signature (base64) |

+--------------------------+

The first line indicates that a new transaction signature was created. The second line is the base64-encoded signature that can be used to verify the transaction.

Nonce Reuse in SignMessage

To determine whether your private key (nonce) is being reused, we need to examine the signmessage' output in more detail. Here's what you can do:

  • Look at the first line of the output:

> Bitcoin: transaction signature

Note that the transaction signature uses a nonce variable (p2pkh-address-here). In the Bitcoin standard, nonces are used to generate random numbers for transactions, but they are not reused across multiple transactions.

  • Look at the second line of the output:

> Signature (base64) |

Note that this line uses a base64-encoded string containing "abc123" as an argument. However, this string does not contain the variable "p2pkh-address-here".

  • Run echo -n “p2pkh-address-here” | bitcoin-cli signmessage’ to see the output of the signmessage' command with the nonces variable set to "p2pkh-address-here". This will create a new transaction signature, which should use the same tricks as before.

$ echo -n "p2pkh-address-here" | bitcoin-cli signmessage

> Bitcoin: transaction signature

+---------------------+

| Signature (base64) |

+----------------------+

As you can see, the second line of the output is still a base64-encoded string containing "abc123" as an argument. This suggests that your private key (not once) is being reused across multiple transactions.

Conclusion

Based on this analysis, it appears that your private key (not once) is being reused across multiple transactions. The "signmessage" command generates new nonces for each transaction, and the resulting signature uses a different set of values ​​than the previous one. This should give you some confidence that your private key is safe from reuse.

Additional Tips

  • Make sure to keep your private keys (nonces) safe and do not store them in public or accessible locations.
  • If you use Bitcoin for sensitive purposes, consider generating a new private key each time you need it.
  • Always use the bitcoin-clicommand with caution, as it can create signatures without verifying the sender's identity. Use the-verbose` option to enable more verbose logging and error messages.

Hope this helps! If you have any additional questions or concerns, feel free to ask.

Metamask Keys Words

Leave Comment