4

I need to get the transaction records. This information seems to be in XDR. How can I parse it in Java?

4 Answers 4

1

To get the last transactions you can make a request to an Horizon server, if you don't have one you can use public horizon server (horizon.stellar.org) but its limited.

For query transactions you have to call transactions endpoint HERE AN EXAMPLE as you can see there are also human readble informations isn't necessary translating from XDR.

Here the infos that you can receive from transactions' endpoint

  • Transaction's ID/Hash
  • Paging_token
  • Ledger count
  • created_at (datetime of transaction)
  • source_account
  • source_account_sequence (sequence number of source account's transaction)
  • fee_paid (in stroops)
  • operation_count
  • memo_type
  • memo (content of memo field)
1

I have just written a patch for the Java SDK to deserialize TransactionEnvelope XDR.

https://github.com/stellar/java-stellar-sdk/pull/117

If you can wait, hopefully it will be approved and merged. After which you can simply call Transaction.fromEnvelopeXdrBase64(base64String).

If you can't wait, you can copy the code in that PR directly to your project. Specifically, this method and the methods it calls.

0

If you have the Transaction XDR encoded as a base64 string, you can use Transaction.fromEnvelopeXdr(string) to get a Transaction object back.

0
0

The XDR classes in the sdk are generated using xdrgen from the xdr idl files in stellar core. So if you want to parse XDR either use the stubs in the sdk or generate them yourself using that.

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.