-
Notifications
You must be signed in to change notification settings - Fork 1
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
Document signatures in FAQ #21
Comments
@gsmachado, we should add a question about singing and verifying messages with NeoLine. NeoLine implements some modifications to the message before signing in order to support Ledger (as of now Ledger only supports signing transactions for N3). The steps are shown in the example comment here: So, if you want to sign the message
|
I understand that |
Asked, will come back to you. |
Yes |
it would be good to know WHAT are these hex values... like, transaction type? chain id? what? |
Or, maybe, is this something specific to the Neo app for Ledger, and not Ledger itself?! |
just FYI: https://github.com/LedgerHQ/app-neo3 |
I assume this is the case, yes. Can't confirm it though. |
@hacfox maybe can you clarify these questions? ☝️ We'd like to know what |
@gsmachado @mialbu Yes Look into this part ➡️ serialize from neon-js
|
Furthermore, using the same approach for signmessage on N3 as on Neo Legacy doesn't make sense. Initially, we wanted to ensure compatibility with N3 Ledger, but the transaction construction has changed, so we didn't proceed and opened an issue here. |
@hacfox, So that means that signing a message with NeoLine using Ledger on N3 is not possible at the moment? AFAIK, transaction signing of N3 transactions is possible with the Neo Ledger app. Thus, I conclude with a different prefix/suffix as the |
@csmuller Whether it can be done or not is one thing, but first, consider this: for developers, they are more inclined to perform actions like: data = crypto.sign(message, privatekey); // message = neow3j is awesome! and crypto.verify(data, publickey); Rather than the current situation where rules and strings are added before and after, causing confusion among developers. |
@csmuller And... const message = 'hello world';
const parameterHexString = Buffer.from(message).toString('hex');
const lengthHex = u.num2VarInt(parameterHexString.length / 2);
const concatenatedString = lengthHex + parameterHexString;
const prefix = 000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000;
const messageHex = prefix + concatenatedString;
const signHex = u.num2hexstring(0, 4, true) + u.sha256(messageHex); // u.num2hexstring(0, 4, true) is MagicNumber, set 0 here
const signData = wallet.sign(signHex, privateKey);
const result = wallet.verify(signHex, signData, publicKey);
prefix:
00 verison
00000000 nonce
0000000000000000 systemFee
0000000000000000 networkFee
00000000 validUntilBlock
01 0000000000000000000000000000000000000000 00 signers: length is 1|account|scope
00 attributes: length is 0 Why prefix? Only for transaction-like format! |
No description provided.
The text was updated successfully, but these errors were encountered: