← 返回命令列表

Linux command

ganache-cli 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Start Ethereum test blockchain

ganache-cli

Start on specific port

ganache-cli -p [8545]

Start with specific accounts

ganache-cli -a [10]

Start with mnemonic

ganache-cli -m "[mnemonic phrase]"

Start with deterministic addresses

ganache-cli -d

Fork from mainnet

ganache-cli -f [https://mainnet.infura.io/v3/key]

Set gas limit

ganache-cli -l [8000000]

说明

ganache-cli (now part of Ganache) creates a local Ethereum blockchain for development and testing. It provides instant transaction mining and configurable test accounts for smart contract development. This command-line version is now superseded by the ganache command, which offers the same functionality with additional features. ganache-cli was originally known as TestRPC before being renamed and integrated into the Ganache suite. The tool simulates a full Ethereum client, making it ideal for testing smart contracts locally before deploying to testnets or mainnet. It integrates with development frameworks like Truffle and Hardhat.

参数

-p, --port _port_
Port number.
-a, --accounts _num_
Number of accounts.
-m, --mnemonic _phrase_
HD wallet mnemonic.
-d, --deterministic
Deterministic addresses.
-f, --fork _url_
Fork from network.
-l, --gasLimit _limit_
Block gas limit.
-e, --defaultBalanceEther _amount_
Default account balance.
-i, --networkId _id_
Network ID.

FAQ

What is the ganache-cli command used for?

ganache-cli (now part of Ganache) creates a local Ethereum blockchain for development and testing. It provides instant transaction mining and configurable test accounts for smart contract development. This command-line version is now superseded by the ganache command, which offers the same functionality with additional features. ganache-cli was originally known as TestRPC before being renamed and integrated into the Ganache suite. The tool simulates a full Ethereum client, making it ideal for testing smart contracts locally before deploying to testnets or mainnet. It integrates with development frameworks like Truffle and Hardhat.

How do I run a basic ganache-cli example?

Run `ganache-cli` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -p, --port _port_ do in ganache-cli?

Port number.