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

Question concerning verifying a transaction signer. #453

Open
JuergenSimon opened this issue Sep 10, 2019 · 0 comments
Open

Question concerning verifying a transaction signer. #453

JuergenSimon opened this issue Sep 10, 2019 · 0 comments

Comments

@JuergenSimon
Copy link

HI there. This is not an issue report but I have a question around verifying if a transaction was signed by a certain person using steem.js code and I'm having trouble finding someone who can help. Assuming I have an blockchain transaction, signed with a private posting key. I had success getting the signature using this code:

const Signature = require('steem/lib/auth/ecc/src/signature');
const signature = Signature.fromHex(signedTransaction.signatures[0]);

Now I pull the public key from the get_accounts operation and can construct an object like so:

const PublicKey = require('steem/lib/auth/ecc/src/key_public');
const publicKey = PublicKey.fromString(profile['posting'].key_auths[0][0]);

So far so good. But now I want to figure out if the transaction was signed by the private posting key belonging to the public posting key. I try the following code:

const Operations = require('steem/lib/auth/serializer/src/operations');
const buffer = Operations.signed_transaction.toBuffer(signedTransaction);
const isValid = signature.verifyHex(buffer.toString('hex'), publicKey);

Since the transaction was signed with the user's private posting key, I would expect the signature to verify that. However, the result is always false. What am I overlooking?

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