Skip to content

Question concerning verifying a transaction signer.  #453

@JuergenSimon

Description

@JuergenSimon

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions