A universal Ethereum swiss army knife with an AI duck taped onto it.
A CLI for non-technical users, trying to bridge the gap between graphical UIs and CLIs.
A framework for rapid tool building; integrate a new tool in a matter of hours.
An extensible framework composed of hardhat plugins.
Example usages:
ethernaut what is the total supply of USDC
or
ethernaut complete level 2 of the ethernaut challenges
It can also be used as a regular cli:
ethernaut util unit 5 --from ether --to wei
And also features an interactive mode that allows easy navigation of tasks and collection of task arguments.
This CLI is mean to be installed globally, and not as a per-project task runner as hardhat is normally used for.
npm i -g ethernaut-cli
Anvil
curl -L https://foundry.paradigm.xyz | bash
foundryup
This is a monorepo built with lerna, composed of hardhat plugins. The global nodejs application entry point is in packages/ethernaut-cli/ethernaut
. All code is vanilla javascript.
Clone the repo.
Installs all monorepo dependencies.
npm install
Bootstraps lerna and runs build scripts for all packages.
npm run build
Compiles any contracts in the monorepo's packages.
npm run compile
Use the global ethernaut
binary to run the CLI.
./packages/ethernaut-cli/ethernaut <command> <args>
You may want to add this binary to your PATH in your .zshrc or .bashrc, so that you can run it with an abbreviation such as 'eth'.
eth <command> <args>
This would allow you to have an eth
develpment version as well as an ethernaut
official version installed on your system as a global npm package.
To run the CLI with verbose output, run:
DEBUG=* eth <command> <args>
// All packages
DEBUG=*hardhat* eth <command> <args>
// Hardhat packages
DEBUG=*ethernaut* eth <command> <args>
// ethernaut packages
DEBUG=*ethernaut:ui* eth <command> <args>
// ethernaut-ui packages
Some tests require a network to be running. You can start one with:
npm run chain
Tests all packages in the monorepo.
npm run test
To test a single package, run:
cd packages/ethernaut-ai && npm test
To run tests with verbose output, run:
DEBUG=* npm test
// All packages
DEBUG=*hardhat* npm test
// Hardhat packages
DEBUG=*ethernaut* npm test
// ethernaut packages
DEBUG=*ethernaut:ui* npm test
// ethernaut-ui packages
No more man pages. No more --help.
Just type ethernaut
and jump straight into an enquirer based navigation mode. Select a scope, select a task, and boom.
Once in a task, interactive mode kicks in, and parameters are collected through enquirer prompts.
This is still a regular CLI app, so commands can be called without all the fancy ui or ai stuff:
Plugins of plugins? Why not.
Plugins that enhance parameter collection prompts in other plugins with even cooler prompts, smart suggestions, etc.
For example, the ui extension of the interact plugin can fetch the abi from Etherscan if you didn't provide an abi:
But after you've interacted with the contract, it already has the abi, so the abi is instead suggested:
Another example is the extension for the model param in ethernaut ai config --model
, which queries the openai API and presents a list of available models.
If that wasn't easy enough, just type whatever you want and AI will kick in to try to make sense of what you typed, and the right command or sequence of commands will be executed.
You want the AI to also teach you how the commands work? Sure.
You want the AI to also teach you about Ethereum. Also sure.
You don't have to use this entire plethora of features tho. You can use a single feature in your regular hardhat project with exactly what you need. This is because the ethernaut-cli is completely built with hardhat plugins.
You just want task navigation and interactive mode in your project: use the ethernaut-ui
plugin.
Or the ai stuff: use ethernaut-ai
plugin.
All the plugins combined conform the ethernaut-cli.
List of packages
Title | Description |
---|---|
ethernaut-ai | AI assistant that interprets user input and executes hardhat tasks |
ethernaut-ai-ui | Ui extensions for the ethernaut-ai package |
ethernaut-cli | Main hardhat project |
ethernaut-challenges | Tasks for playing the Open Zeppelin Ethernaut challenges from the CLI |
ethernaut-common | Common utils used by several ethernaut-cli plugins |
ethernaut-interact | Tasks for sending transactions and interacting with contracts |
ethernaut-interact-ui | Ui extensions for the ethernaut-interact package |
ethernaut-network | Tasks for interacting with different networks |
ethernaut-network-ui | Ui extensions for the ethernaut-network package |
ethernaut-ui | Intuitive navigation and interactive param collection for hardhat tasks |
ethernaut-util | Simple, everyday utilities for Ethereum devs |
ethernaut-util-ui | Ui extensions for the ethernaut-util package |
ethernaut-wallet | Tasks for interacting from different Ethereum accounts |
ethernaut-wallet-ui | Ui extensions for the ethernaut-wallet package |