Set
Table of Contents
- Architecture
- Key Features
- Chain Configuration
- Directory Structure
- Technology Stack
- Quick Start
- Smart Contracts
- Anchor Service
- Integration with stateset-sequencer
- Docker Deployment
- Testing
- Deployment Checklist
- Monitoring
- Security
- Decentralization and Fault Proofs
- Scorecard
- Troubleshooting
- Resources
Architecture
Key Features
| Feature | Description |
|---|---|
| 2-second block times | Fast confirmations optimized for commerce operations |
| Low gas fees | EIP-1559 parameters tuned for merchant transactions |
| Merkle root anchoring | Verifiable event commitments from stateset-sequencer |
| Multi-tenant isolation | Per-tenant/store state tracking via keccak256(tenantId, storeId) |
| Inclusion proof verification | On-chain verification of off-chain events |
| Gas sponsorship | Merchants can sponsor user transactions via SetPaymaster |
| Strict mode verification | State chain continuity checking to prevent gaps/forks |
Chain Configuration
| Parameter | Value |
|---|---|
| Chain ID | 84532001 |
| Block Time | 2 seconds |
| Gas Limit | 30M gas/block |
| L1 Settlement | Ethereum Sepolia (11155111) |
| Native Token | ETH |
| EVM Version | Cancun |
| OP Contracts Version | v1.8.0 |
Directory Structure
Technology Stack
Languages & Frameworks
| Component | Technology | Version |
|---|---|---|
| Smart Contracts | Solidity | 0.8.20 |
| Contract Framework | Foundry (Forge) | Latest |
| Anchor Service | Rust | 2021 Edition |
| Async Runtime | Tokio | Full features |
| Ethereum Client | Alloy | 0.9 |
| HTTP Server | Axum | 0.8 |
| Scripting | Bash | - |
OP Stack Components
| Component | Purpose |
|---|---|
| op-geth | L2 execution client (EVM) |
| op-node | L2 consensus client |
| op-batcher | Submits transaction batches to L1 |
| op-proposer | Submits state roots to L1 |
| op-challenger | Dispute resolution |
Dependencies
Solidity:- OpenZeppelin Contracts (Upgradeable patterns)
- Forge-std (Testing)
tokio- Async runtimealloy- Ethereum interactionsaxum- HTTP server for health endpointstracing- Structured loggingserde- Serializationreqwest- HTTP client
Quick Start
Local Development (Anvil)
The fastest way to get started for development and testing:| Account | Address | Private Key |
|---|---|---|
| Account 0 | 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 | 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 |
| Account 1 | 0x70997970C51812dc3A010C7d01b50e0d17dc79C8 | 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d |
| … | See ./scripts/dev.sh accounts for all 10 accounts |
Full Devnet
For a complete L2 environment with all OP Stack components: Prerequisites:- Go 1.21+
- Rust 1.70+
- Docker & Docker Compose
- 2+ ETH on Sepolia (for deployment)
Smart Contracts
SetRegistry
The SetRegistry contract stores batch commitments from the stateset-sequencer, enabling on-chain verification of off-chain commerce events. Key Features:- Multi-sequencer authorization
- State chain continuity verification
- Merkle inclusion proof verification
- Per-tenant/store isolation
| Function | Description |
|---|---|
commitBatch() | Submit a batch commitment with Merkle roots |
verifyInclusion() | Verify an event is included in a committed batch |
getLatestStateRoot() | Get current state root for a tenant/store |
setSequencerAuthorization() | Admin: authorize/revoke sequencers |
setStrictMode() | Enable/disable state chain verification |
SetPaymaster
Gas abstraction for sponsored commerce transactions, allowing merchants to pay for user gas fees. Sponsorship Tiers:| Tier | Monthly Limit | Per-Tx Limit |
|---|---|---|
| Starter | 0.1 ETH | 0.001 ETH |
| Growth | 1 ETH | 0.01 ETH |
| Enterprise | 10 ETH | 0.1 ETH |
| Operation | Description |
|---|---|
ORDER_CREATE | Creating new orders |
ORDER_UPDATE | Updating order status |
PAYMENT_PROCESS | Processing payments |
INVENTORY_UPDATE | Updating inventory |
RETURN_PROCESS | Processing returns |
COMMITMENT_ANCHOR | Anchoring commitments |
OTHER | Other operations |
- Per-transaction and daily/monthly spend limits
- Automatic refund of unused gas
- Category-based sponsorship
- Merchant dashboards
Anchor Service
The anchor service (set-anchor) is a Rust service that bridges the stateset-sequencer to the SetRegistry contract on-chain.
Building
Running
Health Endpoints
The anchor service exposes health and metrics endpoints:| Endpoint | Description |
|---|---|
GET /health | Liveness probe (service is running) |
GET /ready | Readiness probe (connected to chain and sequencer) |
GET /metrics | Prometheus-format metrics |
GET /stats | JSON statistics (anchored count, last anchor time, etc.) |
Integration with stateset-sequencer
Set integrates with the stateset-sequencer through a two-phase process:| Endpoint | Method | Description |
|---|---|---|
/v1/commitments/pending | GET | List unanchored commitments |
/v1/commitments/{id}/anchored | POST | Notify of successful anchoring |
Docker Deployment
Local Devnet
Sepolia Testnet
With Optional Services
Alternative L1 Clients
Testing
Contract Tests
Anchor Service Tests
Deployment Checklist
Accounts Setup
-
Generate 5 Ethereum accounts:
- Admin (owns contracts)
- Batcher (submits batches to L1)
- Proposer (submits state roots)
- Challenger (dispute resolution)
- Sequencer (L2 block production)
- Fund each account with 0.5+ Sepolia ETH
Infrastructure
- Configure Sepolia RPC endpoint (Infura/Alchemy)
- Set up JWT secret for engine API authentication
- Prepare data directories for persistent storage
Deployment
- Run
deploy-l1.sh- Deploy OP Stack contracts to Sepolia - Run
generate-genesis.sh- Create L2 genesis block - Start L2 nodes (op-geth, op-node)
- Start op-batcher and op-proposer
- Deploy SetRegistry to L2
- Deploy SetPaymaster to L2
- Start anchor service
Verification
- Verify L2 is producing blocks (2s intervals)
- Verify batches are being submitted to L1
- Test anchor service connectivity
- Verify contract deployments with
cast
Monitoring
Seedocs/monitoring.md for SLOs, alert suggestions, and metric definitions.
Key Metrics
| Metric | Expected | Alert Threshold |
|---|---|---|
| Block production | Every 2 seconds | > 10s gap |
| Batch submission | Every few minutes | > 30 min gap |
| Anchor lag | < 5 minutes | > 15 minutes |
| L2 safe head lag | < 10 blocks | > 100 blocks |
Viewing Logs
Anchor Service Metrics
Security
Best Practices
- Multi-sig admin: Use a multisig wallet for admin/owner roles in production
- Key management: Never commit private keys; use environment variables or secret managers
- Sequencer authorization: Only authorize trusted sequencer addresses
- Strict mode: Enable strict mode in production to prevent state gaps
- Threat model: Review and maintain
docs/threat-model.md - Operations runbook: Keep
docs/runbook.mdcurrent with incident response steps - Governance policy: Maintain
docs/security.mdfor upgrade and key management
Pre-Production Checklist
- Smart contract audit completed
- Penetration testing of anchor service
- Key rotation procedures documented
- Incident response plan prepared
- Monitoring and alerting configured
Decentralization and Fault Proofs
Seedocs/decentralization.md and docs/fault-proofs.md for the phased
decentralization plan and fault-proof operations. Validate production config with:
Scorecard
Seedocs/scorecard.md for the 10/10 rubric and progress tracking. Supporting
docs include docs/threat-model.md, docs/security.md, docs/runbook.md, and
docs/architecture.md.
Troubleshooting
Common Issues
L2 not producing blocks:Resources
Documentation
Project Documentation
- Local Testing Guide
- Architecture Overview
- Scorecard
- Toolchain Versions
- Monitoring and SLOs
- Security and Governance
- Node Operator Guide
- Integration Example
- Block Explorer and Indexing
- Bridge and Onramp Support
- Operations History
- SDK
- Audit Report
- Governance Evidence
- Fault Proof Exercise Log
- Decentralization Roadmap
- Fault Proof Operations
- Threat Model
- Operations Runbook
Related Projects
- StateSet Sequencer - Off-chain commerce event processing
- StateSet Network - Parent project documentation