Skip to main content

Bulletin board scenario

Imagine an old-fashioned cork bulletin board on the wall in an office hallway. This is a small bulletin board, with room for just a single piece of paper to be tacked up on it. Here are the office rules for this bulletin board:

  1. Anyone can post a message on the board when it is vacant.
  2. Once someone has posted a message, no one else can take it down. Only the person who posted that message may remove it.

Be sure you understand these rules. The following pages will refer back to them as 'rule 1' and 'rule 2'. You can probably imagine extending them to include content restrictions or time limits on posts, but they are kept intentionally simple for this tutorial.

What does it look like to implement an online version of this bulletin board? A globally shared space where anyone can update a message is easy to create, but how to enforce the rules?

Rule 1 can be enforced using only the public state of the bulletin board: if it's empty, allow a new message to be posted, but if it's occupied, reject attempts to post a message.

Rule 2 is more complicated, because it requires that the identity of the user attempting to remove a message be verified. (In fact, there's another constraint hidden in the English statement of the rule when it refers to the person who 'posted that message.' This implies that the user wanting to take down a post is able to prove not only their identity, but also that they tacked up that specific post.)

One obvious way to enforce rule 2 is to make users 'log in' to the bulletin board system, so that the system can authenticate their identities. This approach requires users to transmit evidence of their identities across the Internet to the bulletin board server, usually involving some sort of secret shared between each user and the server, which the server can verify.

Is there a better way? With Midnight, yes there is. You can contractually obligate anyone who wants to remove a message from the bulletin board to validate for themselves, on their own computer that they posted it. Midnight can safely and reliably enforce the terms of the contract by requiring a machine-checkable proof that the validation has occurred, without requiring the private evidence of the user's identity to be transmitted across the Internet.

On the following page, you will work through the process of writing a Midnight contract that represents this online bulletin board and enforces its rules without sending private identity information across the Internet. Then, you'll develop a DApp that can deploy a new bulletin board and post or remove messages.