I am trying to learn truffle, and I have compiled, migrated, and test the example contract. I load the example Dapp in my browser from local host, and I have the lists of addresses created by testRPC, but I cannot send any tokens because I have no balance. This is even though the Dapp put 1000 Metacoin in the first account.

The log, obviously says that I don't have enough funds. I am just trying to get a hang of these very simple things so I can move on to more complicated examples and start to build things myself but I am getting stuck.

  • Did you hardcode any address? Did you start TestRPC with --accounts="2"? – Xavier Leprêtre B9lab Aug 23 '16 at 15:36
  • that just creates 2 accounts instead of 10 so doesn't really solve the problem – Amazing Aug 25 '16 at 22:47
  • --accounts="10" should create 10 accounts. – Xavier Leprêtre B9lab Aug 26 '16 at 9:29
  • yes, but the number of accounts isn't the issue. It's finding a way to import the accounts into a wallet – Amazing Sep 1 '16 at 10:45

testrpc assigns a random balance to each account on startup. All accounts are created randomly every time a new instance is launched. Make sure you update addresses in the contracts with the new addresses testrpc generates each time you launch it.

Use truffle to test the contracts before deplying them on the main/private net (using a full client such as geth).

  • I realize that I need to load the mnemonic code into a client. I was using metamask but there is no option to import a wallet. – Amazing Aug 25 '16 at 22:48

Install & use truffle-hdwallet-provider inside truffle.js

HD Wallet-enabled Web3 provider. Use it to sign transactions for addresses derived from a 12-word mnemonic.

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.