Understanding Stellar Path Payments
One of Stellar’s most unique features is the Path Payment. Path Payments allow users to send an asset and have it converted into a different asset before arriving at its destination. I send dollars; you receive euros.
For those who are curious, this post will explain what goes on behind the scenes to make path payments work. I’ll assume you’re familiar with concepts like trustlines, the Stellar decentralized exchange (SDEX), and Stellar assets.Why are path payments useful?
Path payments allow a user to send an asset they already hold, and to convert it in transit into an asset a recipient wants to receive. Since the conversion is built into the operation, the sender never needs to touch the destination asset: they can keep a balance in their favored currency, and instantly transact with anyone anywhere in any currency.
Imagine someone in the U.S. — whose account can only hold dollars — wants to send money to a friend in Europe — whose account can only hold euros. In a path-payments-less world, the sender would create a trustline for the euros, check some market orders on the SDEX for converting dollars to euros, find the best rate, submit a buy order, and then send the euros to their friend. It would take some time and effort, and the sender would have to pay fees three times.
Path payment operations simplify the process by eliminating the need for the sender to have a trustline, and by bundling transfer and conversion into a single operation that incurs a single fee. This reduces the overhead and complexity involved in navigating trustlines and the SDEX, and allows a user to easily take advantage of the multiplicity of Stellar assets.Path Payment Strict Send & Strict Receive
There are actually two path payment operations as of Stellar-core v12 — path payment strict send and path payment strict receive.
Path payment strict send allows you to specify the amount of a...