---
title: How Gnosis Batch Auction Works
tags: gnosis_auction
---
# How Gnosis Batch Auction Works
- Imagine a pile of tokens to be sold in an auction
- Sort all bids by price from highest to lowest
- If there are bids with the same price, sort them from low bid amount to high bid amount
- Start virtually distributing to bidders starting at the top of the list using the price of highest bid (while respecting participant’s max price)
- At the first iteration, you’d distribute tokens only to the top bid
- At the second iteration you’d distribute tokens to the first two bids using the price of the second bid
- Repeat until you’re able to distribute all tokens
- The first time all tokens are gone, sets the final clearing price and the list of participants who will get token
## Example
Pile has 15 tokens
At the end of the auction there are 4 bids, ordered by price:
| Bid No. | Bid size | Bid price |
| -------- | -------- | -------- |
|1|2|20|
|2|4|11|
|3|5|11|
|4|3|2|
|5|7|0.5|
|6|5|0.3|
### First iteration
Distribute using price of 20 to the first bidder
Bidder 1 gets 2/20=0.1 tokens
Can’t distribute to bidder number two because he’s not willing to pay 20
14.9 tokens remaining
### Second iteration
Distribute using price of 11 to the first two bidders
Bidder 1 gets 2/11=0.181 tokens
Bidder 2 gets 4/11=0.363 tokens
14.456 tokens remaining
### Third iteration
Distribute using price of 11 to the first three bidders
Bidder 1 gets 2/11=0.181 tokens
Bidder 2 gets 4/11=0.363 tokens
Bidder 3 gets 5/11=0.454 tokens
14.001 tokens remaining
### Fourth iteration
Distribute using price of 2 to the first four bidders
Bidder 1 gets 2/2=1 tokens
Bidder 2 gets 4/2=2 tokens
Bidder 3 gets 5/2=2.5 tokens
Bidder 4 gets 3/2=1.5 tokens
Can’t distribute to bidder number five because he’s not willing to pay 2
8 tokens remaining
### Fifth iteration
Distribute using price of 0.5 to the first five bidders
Bidder 1 gets 2/0.5=4 tokens
Bidder 2 gets 4/0.5=8 tokens
Bidder 3 gets 5/0.5=10 tokens
Bidder 4 gets 3/0.5=6 tokens
Bidder 5 gets 7/0.5=14 tokens
(more than) All tokens were distributed
## Final Outcome
Clearing price of the auction is 0.5
Bider distribution:
Bidder 1 gets 4 tokens
Bidder 2 gets 8 tokens
Bidder 3 gets the remaining 3 tokens (and 3.5 bidding token refund)
Bidders 4, 5 and 6 doesn't get any tokens (and full bidding token refund)