Skip to content

XSC-0003: Streaming Token

XSC-0003 extends the XSC-0001 fungible-token interface with time-based payment streams. A conforming contract keeps balances, allowances, and streams in the same token contract.

Required Token Surface

An XSC-0003 token preserves the XSC-0001 functions:

  • change_metadata(key, value)
  • transfer(amount, to)
  • approve(amount, to)
  • transfer_from(amount, to, main_account)
  • balance_of(address)

It also exposes:

text
create_stream(receiver, rate, begins, closes)
balance_stream(stream_id)
change_close_time(stream_id, new_close_time)
finalize_stream(stream_id)
close_balance_finalize(stream_id)
balance_finalize(stream_id)
forfeit_stream(stream_id)

Stream Model

Each stream records its sender, receiver, start and close times, payment rate, claimed amount, and status. The stream identifier is derived deterministically from the stream parameters.

Accrual is lazy: the contract calculates and transfers the amount due when a stream function runs in a later block. Nothing executes between blocks.

Events

In addition to XSC-0001 Transfer and Approve events, the reference contract emits:

  • StreamCreated
  • StreamBalance
  • StreamCloseChange
  • StreamForfeit
  • StreamFinalized

Compatibility Notes

  • Keep function and argument names stable.
  • Parse begins, closes, and close-time updates as YYYY-MM-DD HH:MM:SS, and base accrual on finalized block time.
  • XSC-0003 does not define permit signatures. Pair it with XSC-0002 when signature-based approvals are needed.
  • The maintained reference implementation is xian-xips/XSC003_streaming_token.

The separate con_stream_payments package streams arbitrary external tokens through escrow. It is an application contract, not the XSC-0003 token interface. See Streaming Payments.