Skip to content
boneh-roughgarden-wev logo

Boneh-Roughgarden WEV Skill

boneh-roughgarden-wev

Boneh-Roughgarden WEV Skill

plurigrid/asi0installs67stars

SKILL.md

Full skill instructions

Boneh-Roughgarden WEV Skill

Trit: 0 (ERGODIC) - Mechanism design at equilibrium

Stanford FDCI research bridge connecting Dan Boneh's cryptographic primitives (ZK proofs, BLS signatures, threshold cryptography) with Tim Roughgarden's mechanism design (TFM, MEV mitigation, welfare maximization).

WEV = World Extractable Value: Protocol-aligned value extraction via GF(3) conservation, not adversarial MEV.


Research Foundations

Stanford Future of Digital Currency Initiative (FDCI)

ResearchAuthorsKey InsightWEV Connection
SPEEDEXRamseyer, Ruan, Goyal, Duffie, MazièresBatch DEX eliminating front-runningNo ordering → no MEV → pure WEV
GroundhogRamseyer, MazièresCommutative transaction semanticsDeterministic concurrency = SPI
TFM Post-MEVBahrani, Garimidi, RoughgardenActive block producer modelSearcher-Proposer separation
Collusion-ResilienceChung, Roughgarden, ShiCollusion-proof mechanismsGF(3) tripartite structure

Boneh Primitives

PrimitivePaperApplication
BLS SignaturesBoneh-Lynn-Shacham 2001Threshold aggregation, DRAND
ZK ProofsGroth16, PLONK contributionsOn-chain state verification
VRFsMicali, Rabin, Vadhan + BonehUnpredictable determinism
Recursive SNARKsNova (Kothapalli, Setty, Boneh)Incremental verification

Roughgarden Mechanism Design

ConceptApplicationGF(3) Mapping
Incentive CompatibilityUsers report true valuationsReafference = prediction ≡ observation
Welfare MaximizationTotal surplus optimizationsum(trits) ≡ 0 ⟹ balanced extraction
DSIC + OCA-proofnessNo collusion advantageTripartite prevents 2-party collusion
SAKA Mechanism~50% welfare guaranteeReserve-commit = bulk-boundary

WEV vs MEV

MEV (Maximal Extractable Value)

MEV = Adversarial extraction by block producers
    = front-running + sandwich attacks + reordering
    = User harm + market inefficiency

WEV (World Extractable Value)

WEV = Protocol-aligned extraction
    = base_value × staleness_mult × scarcity_mult
    = Sequencing advantage without user harm

Key Difference: WEV emerges from GF(3)-conserved triads, not transaction reordering.

Mathematical Foundation

From GAY_LITEPAPER:

# WEV extraction function
function extract_wev(agent, world)
    base = compute_base_value(agent.colors)
    staleness = exp(world.age / STALENESS_CONSTANT)
    scarcity = 1 / (1 + world.color_frequency[agent.current_color])
    
    return base * staleness * scarcity
end

# GF(3) conservation ensures no zero-sum extraction
# WEV(A) + WEV(B) + WEV(C) > 0 when sum(trits) ≡ 0 (mod 3)

FDCI Integration

SPEEDEX: Batch DEX Semantics

SPEEDEX eliminates MEV via batch execution with Arrow-Debreu pricing:

Traditional DEX:
  tx_1 → tx_2 → tx_3  (ordering matters → MEV)
  
SPEEDEX:
  {tx_1, tx_2, tx_3} → uniform_price  (batch → no MEV)

GF(3) Mapping:

struct SPEEDEXTriad
    sell_order::Order      # trit = -1 (supply)
    price_oracle::Oracle   # trit = 0 (equilibrium)
    buy_order::Order       # trit = +1 (demand)
end

# Conservation: supply + equilibrium + demand = 0
# No ordering → no front-running → pure WEV

Groundhog: Commutative Execution

Groundhog's key insight: Commutative semantics = Order independence = SPI.

# From Groundhog paper (arXiv:2404.03201)
# 
# Transactions within a block are NOT ordered relative to one another.
# Instead: commutative semantics deterministically resolve concurrent accesses.

struct GroundhogBlock
    transactions::Set{Transaction}  # Unordered set
    reserve_commit::TwoPhaseProtocol
    
    # Commutative resolution
    function execute(self)
        # All tx execute concurrently
        # Conflicts resolved via reserve-commit (not ordering)
        parallel_execute(self.transactions)
    end
end

# This IS SPI: same transactions, any order → same result

WEV in Groundhog:

  • No ordering advantage → No front-running MEV
  • Value comes from efficient execution, not sequencing tricks
  • 500K+ TPS on 96 cores = pure throughput WEV

TFM Post-MEV: Searcher-Proposer Separation

Roughgarden's SAKA mechanism separates roles:

Traditional:
  Proposer = Searcher = Block Producer (can extract MEV)
  
SAKA:
  Searcher: Finds value extraction opportunities
  Proposer: Commits to block without seeing content
  
  → Searchers compete, proposer is "MEV-blind"

GF(3) Tripartite Mapping:

const TRIPARTITE_ROLES = (
    MINUS   = :Verifier,    # Checks validity, slashes violations
    ERGODIC = :Coordinator, # SAKA mechanism, price oracle
    PLUS    = :Searcher,    # Finds WEV opportunities
)

struct TripartiteTFM
    searchers::Vector{Agent}     # trit = +1, find opportunities
    coordinator::SAKA            # trit = 0, mechanism
    verifiers::Vector{Agent}     # trit = -1, check proofs
    
    # Conservation: searcher revenue funds verifier/​coordinator
    # No single party extracts MEV
end

ACSet Schema: WEV Extraction

using Catlab.CategoricalAlgebra, ACSets

@present SchWEVExtraction(FreeSchema) begin
    # Actors
    Agent::Ob
    Searcher::Ob
    Proposer::Ob
    
    # Resources
    Transaction::Ob
    Block::Ob
    
    # Extraction
    WEVOpportunity::Ob
    
    # Morphisms
    searcher_agent::Hom(Searcher, Agent)
    proposer_agent::Hom(Proposer, Agent)
    
    finds::Hom(WEVOpportunity, Searcher)
    involves::Hom(WEVOpportunity, Transaction)
    included_in::Hom(Transaction, Block)
    proposed_by::Hom(Block, Proposer)
    
    # Attributes
    Value::AttrType
    Trit::AttrType
    Seed::AttrType
    Color::AttrType
    
    opportunity_value::Attr(WEVOpportunity, Value)
    opportunity_trit::Attr(WEVOpportunity, Trit)
    tx_seed::Attr(Transaction, Seed)
    tx_color::Attr(Transaction, Color)
    block_gf3_sum::Attr(Block, Trit)
    
    # GF(3) Constraint: sum of trits in block ≡ 0 (mod 3)
end

@acset_type WEVExtraction(SchWEVExtraction,
    index=[:searcher_agent, :finds, :included_in])

Eliza Labs Integration

predimarket: "A New Kind of Game"

Shaw's lalalune/​predimarket represents prediction market meets AI agents:

# Connection: AI agents as searchers in TFM
struct ElizaSearcher <: AbstractSearcher
    model::ElizaOS
    strategy_space::Vector{Symbol}
    wev_history::Vector{Float64}
    trit::Int  # GF(3) assignment
end

# Agents find WEV by predicting outcomes
function find_wev(agent::ElizaSearcher, market::PredictionMarket)
    prediction = agent.model(market.state)
    if confidence(prediction) > THRESHOLD
        return WEVOpportunity(
            agent=agent,
            market=market,
            expected_value=prediction.value,
            trit=sign(prediction.direction)
        )
    end
end

AI x Web3 Lab Connection

The Stanford AI x Web3 Lab (FDCI + Eliza Labs partnership) focuses on:

  1. AI agents as market participants (searchers in TFM)
  2. On-chain verifiable AI inference (ZK proofs of computation)
  3. Autonomous prediction markets (MEV-resistant via SPEEDEX)

Hyperbolic Bulk Integration

WEV extraction operates across the bulk-boundary correspondence:

BOUNDARY (Agents)           BULK (Entropy/​Proofs)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Searcher agents          ←→  WEV opportunities (stored)
Proposer commits         ←→  Block entropy records
Verifier proofs          ←→  Reafference proofs
Color generation         ←→  Deterministic seeds

Move Contract Extension

/// WEV Extraction via Boneh-Roughgarden TFM
module wev_extraction::tfm {
    use hyperbolic_bulk::entropy_triads::{EntropyRecord, EntropyTriad};
    
    struct WEVOpportunity has store, drop, copy {
        searcher: address,
        tx_set: vector<u64>,  // References to EntropyRecords
        expected_value: u64,
        trit: u8,
        commitment_hash: vector<u8>,
    }
    
    struct SAKABlock has store, drop, copy {
        opportunities: vector<WEVOpportunity>,
        proposer: address,
        gf3_sum: u8,
        gf3_conserved: bool,
        extracted_wev: u64,
    }
    
    /// Commit WEV opportunity (searcher phase)
    public entry fun commit_opportunity(
        account: &signer,
        tx_set: vector<u64>,
        commitment_hash: vector<u8>,
    ) acquires WEVStore {
        // Searcher commits without revealing content
        // Commitment = hash(opportunity || nonce)
    }
    
    /// Reveal and extract (proposer phase)
    public entry fun reveal_and_extract(
        account: &signer,
        opportunity_id: u64,
        nonce: vector<u8>,
    ) acquires WEVStore {
        // Verify commitment
        // Check GF(3) conservation
        // Extract WEV proportionally
    }
}

GF(3) Triads

boneh-roughgarden-wev (0) ⊗ gay-mcp (+1) ⊗ bisimulation-game (-1) = 0 ✓
speedex-batch (0) ⊗ groundhog-commutative (0) ⊗ hyperbolic-bulk (0) = 0 ✓
tfm-post-mev (0) ⊗ searcher (+1) ⊗ verifier (-1) = 0 ✓

API

Python

from wev_extraction import TFMEngine, WEVOpportunity, SAKAMechanism

# Initialize TFM with GF(3) constraints
tfm = TFMEngine(
    mechanism=SAKAMechanism(welfare_bound=0.5),
    gf3_conservation=True,
    seed=0x42D
)

# Searcher finds opportunity
opportunity = WEVOpportunity(
    tx_set=[tx1, tx2, tx3],
    expected_value=100.0,
    trit=1  # PLUS (generative)
)

# Commit (hash only, no content revealed)
commitment = tfm.commit(opportunity, nonce=random_bytes(32))

# Later: reveal and extract
wev_extracted = tfm.reveal_and_extract(
    commitment,
    opportunity,
    nonce
)

# Verify GF(3) conservation
assert tfm.gf3_conserved()

Julia

using BonehRoughgardenWEV

# Create TFM with SAKA mechanism
tfm = TFMEngine(
    mechanism = SAKAMechanism(welfare_bound = 0.5),
    gf3_conservation = true,
    seed = 0x42D
)

# Find WEV opportunities
opportunity = find_wev(tfm, transaction_pool)

# Extract with GF(3) balance
wev = extract_wev!(tfm, opportunity)

# Verify conservation
@assert gf3_conserved(tfm) "GF(3) violation!"

Files

  • lib/​tfm_engine.jl - Transaction Fee Mechanism core
  • lib/​saka.jl - SAKA mechanism implementation
  • lib/​speedex_batch.jl - SPEEDEX batch execution
  • lib/​groundhog_commutative.jl - Commutative semantics
  • lib/​wev_extraction.jl - WEV computation
  • contracts/​wev_extraction.move - Aptos Move contract

References

  1. SPEEDEX - Ramseyer et al. (2022) - Scalable, Parallelizable DEX
  2. Groundhog - Ramseyer, Mazières (2024) - Commutative Smart Contracts
  3. TFM Post-MEV - Bahrani, Garimidi, Roughgarden (2024) - Active Block Producers
  4. Collusion-Resilience - Chung, Roughgarden, Shi (2024) - TFM Design
  5. BLS Signatures - Boneh, Lynn, Shacham (2001) - Short Signatures from Weil Pairing
  6. Nova - Kothapalli, Setty, Boneh (2022) - Recursive SNARKs
  7. GAY Protocol - plurigrid/​asi - World Extractable Value

Skill Name: boneh-roughgarden-wev
Type: Mechanism Design / Cryptographic Economics
Trit: 0 (ERGODIC)
Key Property: GF(3)-conserved value extraction via commutative TFM

More skills from plurigrid

cargo logo
plurigrid/asi

cargo

Rust package manager (36 subcommands).

67 0
View

Translate Figma nodes into production-ready code with 1:1 visual fidelity using the Figma MCP workflow (design context, screenshots, assets, and project-convention translation). Trigger when the user provides Figma URLs or node IDs, or asks to implement designs or components that must match Figma...

67 0
View

**Status**: 🌳 Production Ready (upstream in StringZilla v3+) **Type**: High-Performance String Operations / SIMD-Accelerated Text Processing **Principle**: Zero-copy views, SIMD/SWAR acceleration, deterministic hashing **Frame**: Cross-language interoperability (C, C++, Python, Rust, Go, Swift, ...

67 0
View
conformal-ga logo
plurigrid/asi

conformal-ga

Conformal Geometric Algebra (CGA) for circles, spheres, and Möbius transformations

67 0
View

Verifies code implements exactly what documentation specifies for blockchain audits. Use when comparing code against whitepapers, finding gaps between specs and implementation, or performing compliance checks for protocol implementations.

67 0
View
zig-systems logo
plurigrid/asi

zig-systems

Systems programming and performance optimization using Zig. Provides low-level abstractions, memory-safe compiled code, and performance benchmarking. Use for system-level operations, optimization, and interoperability with C/POSIX APIs.

67 0
View
paypal-mcp logo
plurigrid/asi

paypal-mcp

PayPal MCP server integration for invoices, payments, subscriptions, disputes, and transaction reporting via @paypal/mcp.

67 0
View
unison logo
plurigrid/asi

unison

Unison language - content-addressed functional programming with abilities for effects, distributed computing, and structural types. Use for pure functional code, effect management, distributed systems, and refactoring-safe codebases.

67 0
View
tasks-acset logo
plurigrid/asi

tasks-acset

Google Tasks management via TasksACSet. Transforms task operations into GF(3)-typed Interactions, routes to triadic queues, detects saturation for task-zero-as-condensed-state.

67 0
View
c logo
plurigrid/asi

c

World C Skill

67 0
View
syrup logo
plurigrid/asi

syrup

Syrup binary serialization for OCapN/CapTP wire format. Canonical encoding for capability messages.

67 0
View
skill-installer logo
plurigrid/asi

skill-installer

Install Codex skills into $CODEX_HOME/skills from a curated list or a GitHub repo path. Use when a user asks to list installable skills, install a curated skill, or install a skill from another repo (including private repos).

67 0
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View