waku-org / pm

Project management, admin, misc
3 stars 1 forks source link

RLN Design Patterns - Practical Development and UX Best Practices #102

Open fryorcraken opened 9 months ago

fryorcraken commented 9 months ago

All or part of this issue is likely to become its own milestone and encompass the work tracked with https://github.com/waku-org/pm/issues/71 and https://github.com/waku-org/pm/issues/87

Introduction

The usage of RLN for the Waku Network introduces a number of UX and Dev Ex challenges. Some of the challenges are fundamental in nature (https://github.com/waku-org/research/issues/45), impacting anyone building in a given context. While other are circumstantial (https://github.com/waku-org/pm/issues/71), based on the specific needs of a given application.

This issue attempt to identify a roadmap for the latter.

Process

  1. Identify a use case, clarify the user stories and requirements,
  2. Understand user and messages flows and potential issues,
  3. Design one or several solution to fulfil criteria, highlight pros and cons of each solution,
  4. Implement PoC that uses such solution, confirm assumptions,
  5. Identify assets needed for smooth dev ex (SDKs, etc)
  6. Produce assets
  7. Document usage

For example, in the case of Status Communities (just an example, this are not the actual agreed requirements).

(1) Use case and user stories

Status Communities:

(2) user and message flows

sequenceDiagram
    Member->>Owner: request to join
    Owner-->>Member: accept request

(3) Solutions

(a) Deploy a Waku node that attach rln proof for incoming light push messages This node validate that messages are valid community requests before attaching proof This node runs own traditional DDOS protection (IP rate limit) to not burn through rate limits

cons:

(b) Modify RLN smart contract so that Ethereum address that adds a membership can also remove membership without knowing secret.

cons:

etc.

(4) Select one or several solution and build a PoC (5) Learn from PoC, identify SDKs or protocol changes needed to provide turnkey solution. E.g. enable validation plug-in so that such node can easily validate request messages. (6) Build said SDK/protocols (7) Document, release

Use Cases

A. User Pays for Membership - No Infra model

Most straightforward model where the user pays for their own membership. Developer only write code and ship it, no or minimal hosting from developer (e.g maybe a webpage hosted). Similar to how one would use Ethereum (pay own gas).

In this model, we do need to review common wallet practices and whether any catering special catering is needed.

B. Developers/project pay for Membership - Project Sponsored Model

In this model, the project or developer or ecosystem is funding the RLN membership acquisition. This could be a model similar to:

To consider:

C. Specific Actors pay for Membership - User Sponsor User model

Basically Status Community model. https://github.com/waku-org/pm/issues/71

D. User Shares RLN Membership Across Devices or Application

Assuming user has mobile wallet, used wallet to buy RLN membership. User visit webapp using Waku on Desktop, user wants to use existing RLN membership in webapp.

Similar scenarios exists:

E. User invites user - user pays for other user

Alice is already onboarded on Waku dApp, she wants Bob to join in. Alice pays for Bob's RLN credential so that Bob does not need crypto to onboard on the dApp.

sequenceDiagram
Alice->>Bob: (IRL): "hey, join this cool dApp"
Bob->>Bob: Install/open dApp
Bob->>Bob: Selects "other user onboards you" option
Bob->>Bob: dApp generated RLN credentials
Bob->>Alice: waku-rln://key:3d9e...930c (via QR code, NFC touch or message using centralized service)
Alice->>Blockchain: insert key 3d9e...930c
Blockchain->>Bob: membership index is 42
Bob->>Alice: (in dApp) "Thank you!"
fryorcraken commented 9 months ago

An idea regarding sponsorship of RLN membership. we could have a special content topic or pubsub topic where RLN is not applied but instead another rate limit rules are applied.

Message would contain:

All nodes

Sponsoring node (run by developers or special user):

Cons:

lucille-bellepleure commented 8 months ago

Labs is working on E <3

fryorcraken commented 8 months ago

For C., I wonder what would be the security implication of a community owner pre-registering 100 memberships (generated 100 keys locally) and then distribute secrets to community members. The owner will not use the membership to send messages, as the whole point is to enable their members to send messages.

What information can the owner learn from knowing the secret? @rymnc, thoughts?

rymnc commented 8 months ago

If the owner device is compromised, then all participants will get slashed. I would greatly advice using a stealth commitment scheme that allows a server to generate commitments that only one user may derive private keys for

poc: https://github.com/rymnc/erc-5564-bn254

fryorcraken commented 8 months ago

Need to add another pattern in terms of credentials sharing. The simplest use cases/way to frame it would be:

  1. How should a user handle several apps? Use the same credentials across apps or get new credentials for each app.
  2. How should a user handle several devices? Ditto.

Some concrete use case:

kaichaosun commented 8 months ago

Here are the scenarios I may embed in a demo messaging app and related to RLN,

(Related to C) For group chat, community owner pays for the RLN

Notes:

(Related to A, E) For 1 to 1 chat, either self pay for the RLN, or pay by another actor and shared with inviting link

Note:

Questions,

What's the price of the RLN membership?

Currently, the RLN membership is network level and not community level. Fine-grained control by differentiate multiple levels of RLN membership could be helpful by split network loads, which could result in lower price of such membership?

What if I want to provide free tier for 1to1 and group chat, how to make it acceptable within The Waku Network/community? With an upgrade option available to use RLN for extra features like spam protection, use relay/store service in a high priority and longer persistence.

Different roles should have different settings regarding messaging rate, will RLN be a good fit for this kind of requirements?

fryorcraken commented 7 months ago

(Related to C) For group chat, community owner pays for the RLN

Moving the convo to https://github.com/waku-org/pm/issues/71#issuecomment-1873631088 to not bloat this issue.

fryorcraken commented 6 months ago

for B. We could provide software for developers to deploy a waku node with light push that attaches memberships to messages in behalf of users. Then the user can move from a free tier and use the same node to acquire a membership via stealth commitment.

fryorcraken commented 6 months ago

For E. and generally, can a referral system be in place with kick back for users?

fryorcraken commented 5 months ago

Idea for B. https://github.com/waku-org/pm/issues/148 Where instead of inserting memberships for users, the project attach proofs for users. Particularly relevant when using Waku to ask for wallet signature (tx, auth).