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)
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
What's included in the full-stack project?
What's included in the full-stack project?
- A Foundry environment configured for Mega testnet
- A Next.js frontend with WalletConnect integration
- Example smart contracts and frontend components
- Configuration files and project structure
Start the Development Environment
Once your project is created, you can start the development environment:- A local Anvil blockchain instance for development
- The Next.js development server for the frontend
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