Linux command
hardhat 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Create new project
npx hardhat init
Compile contracts
npx hardhat compile
Run tests
npx hardhat test
Start local node
npx hardhat node
Run deployment script
npx hardhat run [scripts/deploy.js]
Deploy to network
npx hardhat run [scripts/deploy.js] --network [sepolia]
Open console
npx hardhat console
说明
Hardhat is an Ethereum development environment. It provides a local blockchain, debugging tools, and a plugin ecosystem for compiling, testing, and deploying smart contracts. Hardhat features console.log for Solidity debugging, network forking, and TypeScript support. It's the most popular choice for professional Ethereum development.
参数
- compile
- Compile Solidity contracts.
- test
- Run test suite.
- node
- Start local Ethereum node.
- run _script_
- Run JavaScript script.
- console
- Open interactive console.
- clean
- Clear cache and artifacts.
- --network _name_
- Target network.
- --config _file_
- Path to a Hardhat config file.
- --verbose
- Enable Hardhat verbose logging.
- --show-stack-traces
- Show full stack traces.
- --max-memory _size_
- Maximum amount of memory that Hardhat can use.
- --version
- Show Hardhat version.
- --help
- Show help message, or a task's help if its name is provided.
FAQ
What is the hardhat command used for?
Hardhat is an Ethereum development environment. It provides a local blockchain, debugging tools, and a plugin ecosystem for compiling, testing, and deploying smart contracts. Hardhat features console.log for Solidity debugging, network forking, and TypeScript support. It's the most popular choice for professional Ethereum development.
How do I run a basic hardhat example?
Run `npx hardhat init` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does compile do in hardhat?
Compile Solidity contracts.