|
| 1 | +--- |
| 2 | +sidebar_label: '⛽ Gasless Transactions' |
| 3 | +title: Gasless Transactions on Status Network |
| 4 | +description: Learn how Status Network implements gasless transactions using RLN (Rate Limiting Nullifier), and Karma tiers for spam prevention and fair usage. |
| 5 | +keywords: [Status Network, Gasless Transactions, Linea, RLN, Rate Limiting Nullifier, Karma, Zero-Knowledge Proofs, ZKP, Soulbound Tokens, Blockchain, Layer 2, L2, Spam Prevention] |
| 6 | +--- |
| 7 | + |
| 8 | +# Gasless Transactions in Status Network |
| 9 | + |
| 10 | + |
| 11 | +Status Network aims to introduce gasless transactions at scale. The key component of this gasless approach is Vac's Rate Limiting Nullifier, which permits transaction rate limitation without the need for traditional gas fees. The document describes the architecture and integration elements needed to safely enable gasless transactions. |
| 12 | + |
| 13 | +### 1.2 RLN |
| 14 | + |
| 15 | +RLN is a zero-knowledge system designed to prevent spam without compromising user privacy unless a violation occurs. It replaces traditional gas fees with cryptographic rate limits enforced via ZKPs and Shamir's Secret Sharing. |
| 16 | + |
| 17 | +RLN characteristics: |
| 18 | + |
| 19 | +- **Zero-Knowledge Proofs:** Users generate ZKPs verifying their RLN group membership without revealing their identity. The group membership indicates the maximum gasless transaction throughput for each tier. |
| 20 | +- **Shamir's Secret Sharing and Nullifiers:** Users hold a secret key used to generate unique nullifiers for transactions. If a user exceeds their transaction limit within an epoch (e.g., block or timestamp), their secret key becomes recoverable, exposing them. |
| 21 | +- **Spam Detection:** Users exceeding limits effectively reveal their secret, leading to penalties like Deny List inclusion, higher future gas costs, or potential token slashing. |
| 22 | + |
| 23 | +### 1.3. RLN Membership Management |
| 24 | + |
| 25 | +RLN uses Sparse Merkle Trees to efficiently handle large-scale membership proofs. A benchmarking study determined that a tree height of 20, supporting 1 million accounts, provides optimal performance for proof generation and verification. For scalability beyond 1 million accounts, multiple SMTs can be used with a registry to direct users to the appropriate tree. |
| 26 | + |
| 27 | +The Prover includes a Registrar Service that listens for events from the Karma Contract, where Karma is allocated to new addresses. Upon detecting such an event, the Registrar Service onboards the user to the RLN Membership Contract by generating and registering their RLN credentials (identitySecretHash and identityCommitment). The RLN Prover Service generates proofs for transactions, which are streamed via gRPC to the RLN Verifier in the Sequencer. The Verifier stores these proofs in memory and matches them with incoming transactions based on transaction hashes, as the process is asynchronous. |
| 28 | + |
| 29 | +```mermaid |
| 30 | +graph TD |
| 31 | + A[User Wallet] -->|First L2 Action via Whitelisted App| B(Karma Issued) |
| 32 | + A -->|Bridges into SN| B |
| 33 | + B -->|Soulbound Token| C{Tier Assignment} |
| 34 | +
|
| 35 | + subgraph "Tier Limits" |
| 36 | + D[Basic] |
| 37 | + E[Active] |
| 38 | + F[Regular] |
| 39 | + G[Power User] |
| 40 | + H[High-Throughput] |
| 41 | + I[S-Tier] |
| 42 | + end |
| 43 | +
|
| 44 | + C --> D |
| 45 | + C --> E |
| 46 | + C --> F |
| 47 | + C --> G |
| 48 | + C --> H |
| 49 | + C --> I |
| 50 | +
|
| 51 | + %% RLN Flow |
| 52 | + A -->|Submits Gasless Tx| J[RPC Node] |
| 53 | + J -->|Forwards Tx Data| K[Prover] |
| 54 | + subgraph "Prover Services" |
| 55 | + K --> K1[Registrar Service] |
| 56 | + K --> K2[RLN Prover Service] |
| 57 | + K --> K3[Karma API Service] |
| 58 | + K1 -->|Listens for Karma Events| L[Karma Contract] |
| 59 | + K1 -->|Onboards User| M[RLN Membership Contract] |
| 60 | + K2 -->|Generates RLN Proof| N[gRPC Stream] |
| 61 | + K3 -->|Tracks Tx and Karma Tiers| O[Storage] |
| 62 | + end |
| 63 | + J -->|Sends Tx| P[Sequencer] |
| 64 | + N -->|Streams RLN Proof| P |
| 65 | +
|
| 66 | + %% Sequencer Section |
| 67 | + subgraph "Sequencer Operations" |
| 68 | + P --> Q[RLN Verifier Plugin] |
| 69 | + Q -->|Subscribes to gRPC Stream| N |
| 70 | + Q -->|Stores Proofs In-Memory| R{Match Tx Hash} |
| 71 | + R -->|Validates RLN Proof| S{Quota Check} |
| 72 | + S -->|Within Limit| T[Add to Mempool] |
| 73 | + S -->|Exceeds Limit| U[Deny List] |
| 74 | + U -->|Flags Address| V[Premium Gas Required] |
| 75 | + Q -->|Spam Detected| W[Slash RLN Stake] |
| 76 | + end |
| 77 | +
|
| 78 | + %% Gas Estimation Flow |
| 79 | + A -->|Requests Gas Estimate| X[Modified linea_estimateGas RPC] |
| 80 | + X -->|Queries| U |
| 81 | + U -->|Address Listed| Y[Apply Premium Gas Multiplier] |
| 82 | + Y -->|Pay Premium Gas| Z[Remove from Deny List] |
| 83 | + Z -->|Earn Karma| B |
| 84 | + U -->|Address Not Listed| AA[Standard Gas Estimate] |
| 85 | +
|
| 86 | + %% Styling |
| 87 | + classDef wallet fill:#FFD700,stroke:#DAA520,color:#333 |
| 88 | + classDef karma fill:#98FB98,stroke:#2E8B57,color:#333 |
| 89 | + classDef tier fill:#87CEFA,stroke:#4682B4,color:#333 |
| 90 | + classDef tierNode fill:#ADD8E6,stroke:#4682B4,color:#333 |
| 91 | + classDef rln fill:#FFB6C1,stroke:#DB7093,color:#333 |
| 92 | + classDef sequencer fill:#DDA0DD,stroke:#BA55D3,color:#333 |
| 93 | + classDef gas fill:#FFA07A,stroke:#FF4500,color:#333 |
| 94 | +
|
| 95 | + class A wallet |
| 96 | + class B,L karma |
| 97 | + class C tier |
| 98 | + class D,E,F,G,H,I tierNode |
| 99 | + class J,K,K1,K2,K3,M,N,O rln |
| 100 | + class P,Q,R,S,T,U,V,W sequencer |
| 101 | + class X,Y,Z,AA gas |
| 102 | +``` |
| 103 | + |
| 104 | +## 3. System Components |
| 105 | + |
| 106 | +### 3.1 Prover |
| 107 | + |
| 108 | +The Prover is a system comprising three services: |
| 109 | + |
| 110 | +1. **Registrar Service**: Listens for Karma allocation events from the Karma Contract. When a new address receives Karma, it onboards the user to the RLN Membership Contract by generating RLN credentials and registering them. |
| 111 | +2. **RLN Prover Service**: Generates RLN proofs for transactions using the Zerokit library. Proofs are streamed directly to the RLN Verifier in the Sequencer via a gRPC stream. |
| 112 | +3. **Karma API Service**: Tracks transactions made by users within an epoch and maintains their Karma tier status. It stores transaction data in an internal database for efficient querying and tier management. |
| 113 | + |
| 114 | +These services ensure secure credential management, proof generation, and transaction tracking, with gRPC enabling low-latency communication with the Sequencer. |
| 115 | + |
| 116 | +### 3.2 RLN Verifier |
| 117 | + |
| 118 | +The RLN Verifier is a besu plugin inside the sequencer, leveraging RLN's Zerokit Rust library via Java Native Interface. |
| 119 | +The Verifier: |
| 120 | + |
| 121 | +- Subscribes to the gRPC stream from the RLN Prover Service to receive RLN proofs as they are generated. |
| 122 | +- Stores proofs in memory and matches them with incoming transactions based on transaction hashes, accounting for the asynchronous arrival of transactions (via RPC Node) and proofs (via gRPC). |
| 123 | +- Verifies proof authenticity, nullifier uniqueness, and user transaction quotas. |
| 124 | + |
| 125 | +Transactions failing verification are rejected, and users may be temporarily added to the Deny List. |
| 126 | + |
| 127 | +### 3.3 Deny List |
| 128 | + |
| 129 | +The Deny List temporarily restricts users exceeding quotas or engaging in spam: |
| 130 | + |
| 131 | +- Entries expire after a set duration (e.g., hours or days) based on the throughput tiers |
| 132 | +- Users can bypass restrictions by paying premium gas fees |
| 133 | +- Paying premium fees removes users from the list and earns additional Karma |
| 134 | + |
| 135 | +### 3.4 `linea_estimateGas` RPC Modification |
| 136 | + |
| 137 | +The linea_estimateGas method is customised to account for users on the Deny List: |
| 138 | + |
| 139 | +- Checks user's Deny List status |
| 140 | +- Adds premium gas multipliers if needed |
| 141 | +- Provides transparency and accurate gas estimations to the users |
0 commit comments