Files
zeekay 32956c020d Play on Lux Testnet, and publish the site from main
The only live network was Sepolia, where deploy.sepolia.json pointed at
OpenZeppelin's own deployment of the levels; its Motorbike still checks
the old condition.  Lux Testnet, C-Chain 96368, replaces it, defined once
in src/chains.js for the client and the supersede script.  Until the
levels are deployed there, the game offers to deploy them from the
browser, as it does on any network without deploy data.

A push to main that passes the tests now publishes client/build to the
Sites plane as project `game`.

Claude-Session: https://claude.ai/code/session_019ABm6hF8RNyUFpbjQWqfxY
2026-09-23 14:52:34 -07:00

3.6 KiB

This level walks you through the very basics of how to play the game.

 

1. Set up MetaMask

If you don't have it already, install the MetaMask browser extension (in Chrome, Firefox, Brave or Opera on your desktop machine). Set up the extension's wallet and use the network selector to point to the preferred network in the top left of the extension's interface. Alternatively you can use the UI button to switch between networks. If you select an unsupported network, the game will notify you and bring you to the default Lux Testnet.

2. Open the browser's console

Open your browser's console: Tools > Developer Tools.

You should see a few messages from the game. One of them should state your player's address. This will be important during the game! You can always see your player address by entering the following command:

player

Keep an eye out for warnings and errors, since they could provide important information during gameplay.

3. Use the console helpers

You can also see your current ether balance by typing:

getBalance(player)

NOTE: Expand the promise to see the actual value, even if it reads "pending". If you're using Chrome v62, you can use await getBalance(player) for a cleaner console experience.

Great! To see what other utility functions you have in the console type:

help()

These will be super handy during gameplay.

4. The lux contract

Enter the following command in the console:

lux

This is the game's main smart contract. You don't need to interact with it directly through the console (as this app will do that for you) but you can if you want to. Playing around with this object now is a great way to learn how to interact with the other smart contracts of the game.

Go ahead and expand the lux object to see what's inside.

5. Interact with the ABI

lux is a contract object that wraps the Lux.sol contract that has been deployed to the blockchain.

Among other things, the contract's ABI exposes all of Lux.sol's public methods, such as owner. Type the following command for example:

lux.owner() or await lux.owner() if you're using Chrome v62.

You can see who the owner of the lux contract is.

6. Get test ether

To play the game, you will need test ether. The easiest way to get some testnet ether is via a valid faucet for your chosen network.

Once you see some coins in your balance, move on to the next step.

7. Getting a level instance

When playing a level, you don't interact directly with the lux contract. Instead, you ask it to generate a level instance for you. To do so, click the "Get New Instance" button at the bottom of the page. Go do it now and come back!

You should be prompted by MetaMask to authorize the transaction. Do so, and you should see some messages in the console. Note that this is deploying a new contract in the blockchain and might take a few seconds, so please be patient when requesting new level instances!

8. Inspecting the contract

Just as you did with the lux contract, you can inspect this contract's ABI through the console using the contract variable.

9. Interact with the contract to complete the level

Look into the level's info method contract.info() or await contract.info() if you're using Chrome v62. You should have all you need to complete the level within the contract. When you know you have completed the level, submit the contract using the submit button at the bottom of the page. This sends your instance back to the lux, which will determine if you have completed it.

Tip: don't forget that you can always look in the contract's ABI!