blockchain mid 2 pt 2

0.0(0)
studied byStudied by 1 person
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/43

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

44 Terms

1
New cards

why derivatives exist

mature markets need tools to manage and speculate on volatility

derivatives enable strategies like hedging and leveraged speculation

instead of trading assets directly, trade a contract that derives value from the asset (an echo of the original object)

2
New cards

hedging

protect holdings from price drops

3
New cards

leveraged speculation

amplify market exposure

4
New cards

spot trading

spot trading:

  • simplest form of trading of the tokens themselves

  • direct exchange for immediate ownership with no expiration/complex mechanics

5
New cards

traditional futures

traditional futures:

  • contract to buy or sell at a set price on a future data

  • like preordering a phone (price now, transaction later)

  • fixed expiration forces price convergence

short

  • contract to sell at future time with fixed price now

long

  • contract to buy at future time with fixed price now

6
New cards

perpetual futures

  • crypto innovation

  • futures contract that never expires

  • hold positions indefinitely with high leverage

  • make/lose money based on how perp price changes in the future

  • need to anchor price to reality if no expiration

short profit formula: position size * (entry perp price - exit perp price)

long profit formula: position size * (exit perp price - entry perp price)

7
New cards

spot vs futures vs perpetuals

spot:

  • no expiration

  • low/no leverage

  • direct ownership of asset

  • price anchor by market price

traditional futures:

  • fixed date expiration

  • has leverage

  • only contract ownership

  • price anchor by expiration date

perp futures:

  • no expiration

  • high leverage

  • contract only ownership

  • price anchor by funding rate

8
New cards

why do perps need the funding rate mechanism

without expiration date, perp contract price can drift far from actual spot price making it meaningless

9
New cards

funding rate mechanism

periodic payment between long and short position holders

creates incentives that anchor perp prices to spot prices

  1. when perp price > spot price

    • market is bullish with more longs

    • longs pay shorts, making long positions expensive and shorts profitable

    • reward shorts > pushes perp price down toward spot

    • funding positive

  2. when perp price < spot price

    • market is bearish with more shorts

    • shorts pay longs

    • reward longs > push perp price up toward spot

    • funding negative

maintain contract relevance and utility by preventing perp price from drifting

10
New cards

funding rate formula

funding payments calculated every 8 hours

amount = position size * funding rate

funding rate = fixed interest rate + premium

premium = percentage difference between perp and spot prices (Pperp-Pspot)/Pspot averaged over time to prevent manipulation

interest component balances borrowing cost differences, reflect how usd changes?

11
New cards

positive funding rate example

setup:

  • position: long 1 BTC

  • spot price: $100,000

  • perp price: $100,120 (bullish premium)

  • position notional (entry size): $100,120

  • interest: 0.01%

calculate premium:

  • P = (100,120-100,000)/100,000=0.12%

calculate funding rate

  • F = 0.12%+0.01%=0.13%

calculate payment

  • payment = 100,120 × 0.13% = $130.16

12
New cards

double edged sword of leverage and liquidation

leverage

  • main attraction of perpetuals

  • control large positions with small capital deposits called margin

liquidation

  • deposit automatically liquidated if loss is about to exceed the deposit

  • if short, you are forced to buy

  • if long, you are forced to sell

13
New cards

liquidation cascade

liquidation is a risk when many traders cluster at similar price points

after breaking through a liquidation wall, a cluster of traders are liquidated simultaneously and the exchange dumps all their positions causing the price to change drastically

new price can break through another liquidation wall and make another cluster of traders liquidate, causing a chain reaction

14
New cards

case study decentralized perps: GMX

  • trader vs pool model

  • pioneer on-chain perpetuals on layer 2 networks like arbitrum???

  • pooled liquidity model centered around GLP token eliminating need for traditional order books

GLP

  • multi-asset liquidity pool where users deposit variety of tokens into one pool and receive GLP tokens in return representing their share of the entire pool

trading mechanism:

  • traders trade directly against GLP pool

  • liquidity providers collectively act as single counterparty “house”

oracle base pricing

  • GMX uses high speed oracles like chainlink that aggregate prices from major centralized exchanges

key feature: zero slippage, large orders do not impact price. use oracle price

profits and losses go to and from the GLP pool

liquidity providers betting that traders will lose more than they win, earning fees and trader losses as yield

15
New cards

case study decentralized perps: Hyperliquid

  • new gen, central limit order book (CLOB) on own application-specific blockchain

  • makes traditional exchange mechanics fully on-chain

CLOB:

  • traditional model used by centralized exchanges/stock markets

  • public ledge of all buy and sell orders at different price levels visible to all participants

trader-to-trader

  • traders match against each other directly

  • buy orders need to find corresponding sell orders

  • market makers provide liquidity

native price discovery

  • prices are discovered on-platform thorugh order matching

  • market price is last matched trade where highest bid meets lowest ask

16
New cards

gmx vs hyperliquid trade off

gmx:

strengths

  • zero slippage

  • simple lp participation

  • capital efficient

  • predictable execution prices

weaknesses

  • no native price discovery

  • oracle dependency risk

  • lps bear all trader P&L risk

  • prices imported not discovered

hyperliquid:

strengths

  • native price discovery

  • traditional market dynamics

  • no oracle dependency

  • real-time order matching

weaknesses

  • slippage on large orders

  • requires market maker presence

  • thin books > high slippage

  • complex infrastructure needs

17
New cards

gmx vs hyperliquid comparison summary

gmx:

  • liquidity from glp pool (collective lps)

  • price from external oracles

  • zero slippage because use oracle price

  • counterparty: pool vs trader

  • infrastructure uses L2 smart contracts

  • best for predictable execution

hyperliquid:

  • liquidity from individual market makers

  • price from on-chain order matching

  • variable slippage depending on order book depth

  • counterparty: trader vs trader

  • custom blockchain infra

  • beset for price discovery and transparency

18
New cards

blockchain mempool

when user sends a transaction, it enters the mempool (memory pool)

  • public waiting area for unconfirmed transactions

  • each node maintains own mempool version, converging on similar pending transaction sets

  • transparent: all transactions, contents, and gas fees are publicly visible

19
New cards

what is MEV

Originally “miner extractable value” in proof-of-work systems

evolved now “Maximal Extractable Value”

core definition:

  • maximum value extractable by block producers through strategic inclusion, exclusion, or reordering of transactions within blocks they create, beyond standard block rewards and transaction fees

information asymmetry

  • MEV is possible because transactions are public and can be reordered before confirmation

  • block producers and “searchers” exploit this by monitoring the mempool for profitable opportunities

20
New cards

core MEV strategies

front-running

  • executing transactions before victims by paying higher gas fees

back-running

  • capitalizing on price movements immediately after target transactions

sandwich attacks

  • combining front-running and back-running to trap victim transactions

21
New cards

front-running mechanics

  • front-runner spots profitable pending transaction in mempool (like large DEX swap that will move an asset’s price)

  • attacker submits own transaction with higher gas fee to get priority inclusion

  • front-runner executes first, causing price to move up

  • original transaction gets worse price, and attacker gets more value

22
New cards

back-running mechanics

  • execute transaction immediately after a target transaction to profit from price impact

  • ex: if large trade causes price imbalance between two DEXs, a back-runner can buy on cheaper DEX and sell on pricier DEX

  • less harmful than front-running, doesn’t worsen victim’s execution, just profits off of it

23
New cards

sandwich attack

  • first frontrun, then victim trades, then backrun

  • one of most common and harmful MEV strategies

24
New cards

liquidation MEV: necessary evil

  • in decentralized lending, when borrower’s health factor drops below threshold, their position is eligible for liquidation

  • liquidators repay debt in exchange for the collateral at a discount (liquidation bonus)

  • highly competitive process, with multiple liquidator bots engaging in gas bidding wars to try an get their transaction first (others fail)

  • liquidation MEV is essential for protocol health

  • ensures under-collateralized loans close quickly, protecting protocols from accumulating bad debt

25
New cards

oracle latency MEV

blockchain oracles vitally bring off-chain data to smart contracts, but are slow

oracles update every n minutes or after significant price deviations

latency problem

  • delay between real-world price changes and on-chain oracle updates creates oracle latency

  • window where smart contracts operate on outdated info

exploitation opportunity

  • attakers monitor real-world prices and on-chain prices, exploiting discrepancies

  • can have catastrophic consequences for protocols

    • ex: LUNA/UST 2022 collapse

26
New cards

case study: LUNA De-peg

during LUNA price crash, real-world prices on centralized exchanges like binance fell faster than on-chain oracles updated

attackers could buy buy a lot of tokens for real price and deposit into protocol where it is worth more under outdated oracle

protocol allows to borrow against that inflated collateral

after oracle updated, protocol got a lot of debt

27
New cards

pros/cons of MEV

pros

  • price efficiency: arbitrage MEV maintains consistent pricing across different DEXs

  • protocol solvency: liquidation MEV provides powerful incentives ensuring lending protocols remain solvent by quickly closing under-collateralized positions

  • network incentives: MEV revenue can constitute a significant portion of block producer income, incentivizing rubust network security and participation

cons:

  • frontrunning and sandwich attacks harm victims through slippage, execution prices, and losses

  • network congestion: fierce competition among MEV bots create gas wars that inflate transaction fees and clog the network for everyone

  • centralization risk: high-value MEV opportunities favor entities with more resources

28
New cards

MEV mitigation strategies

chain-level and protocol solutions

  • modify fundamental blockchain rules or transaction supply chain to reduce harmful MEV on protocol level

application-level

  • strategies that decentralized apps, especially DEXs use to protect their users from bad MEV attacks

29
New cards

private transaction relays

most widely adopted MEV mitigation

how works

  • users send transactions directly to a private relay instead of public mempool

  • relay forwards transactions to specialized block builders with agreements to include them

key benefit

  • transactions are hidden from public MEV bots until included in a block

limitation

  • users must trust relay and builder to not exploit themselves

  • but reputation and economic incentives of major builders prevent bad behavior

30
New cards

centralization problem which proposer-builder separation (PBS) combats

  • validators who propose blocks also build them

  • to maximize profit, proposers run resource-intensive MEV extraction software, which favor large staking pools

  • small solo-stakers cannot compete and profit less from their blocks since they make less MEV

  • pressures users to stake with large pools, driving validator centralization

31
New cards

proposer-builder separation (PBS) solution

separate roles into two specialized actors

builders (specialists):

  • highly specialized entities that build maximally profitable blocks with MEV before submitting bids to proposers

proposers (validators):

  • select most profitable block from competing builders based on bid amount

  • no need for MEV expertise

does not stop MEV, but acknowledges extracting MEV is difficult

builders must bid their potential profit in order to get their block built

money is moved from few specialists who find MEV to all validators who secure the network

32
New cards

proposer-builder separation (PBS) benefits

  • solo stakers are as profitable as large pools since neither build the actual blocks, both accept the winning bids from open market

  • no more pressure for validator centralization

  • creates competitive building market that maximizes value returned to all stakers

33
New cards

slippage tolerance: application level MEV protection

  • most common user-facing MEV protection

  • when users make swaps, DEX interfaces require them to set a slippage tolerance

  • if final price exceeds tolerance, the transaction is failed

  • defends against sandwich profitability since they can only extract so much that it doesn’t fail the user’s transaction

  • limitation since bots can still extract MEV without triggering limits with an upper bound

34
New cards

batch auctions: application level MEV protection

  • some DEXs use this instead of sequential execution

  • collection phase: protocol collects all user trades from short time window into a batch

  • solving phase: third party solver examines trades in batch and calculates single uniform clearing price

  • execution phase: everyone in batch receives same prices regardless of submission order

traditional AMMs are sequential where order matters, which attackers can exploit

35
New cards

defi stack

value (stablecoin) > exchange (AMM) > credit (lending) > derivatives (perps) > governance (DAOs)

36
New cards

what is a DAO

rules as code: organizational bylaws encoded in transparent, immutable smart contracts

member control: token holders collectively govern through binding, on-chain votes

no central authority: flat, democatic structure replacing traditional hierarchies

37
New cards

token-weighted voting

most prevalent DAO governance mechanism

voting power scales linearly with token ownership

allows voting power with financial stake

simple implementation, default choice for most DAOs

38
New cards

whale problem with token-weighted voting

when token distribution is unequal, a handful of large holders (whales) can dominate decisions, marginalizing thousands of smaller participants

plutocracy

39
New cards

quadratic voting

solution to wealth concentration by making additional votes exponentially expensive

cost to cast n votes equals n² credits

forces strategic allocation of credits when you vote

ex: if you have 16 credits, you can cast 1 vote on 16 different proposals or cast 4 votes on one critical issue

40
New cards

governance failure: flash loan attack

abuse flash loans to temporarily hijack voting power within single atomic transaction

  1. borrow: attacker gets massive flash loan of governance tokens

  2. vote: temporary voting power passes malicious proposal

  3. execute: proposal executes immediately, draining treasury

  4. repay: flash loan repaid, attacker walks away with funds

ex: Beanstalk Farms, because proposals were executed instantly after passing

41
New cards

solution to flash loan attacks

mandatory time delays between vote passage and execution to prevent instantaneous manipulation

42
New cards

curve wars

2021-2022 multi-billion dollar fight in DeFi to control Curve Finance

Curve: largest exchange for stablecoins and key part of how digital financial systems work

Big players like Convex Finance and Frax Finance constantly bought Curve’s main CRV token to get more voting power

Want to send CRV rewards to their own investment pools, attracting users and giving financial sway

Large amounts of money called Total Value Locked (TVL) at stake

example of how DAO governance works, show game theory in decentralized autonomous orgs

43
New cards

curve governance mechanism

CRV governance token can be locked up for up to 4 years to receive veCRV (vote-escrowed CRV)

veCRV holders voe on which liquidity pools receive weekly emissions of new CRV tokens as rewards

directing CRV rewards to specific pool attracts more liquidity as LPs chase maximum yield

deep liquidity is crucial for stablecoin protocols

control votes > control liquidity > control market

44
New cards

curve battle cycle

loop of increasing dominance

acquire CRV tokens > lock CRV for veCRV voting power > vote to direct CRV rewards to own pool > high rewards attract more liquidity providers to that pool > deep liquidity generates revenue > acquire more CRV tokens with extra fees