MEV的影响:
a. 正面影响是帮助DeFi运行:DEX的价格及时更新,借贷,稳定币等运行,套利者也在其中获得了收入。

https://explore.flashbots.net/
负面影响:
a. Gas War:PGA(Priority Gas Auction)交易之间通过Gas竞争获得更优先的排序
b. Dark Forest:交易进入公开的Mempool后容易被攻击,来提取其中的价值
c. Reorg:Miner为了MEV而进行Reorg,影响区块链的终局性
已有的解决方案(针对上述负面影响):

Base Fee随拥堵情况变化,且幅度限制在1.125x per block,使Gas Price的变化更平滑更好预测
增加了矿工自己插入交易的成本,减少矿工的MEV和影响Gas的行为
Block Gas容量有个2x的变化空间,会随着拥堵情况缓慢变化
现有的交易gas计算方案:EIP-2930:
21000 + 16 * non-zero calldata bytes + 4 * zero calldata bytes + 1900 * access list storage


1. 链下的交易排序竞价(Sealed-price Bid Auction),**Gas War**转移到了链下完成
a. 中心化的服务完成Auction,确定要包含的交易及其排序
b. 通过在tx内部直接支付ETH给Miner进行Bid
c. 失败交易不上链

产品使用情况:数据显示以太坊2.0在24h内出块的55%都是利用了mevboost服务

搜索者的MEV的收益部分给到了Miner:https://youtu.be/V_wlCeVWMgk
2. 提供了Private Mempool,防止了**黑暗森林**

[<https://docs.flashbots.net/flashbots-protect/rpc/quick-start/>](<https://docs.flashbots.net/flashbots-protect/rpc/quick-start/>)
3. MEV-Boost使用现状:[<https://www.mevboost.org/>](<https://www.mevboost.org/>)
a. 多个服务提供商
b. 占20%+的出块
c. Rollups引入了Layer2的FCFS,使用Rollup可以避免MEV的所有影响

a. bundle:值得是在进行套利过程中多个交易组成的策略,searcher为了不让他们策略被其他人打断,所以将他们按照自己想要的交易顺序打包给 block build
b. 搜索策略:
Common searching strategies
Atomic arbitrage (token A -》 tokenB, Token B -〉Token C, TolenC → B, TokenB → A)
Liquidation
Front/back-running ()
Gas optimization
Single-tx bundles(smart contracts)
Efficient addresses
Solidity
Latency minimization
Multicall
Local simulation
Geographic advantage
State/mempool viewpoint
builder(挑选公共pending pool, searcher 和 private user 中 的交易进行选择性打包):
public transactions, bundles, private transactions
1. builder执行一系列的算法来决定一个区块中应该包含哪些bundles和交易来最大化该区块的最大利润,然后builder和relays合作去竞拍validator的区块空间
b. 区块价值的评分(来源于mev-boost官方论坛):
打包某一个区块前后矿工余额差值
c. 区块价值来源:
base_fee + priority_fee + block.coinbase transfer + regular transfer
(足够优秀的区块排序算法, 足够多的私有订单, 足够多P2P订单)
relayer (负责在将区块传递给验证者之前检查区块的有效性以及评估接入该relayer的所有的builder打包的块的价值, 挑出价值最大的区块)

a. PayloadHeader:
class ExecutionPayloadHeader(Container):
# Execution block header fields
parent_hash: Hash32
coinbase: ExecutionAddress
state_root: Bytes32
receipt_root: Bytes32
logs_bloom: ByteVector[BYTES_PER_LOGS_BLOOM]
random: Bytes32
block_number: uint64
gas_limit: uint64
gas_used: uint64
timestamp: uint64
extra_data: ByteList[MAX_EXTRA_DATA_BYTES]
base_fee_per_gas: uint256
# Extra payload fields
block_hash: Hash32 # Hash of execution block
transactions_root: Root
b. Payload:
class ExecutionPayload(Container):
# Execution block header fields
parent_hash: Hash32
coinbase: ExecutionAddress # 'beneficiary' in the yellow paper
state_root: Bytes32
receipt_root: Bytes32 # 'receipts root' in the yellow paper
logs_bloom: ByteVector[BYTES_PER_LOGS_BLOOM]
random: Bytes32 # 'difficulty' in the yellow paper
block_number: uint64 # 'number' in the yellow paper
gas_limit: uint64
gas_used: uint64
timestamp: uint64
extra_data: ByteList[MAX_EXTRA_DATA_BYTES]
base_fee_per_gas: uint256
# Extra payload fields
block_hash: Hash32 # Hash of execution block
transactions: List[Transaction, MAX_TRANSACTIONS_PER_PAYLOAD]
(相对于header,我们的交易是可见的)
mempool核心知识(传统PGA下的区块构建方式):
每个节点都保存一个未确认交易的列表
所有的交易通过p2p传播,或者通过他们的rpc端点直接接收
每个节点都有自己的mempool,没有全局mempool这样的东西
节点可以拥有不同的内存池,具体取决于他们的地理位置和他们连接的对等节点
节点限制了他们保留在mempool中的交易数量,这是确保诸多交易不会被淹没的方式
[<https://github.com/flashbots/boost-geth-builder/blob/master/core/tx_pool.go>](<https://github.com/flashbots/boost-geth-builder/blob/master/core/tx_pool.go>)
locals and localsTx:
**区分locals 和 remote:**优先处理locals交易, 优先进入pending
locals: sender是miner地址以及miner自行配置的地址
localsTx:locals产生的交易
remoteTxs: 非locals产生的交易
pending: 所有当前可以处理的交易
2. 这些交易如何从TxPool进入到chain block
MEV-Geth基础知识
以太坊2.0的MEV Boost
FAQ:
在密封的区块空间拍卖中,谁可以看到交易内容?可以看到多少内容?
如果只有builder可以看到交易内容,那是什么阻止了builder自己成为套利者从中获利呢?
建立在使用第三方服务对于builder的信任上,在未来flashbots会开发出一套去中心化的信
任体系。其次成为builder有很大的门槛。