Assignment

Well, in this chapter, we created a scoreboard for your game; now, it's time to play a game and test it out.

For today's assignment, here's what you need to do:

  1. Install MetaMask. To do so, you'll go to MetaMask.io and follow the instructions, just as we did in our previous sections. Remember, you need to be using Chrome, Brave, Firefox, or Opera in order for MetaMask to work.
  2. Next, launch Ganache and copy the seed phrase.
  3. Set up your account in MetaMask using the seed phrase, and MetaMask should connect to the main Ethereum network by default, so you'll need to configure it to use Ganache.
  4. Once that's done correctly, you'll see your account balance from Ganache and MetaMask, and then you'll need to deploy your contracts.

When you do, it's likely that you're going to see this error, so let's take a look and see what it means:

The key line here is, Attempting to run transaction, but recipient address (...) is not a contract address. What this is telling us is that you've deployed this contract with this configuration before, but the deployed address doesn't exist on this network. This error is to keep you from deploying multiple instances of your contract to the same network inadvertently, which is a good thing right? If that were to happen, how would you know which contract on the network was the right one to use?

In this particular case though, this error is okay to ignore; we're seeing it because we restarted Ganache, which creates a brand new network, so the deployed contract from the last time we ran Ganache truly doesn't exist.

So, to get around that error, run the following command:

truffle migrate -- reset 

And now, you can play a few rounds of your game.

Check to see that the scoreboard you built yesterday is updating with the correct variables, and check to see that your account balance in MetaMask is properly updating when you win or lose a few rounds. Our application is now complete and functioning; it's only running on your local workstation though, right?