Introducing Dune Playground — Part 1: Free DUNs and the Rock-Paper-Scissors Game

Thomas
Dune Network
Published in
6 min readJun 3, 2020

We are happy to introduce the Dune Playground! It is intended
both as a place where anyone can play games and earn tokens while
playing
, and a showcase for developers to learn how to write DApps for Dune Network. This tutorial is intended for a wide audience and will walk you through the steps to install Dune Metal, get free $DUN tokens and use them to play the Rock-Paper-Scissors game.

The playground website can be found here: playground.dune.network/

1. Installing the Dune Metal extension

In order to use it, you will first need to install the Dune Metal browser extension, an in-the-browser wallet to secure your secret key. Metal will sign your transactions to the blockchain during the game, and will allow you to receive rewards and move them between accounts.

If you already have Metal installed and configured (or if you just want to get some free $DUNs), you can go directly to section 2. Otherwise, in any of the four supported browsers (Chromium, Firefox, Brave and Chrome), head to the Dune Metal webpage:

Dune Metal homepage

Click “download”. Depending on your browser, you will be taken to different pages. We only deal with Firefox and Chrome here, the other ones are similar to Chrome.

In Firefox

Click “Add to Firefox” and then “Add” in the popup window.

Go below to see how to setup Metal.

In Chrome

Click “Add to Chrome” and then “Add extension” in the popup window.

Setting up Metal

In both browsers, you will land on a setup page.

Read the instructions at your convenience and click next until you get to the page:

Unless you already have a Dune Network account that you want to use with Metal, you will want to create a new account. Anyway, Metal can manage multiple accounts if you want:

Metal generates a mnemonic which is a word representation of the secret key which controls your account. Write it down somewhere safe, and then proceed with “I wrote down my mnemonic”. Optionally choose a password, and you’re all set:

You don’t have any DUN for now, and your account has not been “revealed” to the wide world, meaning that it only exists as a number on your computer for now (unless you restored your personal account on Metal).

Let us remedy these two problems by getting some free $DUN and playing a game of Rock Paper Scissors.

2. Get Free $DUN Tokens

Even though all games on the Dune playground are free to play, you will need a little $DUN just to reveal your fresh account and to pay for fees (if the games’ smart contract doesn’t pay fees for you). We have set up a simple page where you may retrieve 0.3 $DUN every 20 minutes.

Head to the Dune Playground, our game area:

Click on “Get Free $DUN”:

The Get-Free-DUNs DApp respectfully requests your permission for Dune Metal to interact with it. Approve it by clicking the green check. Your address is automatically filled in the input box of the $DUN faucet. Click “Get free $DUN” and fill the captcha. If you don’t have Metal installed or you want to airdrop another dn1 wallet, just provide the address you’d like to airdrop in the text area.

It should only take a couple of minutes (a couple of blocks on the blockchain) for you to receive your free $DUN to appear in Metal. You can also check out the Dunscan block explorer and type your address (you can find it in the Metal icon on the top right of your browser, or in the “Get Free $DUN” input box) in the search bar to monitor the incoming transaction. Eventually you receive 0.3 $DUN:

You’re now ready to play a game of Rock-Paper-Scissors.

3. Playing Rock Paper Scissors on Dune

In the Dune Playground home page, click “Play Rock Paper Scissors”.

You may be wondering why we chose this game as a first example. It turns out historically, it was one of the first “simple enough that everyone understands the game, hard enough that everybody gets it wrong the first time” examples of smart contracts studied by researchers. This gives it a bit of a Hello world (ok, maybe FizzBuzz) feel as far as DApps go. In this case, an oracle has already chosen moves that it has committed to (using a hash). Uncheck “Pay fees for me if possible” (only this first time, so your address is revealed). Choose one of Rock, Paper, or Scissors and click on it. You get a transaction request from Metal:

Note that the amount of the transaction is 0 $DUN, but the fee is something like ~ 0.011 $DUN. This fee is used to pay for the transaction to be included in the blockchain. As explained above, once you send this one transaction, all future calls to the Dune Playground games can have their fees paid for by the contract itself, thanks to our novel “collect-call” feature.

Once you send the transaction, notice the message saying “Latest choice injected with hash …” at the bottom. You may click on the link and, if the operation has been included into the blockchain (on average it takes one minute), you will see inside Dunscan:

(Bonus: if you click on the “Yes” link under “Params” at the bottom of the page, you will actually see your move encoded in the transaction)

Going back to the Rock Paper Scissors page, you will see that the current game is marked as “Ongoing”. Your transaction has been included, the oracle is now proceeding to reveal its move (which was already set in stone before you played, thanks to hash commitments). And..

Well, I lost. I’m sure you’ll do better. But I still get 1 DGG token for my trouble. These are in-house tokens for the Dune Playground, which may be earned by playing games and even sold for $DUN! We will expand on these two aspects next time. Thanks for playing, have fun!

Last, but not least, don’t hesitate to give your feedback, to spread the word, to contribute or to report bugs.

Connect with us:

Discord: https://discord.gg/JBUGqFg
Telegram: https://t.me/dune_network
Medium: https://medium.com/dune-network
Twitter: https://twitter.com/dune_network
Reddit: https://www.reddit.com/r/dune_network/
Gitlab: https://gitlab.com/dune-network
Website: https://dune.network
Email: contact@dune.network

--

--