Quickstart
Get up and running with Mega CLI in minutes
Video Demo
Watch a full demonstration of Mega CLI in action:
This demo walks through setting up a a starter project, working with accounts, deploying contracts, and more.
Prerequisites
Before you begin, make sure you have:
- Installed Mega CLI globally (
npm install -g megaeth-cli
) - Set up Foundry using
mega setup
- Created a local account using
mega account create
(recommended)
If you haven’t completed these steps yet, see the Installation and Setup guide.
Creating Your First Project
Mega CLI makes it easy to set up a new project with all the necessary configuration for MegaETH.
Create a Full-Stack Project
This creates a full-stack project with both Foundry (for smart contracts) and Next.js (for frontend).
Start the Development Environment
Once your project is created, you can start the development environment:
This command starts both:
- A local Anvil blockchain instance for development
- The Next.js development server for the frontend
You can also start them individually (recommended):
Deploying Your First Contract
The starter project includes sample contracts you can deploy right away:
- First, compile your contracts:
- Then, deploy to the local development chain:
- Or, deploy to the Mega testnet using your account:
Before deploying to testnet, make sure you have test tokens. You can request them using:
Checking Account Balance
You can check the balance of your account or any address:
Next Steps
Now that you’ve created your first project and explored the basic features, you can:
- Learn more about project structure
- Explore the command reference for detailed usage
- See examples of common workflows
Troubleshooting
If you encounter any issues:
- Ensure Foundry is properly installed (
mega setup --check
) - Check that you’re using the latest version of Mega CLI
- For testnet operations, confirm you have test tokens in your account
Was this page helpful?