Skip to content

XSC-0003: Streaming Payments

XSC-0003 describes time-based token streaming on Xian.

In the current maintained repos, the streaming implementation is a standalone contract package, con_stream_payments, rather than part of the canonical currency token contract.

Current Maintained Surface

The maintained stream-payments package exposes functions such as:

python
@export
def create_stream(
    token_contract: str,
    receiver: str,
    rate: float,
    begins: str,
    closes: str,
):
    ...

@export
def create_stream_from_permit(...):
    ...

@export
def balance_stream(stream_id: str):
    ...

@export
def change_close_time(stream_id: str, new_close_time: str):
    ...

@export
def finalize_stream(stream_id: str):
    ...

@export
def forfeit_stream(stream_id: str):
    ...

The exact contract lives in xian-contracts/contracts/stream-payments/.

Stream Model

The current maintained package uses an escrowed model:

  • the full stream budget is funded up front
  • accrued value can be claimed over time
  • the sender can shorten a stream and receive the unvested refund
  • the receiver can forfeit the future part of a stream

This is a clearer model than the older legacy embedded stream logic from the historical genesis token.

Dependencies

The token contract used by con_stream_payments must expose:

  • transfer(amount, to)
  • transfer_from(amount, to, main_account)

Event Expectations

The current maintained package emits:

  • StreamCreated
  • StreamBalanced
  • StreamCloseChanged
  • StreamForfeited
  • StreamFinalized

Notes

  • stream accrual is still lazy and block-time based; nothing runs in the background between blocks
  • create_stream_from_permit(...) authorizes the stream parameters, but the sender still needs the token-side approval needed for escrow funding