In the spirit of newcomers, I was wondering if anyone had a good explanation of the transaction flow in Interledger. How does someone go about sending money from sender to receiver via connectors in the network?
- Interledger payment - A transfer of value from a sender to receiver. A payment may cross currencies, such that the sender sends, for example, USD and the receiver receives BTC. Payments may be split into multiple Interledger Packets and sent through one or more Connectors.
- Interledger packet - A standardized data format that describes the transfer of a discrete amount of value, for example $0.10. Interledger is a request/response protocol so the sender initiates a transfer with an ILP Prepare packet and the request is either successful and returns an ILP Fulfill packet or errors and returns an ILP Reject packet.
- Connector - An intermediary node forwards Interledger packets and converts currencies. The Interledger network is made up of connections between independent connectors. Note that connections between senders, connectors, and receivers are established before any individual payment is made and those connections are assumed to be longer-lived rather than ad-hoc.
- Setup - The sender initiates a payment using a setup protocol such as the Simple Payment Setup Protocol (SPSP). This allows the sender and receiver to communicate the information they need for the rest of the steps.
- "Quoting" - (Optional) The sender can determine the path exchange rate by sending test packets to the receiver (see this thread for more details).
- Prepare - The sender sends an ILP Prepare packet to a connector they are connected to.
- Forwarding - The connector uses the ILP Address from the ILP Prepare packet to determine where to forward the packet to. Each of the connector’s relationships is denominated in a specific currency, so it knows the asset type of the incoming Prepare packet based on which sender it got the packet from. The connector determines the outgoing asset type based on the next connector it will forward the packet to. The connector applies its exchange rate (and optional spread) to the incoming Prepare amount to determine the outgoing Prepare amount, and the connector forwards the packet. Each successive connector repeats this step.
- Receiving - When the ILP Prepare packet arrives at the receiver, they determine whether they want to accept the incoming money based on aspects like the amount that arrived in the packet. To accept the money, the receiver returns an ILP Fulfill packet that proves to all other parties in the path that the packet got to the correct receiver. To reject the money, the receiver would instead return an ILP Reject packet.
- "Forwarding" Back - The Fulfill or Reject packet is relayed back to each connector that forwarded the initial Prepare packet
- Sending More - When the sender gets the Fulfill packet, they know that the Prepare packet was successfully delivered to the receiver. The sender continues to send Prepare packets until they have sent the amount they want to the receiver.
- Bilateral Settlement - Each time an ILP Prepare packet is sent between peers and a Fulfill packet is returned, a debt or obligation to pay is created between those directly connected parties. Depending on the terms of each bilateral relationship, these debts can be very small (less than cents or less than the cost of opening a payment channel) or larger. Peers can settle every second (if their settlement method supports it), every month, or whenever they hit a certain limit – this is decided on a bilateral basis. If settlement occurs very frequently, as with a payment channel, two peers may alternate sending ILP packets and payment channel updates/claims (creating micro-obligations and immediately settling them).
Does that help? Let me know if you think I missed any important details or left open more questions than I answered.
That’s a good and much needed explanation! I might even try explaining things from the perspective of the Lightning Network, but I think it’s worthy of its own blog post.
As a newcomer, I like this! Would it be fair to say that aside from the application layers like SPSP, only steps 3 to 5 are the distilled transfer?
Sure there is more usability and need for the other steps for a useful solution but the SEND and RECEIVE of the money in its essence is really just the Prepare Packet up to the Receiver deciding to send a Fulfill Packet.
Please confirm my understanding.
I would include step 6 because the prepares will timeout if they aren’t fulfilled in time.