Closed jondubois closed 3 years ago
verifyTransaction(transaction) {
if (!this.verifyTransactionId(transaction)) {
return false;
}
let { senderSignature, signatures, ...transactionWithoutSignatures } = transaction;
let transactionJSON = this.stringifyObject(transactionWithoutSignatures);
return this.merkle.verify(transactionJSON, senderSignature, transaction.sigPublicKey);
}
I need to understand better what this does.
The verifyTransaction
method just checks that the transaction is valid. It checks that:
But to ensure that a transaction is signed by a specific account, you would also need to check that the sigPublicKey
on the transaction corresponds to the sigPublicKey
on the account (based on the blockchain data). You can use the getAccount
method on the JS client to get the account details (including their sigPublicKey
) from a node and check that it matches the sigPublicKey
from the transaction.
That said, I think maybe we can not implement this feature right now. It's probably best left to later. I can't remember what the use case was for this feature.
I think we can close this issue as it is not very useful.
User should be able to verify if a transaction is valid (check the signature).