raiden icon indicating copy to clipboard operation
raiden copied to clipboard

Cross Token Network Payments

Open ulope opened this issue 5 years ago • 0 comments
trafficstars

Abstract

We want to support single payments that cross token network boundaries.

Motivation

TBD

Specification

  • Implementation in Raiden itself External makes little sense b/c of difficulties with synchronizing, restartability etc.

  • Raiden Node:

    • Swap will happen in mediator state machine (https://github.com/raiden-network/raiden/issues/6515)
    • The API needs to gain an endpoint that supports payments across TNs (#6516)
    • Cross network payment messages will contain the per hop token network route information
      • Ideally existing single token payments will remain backwards compatible
      • The new format should be enabled using capabilities
    • Nodes will opt in to providing swaps and inform the PFS via a new message (e.g. PFSSwapUpdate) (#6511)
      • CLI option to enable token pairs and set rate premium (#6514)
      • The message will contain a rate premium the node requires over uniswap base. (#6511)
      • The PFS will update the base rate from uniswap every block (https://github.com/raiden-network/raiden-services/issues/853)
      • The swap update need to have a validity period and be re-published before it expires. If not the PFS will remove the swap ability. (#6511)
  • PFS:

    • PFS will gain ability to find paths between multiple token networks (raiden-network/raiden-services#851)
    • The route returned by the PFS will contain the applicable per-hop token network per hop. (raiden-network/raiden-services#852, #6512)
  • WebUI:

    • An interface is needed
  • MVP constraints:

    • Only uniswap as rate source for now
    • Only one rate premium per token pair for both directions
    • Only payments across TNs of the same TNR will be supported
    • PFS will use a fixed amount when querying the rates (amount TBD), i.e. we don't account for slippage for now
  • Possible expansions:

    • Per path request rate calculation
    • Nodes can constrain the max slippage
    • Cross TNR payments
    • Payments with oneself
    • Cross blockchain payments

Backwards Compatibility

Ideally payments within a single TN continue to use the same message format and therefore remain backwards compatible. Should be decided based on implementation effort.

ulope avatar Sep 03 '20 13:09 ulope