# External Protocol Integration (Connext, Raiden, Statechannels.org)

This document describes how external payment-channel and state-channel protocols complement the in-repo PaymentChannelManager and GenericStateChannelManager.

---

## When to use what

| Use case | In this repo | External option |
|----------|--------------|-----------------|
| Same-chain, direct A↔B payments | **PaymentChannelManager** | — |
| Same-chain payments + attested state (stateHash) | **GenericStateChannelManager** | — |
| Cross-chain or routed payments | — | **Connext** |
| Payment channel network (many nodes, path finding) | — | **Raiden** |
| Full state channel framework (arbitrary state machines) | — | **Statechannels.org** |
| Chain-138 visibility on Mainnet | Transaction Mirror + MainnetTether (unchanged) | — |

---

## Connext (cross-chain and routed payments)

- **Site / docs**: [Connext](https://connext.network/) · [Docs](https://docs.connext.network/)
- **Capabilities**: Multi-chain transfers, xcalls, liquidity pools, virtual/routed payments.
- **When to use**: Cross-chain transfers, or when you want routed liquidity instead of direct A↔B channels.
- **Integration**: Use the Connext SDK in the frontend or a backend; link from the Channels UI (“Pay via Connext” / “Cross-chain transfer”). Does not replace PaymentChannelManager; use both as needed.

---

## Raiden (payment channel network)

- **Site / docs**: [Raiden Network](https://raiden.network/) · [Developer docs](https://docs.raiden.network/)
- **Capabilities**: Payment channel network on Ethereum, path finding, multi-hop transfers.
- **When to use**: Same-chain payments when you need a network of channels (many participants, routing) rather than single A↔B channels.
- **Integration**: Link from docs/UI for users who need channel networks; our PaymentChannelManager remains for simple direct channels.

---

## Statechannels.org (general state channels)

- **Site / docs**: [Statechannels.org](https://statechannels.org/) · [Docs](https://docs.statechannels.org/)
- **Capabilities**: General state channel framework: arbitrary state, state transition rules, dispute resolution.
- **When to use**: Applications that need full state channels (e.g. turn-based games, complex conditional flows), not just payment balances.
- **Integration**: Document and link from the Channels UI (“State channels (advanced)”) so users can use Statechannels.org for general state; our contracts cover payment channels and optional generic state (stateHash) settlement.

---

## Summary

- **This repo**: Payment channels (PaymentChannelManager) and optional generic state channels (GenericStateChannelManager with stateHash).
- **Connext**: Cross-chain and routed payments; link from the app.
- **Raiden**: Same-chain payment channel network; link for users who need routing.
- **Statechannels.org**: Full state channel framework; link for users who need arbitrary state machines.

All three external options are optional; our contracts are sufficient for direct payment channels and for stateHash-committed settlement on Mainnet and Chain-138.
