Skip to content

docs: add payment streams raw spec#224

Merged
s-tikhomirov merged 25 commits into
masterfrom
payment-streams
Feb 24, 2026
Merged

docs: add payment streams raw spec#224
s-tikhomirov merged 25 commits into
masterfrom
payment-streams

Conversation

@s-tikhomirov
Copy link
Copy Markdown
Contributor

@s-tikhomirov s-tikhomirov commented Dec 11, 2025

Add a functional specification for an MVP protocol describing payment streams for Logos services.

Payment streams enable time-based fund flows from users to service providers.

Key features:

  • Two-level architecture with vaults and streams - vaults hold deposits backing multiple streams
  • Stream lifecycle with states (ACTIVE, PAUSED, CLOSED) and transitions
  • Time-based accrual with configurable rates
  • Optional extensions for epoch caps, delivery receipts, and automatic settlement

This raw spec aims to facilitate discussions about implementation feasibility of this protocol on Nescience.

@s-tikhomirov s-tikhomirov force-pushed the payment-streams branch 8 times, most recently from 66c30f4 to d053778 Compare December 12, 2025 17:30
@s-tikhomirov s-tikhomirov marked this pull request as ready for review December 12, 2025 17:40
@s-tikhomirov
Copy link
Copy Markdown
Contributor Author

s-tikhomirov commented Dec 16, 2025

To be added soon:

  • off-chain protocol considerations (proof of stream ownership)
  • illustrative section on potential EVM-based implementation

Copy link
Copy Markdown
Contributor

@chaitanyaprem chaitanyaprem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread vac/raw/payment-streams.md
Comment thread vac/raw/payment-streams.md Outdated
Comment thread vac/raw/payment-streams.md
Co-authored-by: Hanno Cornelius <68783915+jm-clius@users.noreply.github.com>
Comment thread vac/raw/payment-streams.md Outdated
Comment thread vac/raw/payment-streams.md Outdated
Comment thread vac/raw/payment-streams.md Outdated
Comment thread vac/raw/payment-streams.md Outdated
Copy link
Copy Markdown
Contributor

@jm-clius jm-clius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Comment thread vac/raw/payment-streams.md
The user MAY issue `VaultProof`s to different providers
only if the sum of their promised allocations
does not exceed the vault's unallocated balance.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider this scenario:

User has 1000 tokens in vault
T1: Issues VaultProof A to Provider A (500 tokens)
T2: Issues VaultProof B to Provider B (600 tokens)
T3: Creates stream A (500 tokens) ✅ 
T4: Creates stream B (600 tokens) ❌ Only 500 left!

Provider B accepted the VaultProof but can't actually get their stream. The spec says "user MAY issue VaultProofs only if sum doesn't exceed balance" but this can't be enforced without atomicity.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that this cannot be enforced. A provider may decide to not accept VaultProofs and instead wait for regular stream establishment before serving the first request. The idea is that accepting VaultProof for a single (first) request improves UX significantly while bringing only a limited (to single-response-worth) risk to the provider.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wording clarified in 233c0e4 (the "double-spending" issue remains a known limitation).

monitoring quality and pausing or closing streams
is a reasonable expectation.

Providers SHOULD monitor the stream on-chain
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it matter how frequently and if it can timeout?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Frequency is up to the provider. I would imagine that any on-chain action generates a "receipt" (in Ethereum terminology), and that a provider subscribes to receipts about streams of their interest.

As for timeouts, this could happen as follows:

  • at stream establishment, the provider remembers the planned depletion time of a stream;
  • upon learning of any relevant receipts (pause, top-up), the provider updates the planned depletion time;
  • shortly before depletion time, the provider double-checks stream status on-chain. If the depletion time represented on-chain is as provider expected, the provider stops service provision.

- May cause the entire close operation to fail if claim fails.

Assessing these trade-offs requires clarity on LEZ,
particularly gas model, batching techniques, and timing privacy.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The gas model might be very important when the spec needs to go draft/stable because of possible attack vectors. Just commenting for visibility.

Copy link
Copy Markdown
Contributor

@Cofson Cofson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, this is really solid work - works as a raw spec perfectly. However, there are some gaps that should be addressed before moving to draft status. I would suggest working on some edge cases and perhaps even work a bit with the security team to identify and fix some of the gaps.

@s-tikhomirov s-tikhomirov merged commit 14fd5c0 into master Feb 24, 2026
2 checks passed
@s-tikhomirov s-tikhomirov deleted the payment-streams branch February 24, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants