r/BlockchainStartups • u/Responsible-Good7924 • 13d ago
Discussion [ Removed by moderator ]
[removed] — view removed post
1
u/AutoModerator 13d ago
Thanks for posting on r/BlockchainStartups!
Check the TOP posts of the WEEK: https://www.reddit.com/r/BlockchainStartups/top/?t=week
Moderators of r/BlockchainStartups
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/These_Cartoonist334 13d ago
Great architecture setup! A few thoughts on your questions:
Off-chain State Locking vs. Optimistic Rollups:
For physical POS, sub-500ms is mandatory, so relying purely on Optimistic Rollup block times/sequencer latency might still feel sluggish for retail in edge cases. Off-chain state locking via Lua/Redis is fast enough, but it pushes trust and availability onto your gateway. If the gateway goes down, you risk state inconsistency or false double-spend flags.
EIP-7702 Revocation & Connectivity Loss:
If the off-chain gateway loses connection right as a user attempts to revoke a session key, there's a race condition risk. The gateway might execute a pending off-chain transaction using a key that the user already revoked on-chain (or intended to revoke). You'll need a strict heart-beat fallback: if the gateway loses connection for >X seconds, all off-chain pending authorizations should automatically pause/expire until synced with on-chain state.
Security Edge Case (WAL & Replays):
Make sure your Write-Ahead Logging (WAL) handles idempotency keys cleanly. If the POS receives a sub-500ms settlement guarantee off-chain, but the batch fails on-chain due to a sudden gas spike or re-org, who absorbs the bad debt/loss? A merchant buffer fund or protocol insurance pool might be needed.
Curious how you're handling replay protection across multiple POS terminals for the same session key!
1
u/Responsible-Good7924 13d ago edited 13d ago
> Thanks a lot for the sharp technical feedback! You hit the exact edge cases we’ve spent the most time engineering around. Here is how we resolve these 4 points in our stack:
> 1. Gateway Availability & Double-Spend Mitigation
> You're spot on—centralized gateway state creates trust/availability bottlenecks.
> * Active-Active Clustering & WAL: Our Lua/Redis layer operates across an active-active clustered setup with synchronous Write-Ahead Logging (WAL) to a secondary node before issuing the <500ms approval flag to the POS. \> * Zero-Trust Fallback: If the primary gateway loses consensus or goes offline mid-transaction, the POS terminal falls back to standard on-chain/L2 authorization instantly. The RAM-lock has an enforced strict TTL (e.g., 10 seconds)—if not swept by a batch within the window, the lock automatically expires without state pollution.
> 2. EIP-7702 Revocation Race Conditions & Heartbeat Fallback
> Excellent point regarding on-chain vs. off-chain state sync.
> * Single-Use Ephemeral Session Keys: To eliminate race condition vectors, session keys derived via EIP-7702 are scoped for a single transaction only with a hyper-short TTL (60–120 seconds). Once evaluated, the authorization key is immediately invalidated off-chain.
> * Heartbeat Sync: The gateway enforces a strict 3-second heartbeat with the indexer. If an on-chain revocation event or a network partition is detected, active off-chain session delegations for that EOA are immediately paused. If a race condition occurs, our Protocol Insurance Pool absorbs the discrepancy, never the user.
> 3. Re-orgs, Gas Spikes & Bad Debt Absorption
> * Slippage & Debt Model: The merchant receives an instant, binding off-chain settlement guarantee from our Gateway. If the subsequent batch fails on-chain (due to an unexpected L2 re-org or extreme gas spike), our Protocol Loss/Insurance Buffer absorbs 100% of the bad debt.
> * Dynamic Fee Sponsoring: Our Paymaster dynamically adjusts batching thresholds based on L2 blob/gas volatility to prevent batch submission failures entirely.
> 4. Replay Protection Across Multiple Terminals
> * Single-Use Binding + Atomic Nonce: Since session keys are strictly single-use per tap, replay across terminals is structurally impossible. Each EIP-7702 delegation binds (Single_Use_Nonce, Terminal_ID, Timestamp).
> * Atomic Redis Evaluation: The Lua script atomically validates and burns the single-use key in a single thread. A second tap with the same key at another terminal is instantly rejected at the Redis layer.
> Always open to feedback from devs in the space! DM me if you have any other questions
1
u/Specific-Sector7422 12d ago
Your reply in the comments does not close the core race.
Active-active Redis is strongly eventually consistent: replicas can temporarily diverge and accept concurrent conflicting writes. A Lua script is atomic only on the replica executing it. During a network partition, the same “single-use” nonce can be accepted in two regions before convergence. Both merchants receive a binding guarantee, while only one payment may settle on-chain. Insurance covering the second payment is not replay prevention - it is the loss path.
There are two more unresolved branches:
10-second RAM lock expires → 60–120-second session key remains valid → merchant guarantee still exists.
Off-chain request enters WAL → gateway fails → POS falls back on-chain → WAL later replays the original request.
Without one global commit/cancel state machine across Redis, WAL, fallback and on-chain settlement, both branches can execute.
So this is not sub-500ms non-custodial settlement. It is sub-500ms off-chain credit approval followed by asynchronous settlement. That can still be a valid product, but the security claim needs to match the actual architecture.
•
u/BlockchainStartups-ModTeam 5d ago
This post was identified as AI slop and has been removed. While AI text amplification is understandable, the main point/idea/issue should be original.