# TopOfBlockAuction > Sells the right to trade first in a block, and gives the proceeds to the liquidity providers who are being traded against. A production Uniswap v4 hook. Source: https://github.com/nirholas/top-of-block-auction. Part of the HookForge catalogue: https://hookforge.pages.dev ## How it works The first swap in a block against a pool whose price has moved overnight is worth money, and today that money goes to whoever wins the gas auction or pays the builder. The liquidity providers, whose stale quote is the entire source of the value, receive the ordinary swap fee and nothing else. This is the largest single transfer away from passive liquidity in the system, and it happens in a market the pool cannot see and does not participate in. The idea of auctioning that right and paying the pool instead is not new: it is the am-AMM proposal, and MEV-Share and MEV-Boost redistribute adjacent value off-chain. What has been missing is a version the pool runs itself, per block, with no auctioneer, no off-chain infrastructure and nobody to trust with the proceeds. This is that. A searcher bids native currency for a named future block. The highest bid at the time the block arrives wins the exclusive right to the first swap in it, and the bid is paid to the pool's liquidity providers. Everybody else can still trade in that block, just not first. Once the winner has taken their slot, or if nobody bid, the pool is ordinary. Bidding on a future block rather than the current one is what makes this work without an auctioneer. A bid for the block being built cannot be evaluated inside that block without knowing bids that have not arrived, so the auction would have to be settled by somebody. Bidding one block ahead means the winner is already known when the block opens, and the contract simply checks who it is. A losing bid is never taken. Bids are held and the loser withdraws in full, so bidding costs nothing but gas, and a searcher who is outbid is not out of pocket. ## Prior art The mechanism is the am-AMM auction (Adams, Moallemi, Reynolds, Robinson), which auctions pool management rights over a longer horizon, and the broader family of order-flow auctions run off-chain by builders and relays. Running the auction per block, inside the pool, with the winner known before the block opens so no auctioneer is needed, is the contribution here. ## Where it does not help The pool cannot see whether the winner actually used their slot well, only that they took it, so a searcher who wins and does nothing simply wastes their bid and blocks nobody. More importantly, a builder can still reorder the block: this sells the first slot in the pool's own accounting, not the first position in the block, so a searcher who controls ordering can place their own transaction before the winner's and the winner gets a slot that is no longer first. It raises the cost of that rather than preventing it. ## Facts Slug: top-of-block-auction Contract: TopOfBlockAuctionHook Callbacks: beforeSwap, afterInitialize Parameters: leadBlocks (uint32), minBid (uint128) Dynamic fee required: no ## Caveats - Unaudited. - A deployment with status "deterministic" is a mined CREATE2 address with no code at it yet. Never present one as live.