Dust Diceprovably fair dice on Midnight

Setup

Watching a game needs nothing. To play, you need three things: a Midnight wallet in your browser, DUST for its fees, and a proof server on your computer. With 1AM you can do without the last two: it can pay the fees for you and prove inside the browser, more slowly.

1. A Midnight wallet

These wallets have been tested with this dApp:

  • Lace: browser extension.
  • 1AM: browser extension.
  • Moth: browser extension, built from source. The developer's favorite, but not publicly released, so use it at your own risk. Turn on Developer mode in its Settings to reach Mainnet.

2. DUST for the fees

Your wallet pays a fee in DUST to join a table and to leave or resign one, and for a rescue should the operator stop answering. The operator pays for your moves.

Some wallets pay these fees for you: 1AM's Dust Sponsorship setting, on by default, does. Otherwise your wallet needs DUST of its own. DUST is not bought or sent: it builds up over time from NIGHT you hold and have registered to your wallet.

On mainnet that NIGHT is held on Cardano (cNIGHT) until the bridge to Midnight opens. Register your cNIGHT for DUST, which links your Cardano address to your Midnight wallet's DUST address: your wallet offers this, or use the cNgD DApp. The registration takes about 12 hours to reach Midnight, and from then on your cNIGHT generates DUST in your Midnight wallet.

3. A proof server on port 6300

Every move carries a zero-knowledge proof, and your wallet asks a proof server to build it. Midnight's networks do not provide one. You run it yourself, because a proof request carries your move's private inputs and the key that pays its fee. If no proof server is running where your wallet looks for one, the wallet refuses the move, often with the error proveTx rejected.

1AM can also prove inside your browser, with no proof server at all, but a move then takes about 22 seconds to prove instead of about 2.

  1. Install Docker Desktop and start it.

  2. Open a terminal (Terminal on macOS and Linux, PowerShell on Windows) and start the proof server:

    docker run -d --name midnight-proof-server -p 127.0.0.1:6300:6300 midnightntwrk/proof-server:9.0.0

    It keeps running in the background, so you can close the terminal. On its first start it downloads Midnight's public proving parameters, so your first move can take a little longer.

  3. Check that it answers: open http://localhost:6300/version in your browser. It should say 9.0.0.

  4. In your wallet's settings, check that the proof server is http://localhost:6300. That is Lace's default.

Shut the proof server off

Stop it when you are done playing:

docker stop midnight-proof-server

It does not start by itself when your computer or Docker restarts. Start it again before you play next time:

docker start midnight-proof-server

To remove it for good, stop it first, then delete the container and the downloaded image:

docker rm midnight-proof-server
docker rmi midnightntwrk/proof-server:9.0.0

The Containers tab in Docker Desktop has the same stop, start and delete buttons.

If a command fails

  • The container name "/midnight-proof-server" is already in use: you started one before. Run docker start midnight-proof-server instead.
  • port is already allocated: something on your computer already uses port 6300, perhaps a proof server you started another way. If the version page says 9.0.0, you are ready to play.

More from Midnight