The bitcoin message magic, "Bitcoin Signed Message:\n", is defined: https://github.com/bitcoin/bitcoin/blob/203632d20b3107009f45fae56cc3f7d828b16660/src/main.cpp#L80

I know it is used as a part of signing messages to prove they were sent from owners of specific private keys, as detailed here: What are the safety guidelines for using the Sign Message feature?.

What I don't know, though, is what good is this message magic? Does it make sure the same key can't be used in two coins? Is there some cryptographic reason?

2 Answers 2


Imagine if that weren't there. What if someone tricked you into signing a Bitcoin transaction with your key? They could put the signature they got from you along with your public key into the input script for the transaction, and broadcast that transaction to the network. (Unless something else I'm not aware of would prevent that.)

Granted, it would be somewhat difficult to trick someone into doing that (Bitcoin transactions include null chars, and I don't think you can copy-paste those) but why take the risk at all?


The "magic string" is prefixed to a message before hashing. You could think of it as setting the hashing function to a particular initial state before hashing the message. It serves only to give some distinction to hashes of Bitcoin-specific messages, by resulting in a hash value that is different from hashing just the bare message. There is no cryptographic reason or consequence for this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.