4

Before I submit the transaction to the network I want to convert the 'transaction' in XDR format so that I can save it to database for future reference. I am using Stellar JS library. How to do it?

4

Given transaction is a Transaction object then this will give you base64 encoded XDR:

transaction.toEnvelope().toXDR().toString("base64")
  • Thanks for quick reply. works. Another quick question, is the transaction hash and operation id generated before the transaction is submitted to the network or after? – Prashant Abhishek Feb 27 '18 at 13:03
  • Transaction hash can be generated before submitting to the network using hash() method. Operation ID (Horizon) can be generated once transaction is in the ledger. – Bartek Nowotarski Feb 27 '18 at 14:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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