Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to fix sign and verify messages for altcoins. I don't know how to do this. #1

Closed
username1565 opened this issue Oct 13, 2018 · 1 comment

Comments

@username1565
Copy link
Owner

username1565 commented Oct 13, 2018

I don't understand C++ syntax of the source code
in altcoins modules for signing and verify messages,
so I cann't fix this script to be compatible with altcoins wallets.

For example, we can using signing and verify the signed messages for altcoins:

  1. Go here: https://username1565.github.io/brainwallet.github.io/
  2. Select in the menu the Vertcoin (VTC) or another altcoin.
  3. Go to "sign" tab.
  4. As you can see, there is using private key and address for altcoins.
  5. Sign message:
    Private key: 'KwSrQfTpAq6zodDmBvk8RzgqL9D35EFcDPg4NEprfzv77VyMr6Kc'
    Address: 'VejdSd7zrm3XSok4CC8t94rTfZVuBwUStu'
    Message: 'This is an example of a signed message.'
    Signature type: 'Inputs.IO'
  6. Click "Sign Message" button.
  7. Result:
    '-----BEGIN BITCOIN SIGNED MESSAGE-----
    This is an example of a signed message.
    -----BEGIN SIGNATURE-----
    VejdSd7zrm3XSok4CC8t94rTfZVuBwUStu
    H4zF7QP0kQZ3WnMYRXZNGvJy7j9pWHYD4MR2GBYFgL47ei2CIngAlN2eJzO8bw+DGDkkhvhAxUwurjjkhALaKnY=
    -----END BITCOIN SIGNED MESSAGE-----'
  8. This result can be verified only by script, using permalink or copy and paste the signed message.
    Permalink:
    https://username1565.github.io/brainwallet.github.io/#verify?vrAddr=VejdSd7zrm3XSok4CC8t94rTfZVuBwUStu&vrMsg=This%20is%20an%20example%20of%20a%20signed%20message.&vrSig=H4zF7QP0kQZ3WnMYRXZNGvJy7j9pWHYD4MR2GBYFgL47ei2CIngAlN2eJzO8bw%2BDGDkkhvhAxUwurjjkhALaKnY%3D
    result: Message verified to be from VejdSd7zrm3XSok4CC8t94rTfZVuBwUStu (permalink)

But in vertcoin-qt wallet "Message verification failed".
Also, the message, which signed in vertcoin-qt wallet -
cann't be successfully verified using brainwallet "Verify" tab:
https://username1565.github.io/brainwallet.github.io/#verify

Here is the source code of module for signing and verify messages, in vertcoin-qt.exe:
https://github.com/vertcoin-project/vertcoin-core/blob/0.13.0/src/qt/signverifymessagedialog.cpp
But I don't understand anything there.

Can anyone fix this for all another altcoins?

Also, I see here https://github.com/username1565/brainwallet.github.io/blob/master/js/bitcoinsig.js
there is the prefix for message digest:

function msg_digest(message) {
    var b = msg_bytes("Bitcoin Signed Message:\n").concat(msg_bytes(message));
    return Crypto.SHA256(Crypto.SHA256(b, {asBytes:true}), {asBytes:true});
}

and here: https://github.com/vertcoin-project/vertcoin-core/blob/0.13.0/src/qt/signverifymessagedialog.cpp is using strMessageMagic
and this is defined here: https://github.com/vertcoin-project/vertcoin-core/blob/0.13.0/src/validation.cpp
as

const std::string strMessageMagic = "Vertcoin Signed Message:\n";
@username1565
Copy link
Owner Author

This issue - already resolved: de17257

username1565 added a commit that referenced this issue Apr 9, 2020
Add strMessageMagic = "Guncoin Signed Message:\n"
from https://github.com/guncoin/guncoin/blob/master/src/validation.cpp
to make working signing and verifying the messages.
See this issue: #1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant