Skip to content
GitHub

Connector

The backend includes an Interledger connector for sending and receiving STREAM packets.

The amounts of these packets are used to update account balances in TigerBeetle. (See Accounts and Transfers)

Amounts are adjusted based on the destination/outgoing account’s asset and Rafiki’s configured exchange rates service.

Packet Origination

The connector receives incoming ILP packets via:

  • HTTP
  • direct calls from within the backend

Incoming HTTP

The backend includes an HTTP server listening on the configured CONNECTOR_PORT.

An incoming ILP packet over HTTP is only accepted if it is from a configured peer and accompanied by the peer’s incoming HTTP authToken.

Backend

The backend includes services for managing Open Payments quotes and outgoing payments. Each of these calls the connector in order to send ILP packets. Quoting sends unfulfillable rate probe packets. Outgoing payments send packets as a part of executing the payment.

These calls to the connector are actually made by calling makeIlpPlugin and passing the plugin to the @interledger/pay library.

Packet Destination

An ILP packet may either terminate at the local Rafiki’s STREAM server or continue on to a peer via HTTP.

Local STREAM Server

The connector attempts to extract and decode the payment tag from a received ILP packet’s destination address. If it is successfully able to match the tag with a locally managed Open Payments wallet address or incoming payment, it will not forward the packet. The connector will credit the corresponding balance as well as track the total amount received for the STREAM connection in Redis in order to support STREAM receipts.

Packets addressed to a wallet address happen via SPSP.

Outgoing HTTP

If the ILP packet’s destination address corresponds to a configured peer, the connector will forward the packet to the peer over HTTP along with the peer’s configured HTTP authToken.

Packet Rejection

The connector may reject a packet with a corresponding ILP error code due to a number of reasons:

  • invalid packet
  • insufficient liquidity
  • rate limit exceeded
  • amount exceeding maxPacketAmount
  • expired packet