Workspace IndexAlgorithms › Day 66

PBS, MEV Auctions, and Timing Games TODO

Algorithms · Day 66 / 100 · D. Distributed Systems & Consensus (Day 52-68)

Concept

MEV is the excess value that can be extracted by controlling which transactions get included in a block, their order, or their exclusion. Proposer-Builder Separation splits block assembly (the builder) from block proposal (the validator): the proposer signs a header without seeing the block's contents and takes whichever block carries the highest bid — on Ethereum this is widely implemented off-chain, routed through relays. Builders collect bundles from searchers to maximize a block's value, and hand a large share of that value back to the proposer as a bid, forming an auction. Timing games are when a proposer deliberately delays its proposal as late as possible within its slot to collect more MEV — an incentive problem that eats into block propagation slack and hurts network stability.

DEX and prediction-market user orders are prime sandwich/backrun targets, and settlement transactions can have their inclusion timing manipulated too — if defenses aren't built into the protocol from the start, they can't be bolted on later.

Code & Formula

# PBS·MEV 경매·타이밍 게임 — 빌더들이 블록 가치를 놓고 입찰하고, 제안자는 슬롯 안에서 제안 시점을 늦춰 더 높은 입찰을 노린다.
# 타이밍 게임은 "늦게 낼수록 입찰가는 오르지만 슬롯을 놓칠 확률도 오른다"는 트레이드오프를 기대값으로 최적화한다.

import random
random.seed(7)

def builder_bids(round_num):
    # 서처 번들이 쌓일수록 빌더 입찰가가 오른다고 가정
    return [round(random.uniform(0.5, 1.0) * (1 + 0.05 * round_num), 3) for _ in range(4)]

print("=== PBS 경매: 라운드마다 빌더 4곳이 입찰, 제안자는 최고가만 채택 ===")
for round_num in range(3):
    bids = builder_bids(round_num)
    print(f"라운드 {round_num}: 빌더 입찰 {bids} → 채택 입찰 {max(bids)}")

print("\n=== 타이밍 게임: 슬롯(12초) 안에서 제안 시점 t를 늦출수록 입찰가는 오르지만 놓칠 확률도 오른다 ===")
SLOT_SECONDS = 12

def bid_at(t):
    return 1.0 + 0.15 * t                      # 늦게 제안할수록 더 많은 번들을 모아 입찰가 상승

def miss_probability(t):
    return min(0.9, (t / SLOT_SECONDS) ** 2)    # 마감에 가까울수록 네트워크 전파 실패 위험 급증

best_t, best_ev = 0, -1
for t in range(0, SLOT_SECONDS + 1):
    ev = bid_at(t) * (1 - miss_probability(t))
    if ev > best_ev:
        best_t, best_ev = t, ev
    print(f"t={t:2d}s  입찰가={bid_at(t):.2f}  놓칠확률={miss_probability(t):.2%}  기대수익={ev:.3f}")

print(f"\n기대수익 최대화 제안 시점: t={best_t}s (기대수익={best_ev:.3f}) — 무한정 늦추는 게 최선이 아니다")

Exercise

Work out an actual sandwich scenario for your own market with real numbers, then compare whether a slippage cap, commit-reveal, or a private relay would actually be effective at mitigating it.

Practical Connection

Verex's LMSR price depends on execution order, so front-running is structurally possible, and orders placed right before an oracle result is finalized are similarly an MEV target — this ties directly into settlement timing and order-disclosure design.

Where it lands in Jayverse

Key expressions

Words and phrases from this page worth keeping, with the Korean meaning and the sentence they come from.

Expression뜻 · 쓰이는 자리
excess value초과 가치, 여분의 이익 · 정상적 거래 외에 추가로 뽑아낼 수 있는 가치를 말할 때. "the excess value that can be extracted"
without seeing~을 보지 않고(확인하지 않고) · 위임자가 내용을 확인 없이 서명할 때 쓰는 전치사구. "signs a header without seeing the block's contents"
route through~을 거쳐 전달되다 · 데이터나 요청이 특정 중개 경로를 통해 흐를 때. "routed through relays."
hand back되돌려주다, 넘겨주다 · 얻은 가치의 일부를 상대에게 돌려줄 때. "hand a large share of that value back"
eat into(자원·여유를) 갉아먹다 · 어떤 행위가 여유분을 줄어들게 만들 때. "eats into block propagation slack"
bolt on later나중에 임시로 덧붙이다 · 처음부터 설계하지 않고 뒤늦게 추가할 때. "they can't be bolted on later"
prime target주요 표적, 공격받기 쉬운 대상 · 특정 거래가 공격에 취약할 때. "are prime sandwich/backrun targets"
PBS제안자-빌더 분리(Proposer-Builder Separation) · 블록 조립과 블록 제안을 분리하는 이더리움 MEV 완화 구조. "Proposer-Builder Separation splits block assembly (the builder) from block proposal"
MEV최대 추출 가능 가치(Maximal Extractable Value) · 블록 생성자가 거래 순서·포함·배제로 얻는 초과 이익. "MEV is the excess value that can be extracted"
LMSR로그마켓점수규칙(Logarithmic Market Scoring Rule) · Verex의 가격 결정 방식, 체결 순서에 따라 가격이 바뀌어 프론트러닝에 노출됨. "Verex's LMSR price depends on execution order, so front-running"

If you study this on a given day, add a note link and a ✅ to this line in the source curriculum (docs/knowledge/dev-100-curriculum.md) and this spot will lead straight to the note body. You can also write directly on this page — but regenerating overwrites it, so it's safer to keep anything you want to save as markdown under docs/algorithms/.


한국어

PBS·MEV 경매·타이밍 게임 TODO

Algorithms · Day 66 / 100 · D. 분산시스템·합의 (Day 52–68)

개념

MEV는 블록 안에서 트랜잭션의 포함 여부·순서·검열을 조정해 뽑아낼 수 있는 초과 가치를 말한다. Proposer-Builder Separation은 블록을 조립하는 빌더와 블록을 제안하는 검증자를 분리해, 제안자가 블록 내용을 보지 않은 채 헤더에 서명하고 가장 높은 입찰가의 블록을 받도록 하는 구조다(이더리움에서는 릴레이를 거치는 오프체인 형태로 널리 쓰인다). 빌더는 서처들이 보낸 번들을 모아 블록 가치를 최대화하고 그 상당 부분을 입찰가로 제안자에게 지급하는 경매가 형성된다. 타이밍 게임은 제안자가 슬롯 안에서 제안을 최대한 늦춰 MEV를 더 모으려는 행위로, 블록 전파 여유를 깎아 네트워크 안정성을 해치는 유인 문제다.

DEX와 예측시장의 사용자 주문은 샌드위치·백런의 표적이고 정산 트랜잭션도 포함 시점이 조작될 수 있어, 프로토콜 설계 단계에서 방어를 넣지 않으면 나중에 막을 수 없다.

코드 · 수식

# PBS·MEV 경매·타이밍 게임 — 빌더들이 블록 가치를 놓고 입찰하고, 제안자는 슬롯 안에서 제안 시점을 늦춰 더 높은 입찰을 노린다.
# 타이밍 게임은 "늦게 낼수록 입찰가는 오르지만 슬롯을 놓칠 확률도 오른다"는 트레이드오프를 기대값으로 최적화한다.

import random
random.seed(7)

def builder_bids(round_num):
    # 서처 번들이 쌓일수록 빌더 입찰가가 오른다고 가정
    return [round(random.uniform(0.5, 1.0) * (1 + 0.05 * round_num), 3) for _ in range(4)]

print("=== PBS 경매: 라운드마다 빌더 4곳이 입찰, 제안자는 최고가만 채택 ===")
for round_num in range(3):
    bids = builder_bids(round_num)
    print(f"라운드 {round_num}: 빌더 입찰 {bids} → 채택 입찰 {max(bids)}")

print("\n=== 타이밍 게임: 슬롯(12초) 안에서 제안 시점 t를 늦출수록 입찰가는 오르지만 놓칠 확률도 오른다 ===")
SLOT_SECONDS = 12

def bid_at(t):
    return 1.0 + 0.15 * t                      # 늦게 제안할수록 더 많은 번들을 모아 입찰가 상승

def miss_probability(t):
    return min(0.9, (t / SLOT_SECONDS) ** 2)    # 마감에 가까울수록 네트워크 전파 실패 위험 급증

best_t, best_ev = 0, -1
for t in range(0, SLOT_SECONDS + 1):
    ev = bid_at(t) * (1 - miss_probability(t))
    if ev > best_ev:
        best_t, best_ev = t, ev
    print(f"t={t:2d}s  입찰가={bid_at(t):.2f}  놓칠확률={miss_probability(t):.2%}  기대수익={ev:.3f}")

print(f"\n기대수익 최대화 제안 시점: t={best_t}s (기대수익={best_ev:.3f}) — 무한정 늦추는 게 최선이 아니다")

연습

자신의 시장에서 발생할 샌드위치 시나리오를 실제 수치로 계산해보고, 슬리피지 한도·커밋리빌·프라이빗 릴레이 중 어떤 완화책이 실효가 있는지 비교하라.

실무 · Verex 연결

Verex의 LMSR 가격은 체결 순서에 의존하므로 프론트런 가능성이 구조적으로 존재하고, 오라클 결과 확정 직전 주문 역시 MEV 표적이 되므로 정산 타이밍과 주문 공개 방식 설계에 직결된다.

Jayverse에서의 위치

핵심 표현

이 페이지의 영어 본문에서 배울 만한 단어와 표현, 뜻과 나온 자리.

Expression뜻 · 쓰이는 자리
excess value초과 가치, 여분의 이익 · 정상적 거래 외에 추가로 뽑아낼 수 있는 가치를 말할 때. "the excess value that can be extracted"
without seeing~을 보지 않고(확인하지 않고) · 위임자가 내용을 확인 없이 서명할 때 쓰는 전치사구. "signs a header without seeing the block's contents"
route through~을 거쳐 전달되다 · 데이터나 요청이 특정 중개 경로를 통해 흐를 때. "routed through relays."
hand back되돌려주다, 넘겨주다 · 얻은 가치의 일부를 상대에게 돌려줄 때. "hand a large share of that value back"
eat into(자원·여유를) 갉아먹다 · 어떤 행위가 여유분을 줄어들게 만들 때. "eats into block propagation slack"
bolt on later나중에 임시로 덧붙이다 · 처음부터 설계하지 않고 뒤늦게 추가할 때. "they can't be bolted on later"
prime target주요 표적, 공격받기 쉬운 대상 · 특정 거래가 공격에 취약할 때. "are prime sandwich/backrun targets"
PBS제안자-빌더 분리(Proposer-Builder Separation) · 블록 조립과 블록 제안을 분리하는 이더리움 MEV 완화 구조. "Proposer-Builder Separation splits block assembly (the builder) from block proposal"
MEV최대 추출 가능 가치(Maximal Extractable Value) · 블록 생성자가 거래 순서·포함·배제로 얻는 초과 이익. "MEV is the excess value that can be extracted"
LMSR로그마켓점수규칙(Logarithmic Market Scoring Rule) · Verex의 가격 결정 방식, 체결 순서에 따라 가격이 바뀌어 프론트러닝에 노출됨. "Verex's LMSR price depends on execution order, so front-running"

공부한 날 원본 커리큘럼(docs/knowledge/dev-100-curriculum.md)의 이 줄에 노트 링크와 ✅ 를 붙이면, 이 자리는 노트 본문으로 바로 이어집니다. 노트 없이 이 페이지에 바로 적어도 됩니다 — 다만 다시 생성하면 덮어쓰이므로, 남길 글은 docs/algorithms/ 의 마크다운으로 쓰는 편이 안전합니다.

← 1118. 사기 증명 vs 유효성 증명의 게임 이론1120. 멱등성과 "정확히 한 번" →