0

I am receiving transaction envelop and create transaction object using fromEnvelopeXdr. What would be the right way to validate that transaction signatures are valid (without submitting transaction to the network). Thank you

1 Answer 1

1

I'm not aware of a simple single method in any SDK. You could implement it this way:

1) Determine the signature hints of all possible signers

for (pubKey in SomePredefinedList or all affected accounts in tx) {
    hint = StellarSdk.Keypair.fromPublicKey(pubKey).signatureHint()
}

2) Walk through all signatures of the transaction and determine their signature hints

tx = new StellarSdk.Transaction(txXdr);
for (n in tx.signatures) {
    hint = tx.signatures[n].hint();
}

3) Compare signature hints from 1) + 2) to figure out if given signatures are eligible

4) You might want to take into account that even if all signatures are fine, there could be other restrictions that would still lead to a failing transaction. e.g. sequence number, thresholds, time bounds, duplicate signatures.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.