signing message gets different result from bitcoin core

+1 vote

Dear multichain,

I need to understand better the sign message algorithm.
I have the following scenario in a bitcoin-compatible Multichain setting:

address: 1PYdSSwsXgJe1MGMzkeXCdshxjMfDP64wi
pvkey: L4PW5JZVpLkNmCKNUSjji3Fpd29s3ci8onwyhvGody4e633Th6vT

signmessage "1PYdSSwsXgJe1MGMzkeXCdshxjMfDP64wi" "message_to_sign"

signature: IC8PmdB4gwxfszrCS0JWPgq/sKt9F+FXtfnZl0eMExNULfcF7rXX7LnGczQ3VaK5pBJQsbn/MGSH/GII+/99zUQ=

I can check the result

verifymessage "1PYdSSwsXgJe1MGMzkeXCdshxjMfDP64wi" "IC8PmdB4gwxfszrCS0JWPgq/sKt9F+FXtfnZl0eMExNULfcF7rXX7LnGczQ3VaK5pBJQsbn/MGSH/GII+/99zUQ=" "message_to_sign"

true

Everything works fine but using bitcoin core I get a different result (I used this online tool https://reinproject.org/bitcoin-signature-tool/#sign) :

-----BEGIN BITCOIN SIGNED MESSAGE-----
message_to_sign
-----BEGIN SIGNATURE-----
1PYdSSwsXgJe1MGMzkeXCdshxjMfDP64wi
IDvDfON3ikxMOXOoOuOl50ZZ517CWqBDcniGMqBH187CVwS3fxXj8WzK13n1QDbov33vyBhs5To8TqdjqWsjxVs=
-----END BITCOIN SIGNED MESSAGE-----

Could you help me understanding this point?

asked Nov 6 by fabio

2 Answers

0 votes
Because of the method used for bitcoin's cryptography, here isn't necessarily only one valid signature for a message. You should cross check using verify message whether MultiChain's signature works in this web tool, and vice versa.
answered Nov 7 by MultiChain
Actually it doesn't and I got the same result using the signing algorithm of other bitcoin compatible wallet such as Mycelium or Electrum.
Could you suggest me where I can find the details of the signing algorithm in the source code of MC so that I can have a look and understand better?
Thanks for your support.
0 votes

OK, I have the right answer now. When signing a message, MultiChain prefixes it with the following:

MultiChain Signed Message:\n

In bitcoin, the prefix is:

Bitcoin Signed Message:\n

So the two message signatures will not be compatible at all. Is this a problem for you?

answered Nov 8 by MultiChain
Thanks for your explanation, pretty clear. It is not a problem, I can understand now.
In order to contribute with the community, I want to share an interesting link explaining in details:
https://bitcoin.stackexchange.com/questions/77324/how-are-bitcoin-signed-messages-generated

Thanks for now.
Fabio
...