1. Introduction

Public blockchains are renowned for their transparency, which is great for auditability but challenging for privacy-sensitive applications. Commercial secrets, medical records, or sealed bidding processes require data confidentiality.

Midnight addresses this challenge by enabling developers to build smart contracts using its domain-specific language, Compact. Midnight allows you to manage private states and verify transactions seamlessly using Zero-Knowledge Proofs (ZKPs).

In this tutorial, we will explore how to build a Sealed-Bid Auction smart contract on Midnight. We will look at how bidders can submit secret bids without revealing their bid amounts, while the contract securely verifies and updates the highest bidder.

2. Core Concept: Public vs. Private State Separation