I have create a truffle project with this command:

truffle unbox react

I have looked at test/simplestorage.js and add a test:

contract("SimpleStorage", accounts => {
     it("my test", async () => {
         console.log(await web3.eth.getBalance(accounts[1]));

I can see test accounts are credited with 100 Ether. Is there a way to choose how much ether i can put in each account test ?



100 Ether is the default amount held by Ganache accounts.

You can change it :

  • If you use the Ganache desktop client, go to the parameter (in the right hand corner) > Accounts & Keys. Then change the account default balance field and click on the button save and restart.
  • If you use the command line client (ganache-cli) you can use the tag -e to change the default test accounts balance.
  • I am launching tests with "truffle test" command. This is not ganache, this is a javascript EVM. And i want to set this limit in my test scenario because this limit depends on the tests i want to do – Bob5421 Jan 31 at 10:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.