[Ethereum] How to set default address in truffle

go-ethereumtruffle

I made four accounts and lost the passwords to the first three. I am trying to run truffle migrate, but I am worried that truffle is trying to use the first address that I created rather than the latest one for which I still have the password. How can I either:

A) Delete the first 3 addresses without the passwords


or


B) Set the default address to the latest one?

References to errors:

Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: authentication needed: password or unlock

Best Answer

You can specify the account address in truffle.js file as below:

staging: {
  host: "localhost", // Connect to geth on the specified
  port: 8545,
  from: "0x04136750a3df9f3cd19e06f60af25f596c74aa0c", // default address to use for any transaction Truffle makes during migrations
  network_id: 15,
  gas: 4700000 // Gas limit used for deploys
}
Related Topic