> ## Documentation Index
> Fetch the complete documentation index at: https://docs.magicblock.gg/llms.txt
> Use this file to discover all available pages before exploring further.

# Sealed-Bid Auction

> Run a private first-price sealed-bid auction with hidden bids on a Private Ephemeral Rollup, SPL token escrow on both layers, and on-chain winner selection.

The Sealed-Bid Auction example sells a fixed SPL token lot to the highest of a set of hidden,
fully collateralized bids. The seller's lot stays escrowed in a base-layer token account owned by the
auction PDA, bidders place private bids on a Private Ephemeral Rollup (PER), and after the deadline
the program scans the bid accounts on-chain, pays the seller, refunds the losers, and releases the
lot to the winner on the base layer.

> [!WARNING]
>
> This is an integration example, not a production auction house. It implements a single first-price
> auction per lot with deliberately simple deadline and refund handling.

> [card] [View Repository](https://github.com/magicblock-labs/magicblock-engine-examples/tree/main/sealed-auction/anchor)
>
> Build, test, and run the Anchor program and client.

> [card] [On-chain Privacy](https://docs.magicblock.gg/pages/private-ephemeral-rollups-pers/introduction/onchain-privacy.md)
>
> Understand the PER privacy model behind the hidden bid state.

## What the example demonstrates

* **Hidden bid state on a PER:** each bid lives in a private, auction-sponsored PDA that only gains
  PER access at creation, so amounts and bidders stay hidden until settlement.
* **Two-layer SPL escrow:** the seller's lot is parked in a base-layer auction ATA while bid
  collateral moves through a delegated auction-owned escrow on the ER.
* **On-chain winner selection:** `end_auction` count-checks and scans exactly the accepted bid PDAs
  on the ER — no off-chain matching or reveal phase.
* **Cleanup-gated undelegation:** the auction PDA can only undelegate after every bid account is
  settled and closed, and the base-layer `finalize` then transfers the lot to the winner.

## Recommended next steps

> [card] [PER Quickstart](https://docs.magicblock.gg/pages/private-ephemeral-rollups-pers/how-to-guide/quickstart.md)
>
> Set up a Private Ephemeral Rollup and its access control.

> [card] [SPL Token Custody](https://docs.magicblock.gg/pages/ephemeral-spl-token/smart-contract-integration.md)
>
> Custody and move SPL tokens from your own program on the ER.

> [card] [Access Control](https://docs.magicblock.gg/pages/private-ephemeral-rollups-pers/how-to-guide/access-control.md)
>
> Grant and revoke PER permissions on program accounts.

> [card] [Prediction Markets & Trading](https://docs.magicblock.gg/pages/solutions/prediction-markets.md)
>
> Compose custody, privacy, and settlement into a full protocol.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.