Web3 has emerged as a breeding ground for innovation with the introduction of new types of digital solutions. One of the notable games which have grabbed the attention of web3 enthusiasts in recent times is Ethernaut. The name might sound dystopian with the combination of two words, “Ethereum” and “Astronaut.” The fundamentals of Ethernaut explained for beginners would draw attention to the unique design of the game.
It is an open-source web3 game based on Solidity programming language, which draws inspiration from another popular web3 game, Over The Wire. You can play the game only on the Ethereum Virtual Machine and cross multiple levels by completing challenges. The following post offers you a detailed overview of Ethernaut and essential information required to start playing the game.
Aspiring to Become a Certified Web3 Expert? Enroll in Certified Web3 Professional (CW3P) Certification Course Now!
What is Ethernaut?
The thought of computer games brings immersive graphics and intuitive gameplay elements with different characters in a game. However, it is important to learn about the new breed of games emerging in the field of web3, like Ethernaut. First of all, you must note the Ethernaut OpenZeppelin connection, as OpenZeppelin is the creator of Ethernaut. It is a web3 game developed on the foundations of Solidity programming, like a wargame. Players could find Capture the Flag (CTF) challenges, where you have to complete individual levels.
The tasks are one of the crucial highlights in responses to “What is Ethernaut?” and feature distinct levels of difficulties. At each level, you would find a smart contract code and complete different tasks, such as claiming ownership of the smart contract or draining Ether from the contract. Some tasks also require players to compromise the given smart contract according to objectives of the relevant level. The game could serve as a tool for people interested in learning about smart contracts and Ethereum. Interestingly, there is no specific number of levels or a particular order for playing the different levels in the game.
Excited to learn the basic and advanced concepts of ethereum technology? Enroll Now in The Complete Ethereum Technology Course
How Can You Install and Run Ethernaut?
The fundamental guides to Ethernaut solutions would emphasize the important prerequisites for installing and running the game. You should know the mandatory components required for running or deploying Ethernaut and ensure local operations. Here are the three essential components required for running Ethernaut locally on your system.
-
Test Network
The test network or testnet is a mandatory requirement for playing Ethernaut. It is important to ensure that the testnet runs locally on your system. Some of the common test networks for Ethernaut include geth, Ganache, or Hardhat.
-
Contract Deployment
Most of the work in Ethernaut revolves around smart contracts. However, you must deploy the contracts on the locally running test network to work with them in the game.
-
Frontend
The frontend or the client in Ethernaut is a React app running locally and accessible through localhost:3000.
Here are the important steps for installing and running Ethernaut locally on your machine.
- Clone the Ethernaut Github repo and ensure installation of dependencies.
- Initiate the deterministic rpc.
- Complete the import of one of the private keys from Ganache-cli output to the Metamask wallet.
- Fulfill the important conditions for contract compilation.
- Set the value of ‘client/src/constants.js ACTIVE_NETWORK’ to ‘NETWORKS.LOCAL.’
- In the final step, deploy the contracts and initiate Ethernaut locally on your system.
Excited to build your skill in Ethereum development by leveraging the ethers.js library? Enroll Now in Ethers.Js Blockchain Developer Course!
How Can You Play Ethernaut?
One of the prominent entries among Ethernaut challenges is that it is a new web3 game and presents difficulties for beginners. Where do you start playing the Ethernaut game? The good news is that the official documentation of Ethernaut provides a detailed guide on the steps to start playing. Here is a simple outline of the steps required for playing Ethernaut.
-
Install Metamask Wallet
The first thing you need to play Ethernaut is a Metamask browser extension on the Chrome, Brave, Opera, or Firefox browser on your machine. It is important to configure the wallet and choose the desired network from the interface of the Metamask extension. On the contrary, you can utilize the UI button for switching between networks. If you choose an incompatible network, the game will serve you a notification and redirect you toward the default testnet, i.e., Sepolia.
-
Access the Browser Console
The next step in accessing the Ethernaut OpenZeppelin game involves opening the browser console. You can access the browser console by clicking on “Tools” and then “Developer Tools” in your browser. The console would showcase some messages where you could find the player’s address.
Remember that the player address is an important requirement for playing the game, and you can access the player address anytime with the simple command ‘player.’ You should watch out for errors and warnings as they could offer crucial information for your gameplay.
-
Bring the Console Helpers to Play
Another important aspect in an introduction to Ethernaut explained for beginners would point at console helpers. For example, you can obtain the details about existing Ether balance by using the following command,
getBalance (player)
Players could also access other console helpers or utility functions in the console. You can access the console helpers by typing “help()” in the console and using them for crucial functions during gameplay.
-
Main Smart Contract of Ethernaut
Players can obtain the main smart contract of the game by typing the command ‘ethernaut’ in the console. The Ethernaut contract, or the main smart contract, is an integral part of the gameplay. Players don’t have to interact directly with the main contract through the console. The main contract offers you an opportunity to learn the best approaches for interacting with other smart contracts. You can expand the Ethernaut contract and take a look at its contents to obtain the relevant information.
Curious to understand the complete smart contract development lifecycle? Enroll in Smart Contracts Development Course Now!
-
Interaction with ABI of the Smart Contract
Players interested in finding answers to “What is Ethernaut?” before playing the game must go through the ABI of the main contract. It is important to note that the main contract is a ‘TruffleContract’ object wrapping an ‘Ethernaut.sol’ contract file deployed on the Ethereum blockchain. The ABI of the contract could expose all the public methods of ‘Ethernaut.sol’, including details of ‘owner’ object. You can use commands like ‘await ethernaut.owner()’ or ‘ethernaut.owner()’ to identify the owner of the Ethernaut main contract.
-
Obtain Test Ether and Level Instance
Before you start playing Ethernaut, you would need to test Ether. One of the most effective ways for obtaining test Ether is a valid faucet for the selected network. Once you have obtained the test Ether coins in your wallet, you can move to the next step. The next step involves obtaining a level instance.
Players should remember that they don’t engage in direct interaction with the Ethernaut contract during the gameplay. This is where you have to ask the game to generate a level instance. You can select the “Get New Instance” option at the bottom of the interface and authorize the transaction through a prompt by Metamask. Upon confirmation, you will come across messages in the console as it deploys a new contract. Patience is the key requirement when you request new-level instances.
-
Inspection of Contract and Interaction
Just like the Ethernaut contract, you should also examine the ABI of the newly deployed contract. The console can help you in inspection of the contract by utilizing the ‘contract’ variable. Subsequently, you should interact with the level or play the game by exploring the info method of the concerned level.
The commands ‘await contract.info()’ or ‘contract.info()’ could help you find the information about the level. Once you have completed the tasks of the level, you can submit the contract by selecting the submit button on the interface. When you submit the contract, the instance is redirected to Ethernaut, which determines whether you have completed the level successfully.
Want to learn the basic and advanced concepts of Ethereum? Enroll Now in Ethereum Development Fundamentals Course
How Many Levels Can You Find in Ethernaut?
The Ethernaut Github documentation shows that you can find multiple levels in the game. Ethernaut is an open-source web3 game and features contributions from multiple developers. You can access the official interface of Ethernaut and find 29 levels, including the basic tutorial for starting the gameplay. Let us take a look at the objectives of some notable levels and important things which can help you in each level.
-
Fallback
The second level in Ethernaut would have you wondering about ‘What is the fallback function of Ethernaut?’ as it deals with fallback. Players would have to complete the level by claiming ownership of the given contract and reducing its balance to zero. Some of the important things which can help you at this level include knowledge of fallback methods, approaches for sending Ether during interaction with an ABI, and sending Ether outside the ABI. You should know about the conversion between wei and Ether units.
-
Fallout
The next level in Ethernaut after the fallback function is fallout. Players have to claim ownership of the given contract to complete the fallout level. You could capitalize on your knowledge of Solidity Remix IDE at this level.
-
Coin Flip
The creative aspect of Ethernaut challenges with tasks like the coin flip level make it more interesting. Coin Flip is a simple coin-flipping game where players have to create a winning streak through correct guesses of coin-flip outcomes. You can complete the level by using psychic abilities to guess the correct outcome consecutively 10 times.
-
Token
Another interesting level in the Ethernaut game is known as a token. The primary objective of the level focuses on hacking the basic token contract. You can receive 20 tokens for beginning the level. Players can complete the level by obtaining additional tokens. The important requirement for completing the token level in Ethernaut is your knowledge of the working of an odometer.
-
Delegation
The Delegation level in Ethernaut OpenZeppelin tasks also tasks players with claiming ownership of the given instance. Some of the important things that could help you in this stage include fallback methods, method ids, and awareness about ‘delegatecall’ low-level function. You should learn how to use the ‘delegatecall’ low-level function for delegating operations to on-chain libraries. In addition, you must identify how the low-level function could influence the execution scope.
-
Force
The hacking tasks in Ethernaut become more interesting in the Force level of the web3 game. At this level, players have to increase the balance of the contract beyond zero. You can utilize fallback methods as well as the ideal practices for attacking a contract by using another contract.
Some of the other levels in the game include Vault, King, Re-Entrancy, Elevator, Privacy, Gatekeeper, Naught Coin, and many others. You can find distinct objectives for each level and practice your Ethereum and smart contract skills to perfection.
Familiarize yourself with the popular blockchain network through Ethereum SKill Path
What is Ethernaut DAO?
Another crucial highlight in discussions about Ethernaut refers to the Ethernaut DAO and its applications. The Ethernaut Decentralized Autonomous Organization has been tailored as an effective solution for helping developers transition to web3. It aims at addressing the problems due to scarcity of skilled and experienced Solidity developers.
The DAO serves as a meeting place for mentors and trainees. Mentors present their mentorship proposals and interview prospects alongside choosing the qualified trainees. The mentoring process helps in creating new Ethereum engineers who could also turn into mentors for new trainees one day. On top of it, the Ethernaut Decentralized Autonomous Organization offers open accessibility for any contributor.
Aspiring to become a web3 developer? Checkout detailed guide on How To Become A Web3 Developer now!
Conclusion
The introduction to Ethernaut explained the necessity of gamification for bringing more developers to web3. With all the hype around web3 development, it is inevitable to notice the scarcity of senior developers and engineers. Where will people go to learn the vast base of knowledge required for web3 development?
Ethernaut provides an interesting way to familiarize with web3 development through practical interactions with smart contracts. The Ethernaut challenges feature smart contracts and objectives for claiming ownership or draining Ether from the smart contracts. As a result, you can learn how to work with smart contracts as you play and complete challenges.
You can come across multiple levels in the Ethernaut game, and it also offers support for completing each level successfully. Furthermore, you should also take note of Ethernaut DAO, an important instrument for expanding the popularity of Ethernaut. Apart from popularizing Ethernaut, the DAO could also welcome many web2 developers into the domain of web3. Explore the details of different levels of Ethernaut and find your first point of entry in the world of web3 right now.