This project provides a streamlined local Ethereum development environment with integrated block explorer support. It automates the setup and deployment process for local development and testing.
- Automated Devnet Setup: One-command setup of a local Ethereum network
- Integrated Block Explorer: Built-in Ethernal block explorer integration
- Smart Contract Deployment: Automated deployment of contracts using Hardhat Ignition
- Port Management: Automatic detection and handling of port conflicts
- Environment Management: Secure handling of API keys and environment variables
- Clean Shutdown: Graceful stopping of the development network
- Hardhat: Ethereum development environment
- Ethernal: Block explorer for local development
- Hardhat Ignition: Declarative deployment system
- Hardhat Ethernal Plugin: Integration with Ethernal block explorer
This script automates the entire development workflow:
-
Port Management:
- Checks if port 8545 is available
- Offers to kill any process using the port
-
Environment Setup:
- Creates/updates
.env
file - Manages Ethernal API token
- Validates token length and format
- Creates/updates
-
Network Initialization:
- Starts local Ethereum network
- Configures 5-second block mining interval
- Sets up network parameters
-
Contract Deployment:
- Compiles smart contracts
- Deploys contracts using Hardhat Ignition
- Logs deployment process
This script provides a clean way to stop the development network:
-
Process Detection:
- Identifies processes running on port 8545
- Shows detailed process information
-
Graceful Shutdown:
- Offers to kill the process
- Provides feedback on shutdown status
- Allows manual intervention if needed
You can use either the shell scripts directly or the npm shortcuts:
-
Start the development environment:
npm run devnet:start
-
Stop the development environment:
npm run devnet:stop
-
Start the development environment:
./scripts/devnet_setup_and_deploy.sh
-
Stop the development environment:
./scripts/devnet_stop.sh
-
Follow the prompts after running the script to:
- Set up Ethernal account (first time only)
- Configure API token
- Deploy contracts
-
Access the block explorer at:
https://app.tryethernal.com/explorer/localhost
- The network state resets each time you run the setup script. This can be reconfigured by removing the workspace and resetOnStart properties from the ethernal section of the
hardhat.config.js
file - The block time is set to 5 seconds, this can also be adjusted in the
hardhat.config.js
file - All transactions and blocks are automatically synced to the block explorer
- The scripts handle port conflicts and environment setup automatically
- Use the stop script to cleanly shut down the development network