Skip to content

Enable multi-hop ILP payments #2229

@mkurapov

Description

@mkurapov

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:

export async function createConnectorService({
logger,
redis,
ratesService,
accountingService,
walletAddressService,
incomingPaymentService,
peerService,
streamServer,
ilpAddress
}: ServiceDependencies): Promise<Rafiki> {
return createApp(
{
//router: router,
logger: logger.child({
service: 'ConnectorService'
}),
accounting: accountingService,
walletAddresses: walletAddressService,
incomingPayments: incomingPaymentService,
peers: peerService,
redis,
rates: ratesService,
streamServer
},

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: 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    storyMajor feature that can be broken up into smaller tasks

    Type

    No type

    Projects

    Status

    Future

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions