truffle deploy returns with the following error, in a newly create project (using flutter init)


Deploying 'Migrations'

Error: *** Deployment Failed ***

"Migrations" -- Returned error: unknown account.

I believed it is caused by my settings at truffle-config.js.

development: {
  host: "localhost",
  port: 8545,
  from: "0x60fDF758ed3549D550A52f2044B43aadf782aA4E",
  gas: "8500000",
  gasPrice: "50000000000",
  network_id: "*" // Match any network id

I have stopped programming in solidity for 6 months, and didn't aware there are so many changes :(

1 Answer 1


truffle by default uses the first account from ganache network, why do you need to specify the from address? if its necessary make sure the account is in ganache's network.

here is my suggestion

 development: {
     host: "",     // Localhost (default: none)
     port: 8545,            // Standard Ethereum port (default: none)
     network_id: "*",       // Any network (default: none)
  • I have create 10 accounts in my Genesis.json alloc section. And that from address is the last one in the alloc list. These accounts are used for my regression test. And I am still getting the same error after removing the from.
    – s k
    Oct 19, 2021 at 6:47
  • this might help medium.com/blockchainbistro/…
    – leycun
    Oct 19, 2021 at 6:58
  • thanks. I just realized that I cannot simply use any address in the alloc list without importing that account using private key (and I have been using that for the past 1 year). This is actually a loophole which had been fixed. Otherwise we can deploy any contract using any arbitrary account with balance.
    – s k
    Oct 19, 2021 at 7:08
  • understood! glad it worked!
    – leycun
    Oct 19, 2021 at 7:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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