How can I set the initial balance of an account when launching ganache-cli (aka testrpc)?

There's nothing in ganache-cli --help to indicate that this is possible.

However, when I launch ganache-cli --acctKeys=accounts.txt, I can clearly see that each account has a balance.

Thank you.


OK, found it in the Ganache Command Line guide:

-e or --defaultBalanceEther: Amount of ether to assign each test account. Default is 100.

Apparently, ganache-cli --help doesn't quite tell you everything that you need to know...


The value set via the --defaultBalanceEther parameter doesn't seem to have any impact on the amount of ether assigned to each test account (as suggested in the docs). I was, however, able to achieve my purpose by explicitly "declaring" an account with a large enough balance. For example:

ganache-cli --account="0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef,1000000000000000000000000000000000000000"

The first part of the account parameter value is the private key of the account, which must be given as a 64-character hexadecimal string (i.e., 0x followed by 64 hexadecimal-base characters).

The second part of the account parameter value is the balance, which can be provided in either decimal or hexadecimal format.

  • 4
    As of Ganache CLI v6.1.3 (ganache-core: 2.1.2), I found that ganache --defaultBalanceEther 10000 was not working but ganache -e 10000 did work.
    – jclouse
    Jun 20 '18 at 8:28

Your Answer

