A step-by-step tutorial for running sealed-bid auctions on Aleo

HEORHII YABLONSKYI
3 min readNov 9, 2023

--

Explore the world of private auctions on Aleo, where security meets transparency. Here’s a step-by-step guide to conducting a first-price sealed-bid auction using Aleo’s unique features.

Overview: a first-price sealed-bid auction involves bidders submitting bids without knowledge of others’. The highest bid wins. Aleo ensures privacy and fairness through cryptographic techniques.

Advantages of Aleo auction:

  1. Unparalleled privacy: Aleo’s use of zero-knowledge proofs ensures that participants can engage in auctions without revealing sensitive information, setting a new standard for privacy in online transactions.
  2. Security assurance: With an honest auctioneer and cryptographic protocols in place, Aleo auctions provide a secure environment where participants can trust the integrity of the bidding process.
  3. Efficiency and transparency: Aleo’s blockchain architecture streamlines the auction process, making it efficient and transparent. Bidders can engage confidently, knowing that the resolution occurs in a tamper-proof manner.
  4. Data minimization: unlike traditional auctions that demand extensive personal information, Aleo’s approach minimizes data exposure. Participants only disclose what is necessary, reducing the risk of identity theft and unauthorized access.

Assumptions:

  • Honest auctioneer
  • Unlimited bids
  • Auctioneer knows bidders
  • Bidders may not know each other

Auction flow:

  1. Bidding: bidders submit bids.
  2. Resolution: auctioneer resolves bids in order.
  3. Finishing: the auctioneer concludes, providing the winning bid to the bidder.

Language features:

  • Record declarations
  • assert_eq
  • Record ownership

How to run:

Follow Leo Installation Instructions. Run the auction program using the provided bash script.

cd auction
./run.sh

Walkthrough:

Step 0: initializing the auction

  • Set up private keys and addresses for Bidder 1, Bidder 2, and Auctioneer.

Step 1: the first bid

  • Swap in the private key and address of the first bidder to .env.
echo "
NETWORK=testnet3
PRIVATE_KEY=APrivateKey1zkpG9Af9z5Ha4ejVyMCqVFXRKknSm8L1ELEwcc4htk9YhVK
" > .env
  • Bidder 1 places a bid of 10u64.
leo run place_bid aleo1yzlta2q5h8t0fqe0v6dyh9mtv4aggd53fgzr068jvplqhvqsnvzq7pj2ke 10u64

Step 2: the second bid

  • Swap in the private key of the second bidder to .env.
echo "
NETWORK=testnet3
PRIVATE_KEY=APrivateKey1zkpAFshdsj2EqQzXh5zHceDapFWVCwR6wMCJFfkLYRKupug
" > .env
  • Bidder 2 places a bid of 90u64.
leo run place_bid aleo1esqchvevwn7n5p84e735w4dtwt2hdtu4dpguwgwy94tsxm2p7qpqmlrta4 90u64

Step 3: select the winner

  • Swap in the private key of the auctioneer to .env.
echo "
NETWORK=testnet3
PRIVATE_KEY=APrivateKey1zkp5wvamYgK3WCAdpBQxZqQX8XnuN2u11Y6QprZTriVwZVc
" > .env
  • Auctioneer selects the winning bid.
leo run resolve "{
owner: aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh.private,
bidder: aleo1yzlta2q5h8t0fqe0v6dyh9mtv4aggd53fgzr068jvplqhvqsnvzq7pj2ke.private,
amount: 10u64.private,
is_winner: false.private,
_nonce: 4668394794828730542675887906815309351994017139223602571716627453741502624516group.public
}" "{
owner: aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh.private,
bidder: aleo1esqchvevwn7n5p84e735w4dtwt2hdtu4dpguwgwy94tsxm2p7qpqmlrta4.private,
amount: 90u64.private,
is_winner: false.private,
_nonce: 5952811863753971450641238938606857357746712138665944763541786901326522216736group.public
}"

Step 4: finish the auction

  • Auctioneer finishes the auction.
leo run finish "{
owner: aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh.private,
bidder: aleo1esqchvevwn7n5p84e735w4dtwt2hdtu4dpguwgwy94tsxm2p7qpqmlrta4.private,
amount: 90u64.private,
is_winner: false.private,
_nonce: 5952811863753971450641238938606857357746712138665944763541786901326522216736group.public
}"

Check my example:

Conclusion:

Congratulations! You’ve successfully run a private auction on Aleo. Experiment with different accounts using aleo.tools for a hands-on experience.

Explore the tutorial, embark on the journey of private auctions with Aleo, and witness firsthand the transformation of digital transactions into a realm of privacy and security. Aleo’s commitment to revolutionizing online interactions sets the stage for a future where privacy is not just a feature but a fundamental right.

To know more, join now!
Aleo Twitter
Aleo Discord
Aleo Website
List of Aleo and Leo code and resourses

Prepared by Colliseum

--

--

No responses yet