iam having an XDR i want to know the transaction hash before i submit that to stellar. i did this in GO by unmarshal the XDR and used the builder to retrieve the hash. Is there nay way that i can do it in JS.

1 Answer 1


If it's a transaction you have, and not a transaction envelope, then the transaction hash is formed using the XDR directly.

const envelopeType = StellarSdk.xdr.EnvelopeType.envelopeTypeTx().toXDR();
const signatureBase = Buffer.concat([networkId, envelopeType, txXDR])
const transactionHash = StellarSdk.hash(signatureBase);

Your Answer

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

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