1

I'm trying to create an application where I can charge a fixed amount of USD in XLM. I believe I can use path payment in order to accomplish this. But I'm not sure I understand what happens if I omit the path, will this accomplish the goal of getting me any path between XLM and USD?

I'm looking through the documentation and it seems like I can do something like

  1. Set up Trustline between recipient account with USD issuer account
  2. Find Path Payment with a USD issuer account between destination account and issuer
  3. Set up offer between destination account and (I'm not sure what this means)
  4. Use path payment and the destination account will receive 1 USD in lumens.

But step 3 confuses me.

My ideal world would be one where I could say send 1 dollars worth of lumens from source account to destination account, but i can't figure out how I would do that.

Thank you for any help you could be!

0

It helps to think of this in two distinct steps.

  1. The recipient account sets up a trust line with the USD issuer. This is required so that the recipient can receive the payment.
  2. The sender pays XLM to the recipient, who receives USD.

The conversion happens on the DEX. The two parties involved in the payment do not need to create offers on the DEX. However, offers need to exist for a path payment to work.

Consider Alice paying USD to Bob. Alice does not have a USD trustline, but Bob does. This means Bob can receive it, but Alice can't hold it in order to send it.

Meanwhile, Charlie has an open order to Buy XLM and sell USD.

Alice can specify a path payment to Bob, where the sending asset is XLM and the destination amount is in USD. This path payment would match Charlies order, but with two counterparties. The XLM will flow from Alice to Charlie and the USD will flow from Charlie to Bob. It happens transactionally.

In this example, the path of the operation would be empty - because the source and destination are sufficient to specify the full path. But it is possible to hop through multiple assets. Indeed it might be cheaper to satisfy a payment via a longer path. In these cases the intermediate assets would be listed in the path.

Because XLM is trusted by every account, I assume it is common for a path payment between two exotic assets to look like FOO->XLM->BAR. In such a case there would be two orders matched on the DEX, one for FOO/XLM and another for XLM/BAR.

  • 1
    Ah that makes sense, so for testing purposes I would probably want to set up an offer, but in so far as I find a good issuer with reliable market prices then path payment will work out. Thank you! – Sean Reimer Jul 21 at 22:07

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.