rafiki icon indicating copy to clipboard operation
rafiki copied to clipboard

Enable multi-hop ILP payments

Open mkurapov opened this issue 2 years ago • 0 comments

Context

We want to see if we are able to send ILP packets across different peers running Rafiki.

Say we have Rafiki instances A, B, C, where A is peered with B, and B is peered with C. Since they are all running ILP connectors, we should theoretically be able to send a payment from A to C.

It looks like currently this isn't supported. Whenever we try a payment from A to C, we end up not being able to a) resolve state.streamDestination in createStreamAddressMiddleware and by extension, fetch the outgoing account in createAccountMiddleware (which should end up being the peer of the next hop).

However, we already have files that seem to do the functionality that we want in packages/backend/src/payment-method/ilp/connector/ilp-routing. There is a README in the folder that might be helpful.

Additionally, we have some commented out code in the connector that should be able to enable the routing:

https://github.com/interledger/rafiki/blob/48fb07a7e587aa6d54bb88c2db5cec773a9cf0b7/packages/backend/src/payment-method/ilp/connector/index.ts#L42-L66

This issue will be about making this code work to support multi-hop ILP payments. We should test this by spinning up another Rafiki instance in the local playground, peering with one of the default instances only (ie. happy-life-bank), and sending a payment from cloud-nine to the new instance. A branch with a 3-Rafiki instance localplayground is available here: https://github.com/interledger/rafiki/compare/main...rp--multi-hop-setup

Resources

https://github.com/interledger/rafiki/blob/7f332c725a9050fcd70566ea0e8b310a86578f18/packages/connector/src/connector.ts

https://interledger.org/developers/rfcs/ilp-addresses/ https://github.dev/interledger/rafiki/tree/7f332c725a9050fcd70566ea0e8b310a86578f18

Todos

  • [ ] #2742

mkurapov avatar Nov 28 '23 10:11 mkurapov