LinuxCommandLibrary

ganache-cli

command-line Ethereum test blockchain

TLDR

Start Ethereum test blockchain

$ ganache-cli
copy
Start on specific port
$ ganache-cli -p [8545]
copy
Start with specific accounts
$ ganache-cli -a [10]
copy
Start with mnemonic
$ ganache-cli -m "[mnemonic phrase]"
copy
Start with deterministic addresses
$ ganache-cli -d
copy
Fork from mainnet
$ ganache-cli -f [https://mainnet.infura.io/v3/key]
copy
Set gas limit
$ ganache-cli -l [8000000]
copy

SYNOPSIS

ganache-cli [options]

DESCRIPTION

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.

PARAMETERS

-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.

CAVEATS

ganache-cli is deprecated in favor of the ganache command. Not for production use. Blockchain state resets on restart unless persistence is configured. Behavior may differ from actual Ethereum mainnet.

HISTORY

Originally released as TestRPC, it was renamed to ganache-cli when incorporated into the Truffle Suite around 2017. The tool has since been replaced by the unified ganache command starting with Ganache 7.

SEE ALSO

geth(1), truffle(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community