> For the complete documentation index, see [llms.txt](https://docs.midnight.network/llms.txt)

# Private party tutorial

**Prerequisites:** complete [Hello World](https://docs.midnight.network/getting-started/hello-world.md) first. This tutorial assumes you can compile a contract and run a local devnet.

This is the first real contract on the learning path. It is about the **privacy boundary**: the exact point where a user's private data becomes public. Compact keeps data private by default, so you decide where that point is and you put it there on purpose.

A party organizer deploys the contract. Guests RSVP without revealing who they are, then pay an entry fee in NIGHT when they arrive. NIGHT is an unshielded token, and unshielded transfers are always public, so paying the fee is where each guest crosses the boundary. Along the way you will see:

* **The privacy boundary.** Guests stay private until they pay the unshielded NIGHT entry fee at check-in. The organizer stays private until they claim the fees.
* **A salted commitment.** The RSVP list holds a `persistentCommit` of each guest's address, salted with the guest's secret, so the list reveals nothing about who is on it.
* **A DApp-specific public key.** The organizer is identified by a `persistentHash` of a secret, not by a wallet address, and that key gates the organizer-only circuits.
* **Unshielded NIGHT in and out.** `receiveUnshielded` takes each guest's fee and `sendUnshielded` pays the total to the organizer.
* **A state machine.** A `PartyState` enum decides which circuits can run at each stage of the party.

The source for this tutorial is [`examples/private-party`](https://github.com/midnightntwrk/midnight-examples/tree/main/examples/private-party) in midnight-examples.

## Set up[​](#set-up "Direct link to Set up")

Clone midnight-examples, install the workspace, and compile every contract:

```
git clone https://github.com/midnightntwrk/midnight-examples.git

cd midnight-examples

npm install && npm run compile
```

Then move into the example:

```
cd examples/private-party
```

You'll start the local network in the second part, when you run the tests.

[✦](https://docs.midnight.network/tutorials/private-party/smart-contract.md)

### [Private party contract](https://docs.midnight.network/tutorials/private-party/smart-contract.md)

[Read a contract that keeps guests private behind salted commitments and gates the organizer's actions with a DApp-specific key, then makes guests public at exactly one point: the NIGHT entry fee.](https://docs.midnight.network/tutorials/private-party/smart-contract.md)

[Read the contract→](https://docs.midnight.network/tutorials/private-party/smart-contract.md)

[✦](https://docs.midnight.network/tutorials/private-party/test-suite.md)

### [Private party tests](https://docs.midnight.network/tutorials/private-party/test-suite.md)

[Run the party on a local devnet with MidnightJS: RSVP, check in, claim the fees, and watch the contract turn away the wrong callers.](https://docs.midnight.network/tutorials/private-party/test-suite.md)

[Run the tests→](https://docs.midnight.network/tutorials/private-party/test-suite.md)
