2

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
John Worthley
  • 21
  • 1
  • 3
  • Really similar question and answer over here. How to be specific about the account to use: https://ethereum.stackexchange.com/questions/19283/in-the-truffle-console-how-to-set-and-get-current-account/19284#19284 – Rob Hitchens Jul 03 '17 at 03:10
  • I fixed my problem by deleting the keystores to the addresses with lost passwords – John Worthley Jul 03 '17 at 13:34

3 Answers3

2

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
}
1

As far as I know, Truffle always uses the coinbase account. You can try setting it to another account, in your case web3.miner.setEtherBase(web3.eth.accounts[3]) please report if that worked.

n1cK
  • 3,378
  • 2
  • 12
  • 18
0

You need to configure the truffle.js for giving the account to use - account will be mentioned in from paramter

networks: {
development: {
 host: "localhost",
 port: 8545,
 network_id: "*" // match any network
            },
 live: {
 host: "178.25.19.88", // Random IP for example purposes (do not use)
 port: 80,
 network_id: 1,        // Ethereum public network
// optional config values:
// gas
// gasPrice
// from - default address to use for any transaction Truffle makes 
              during migrations
// provider - web3 provider instance Truffle should use to talk to the 
              Ethereum network.
//          - if specified, host and port are ignored.
         }
     }

For each network, if unspecified, transaction options will default to the following values:

gas: Gas limit used for deploys. Default is 4712388.

gasPrice: Gas price used for deploys.Default is 100000000000 (100 Shannon).

from: From address used during migrations. Defaults to the first available account provided by your Ethereum client.

provider: Default web3 provider using host and port options: new - Web3.providers.HttpProvider("http://:")

http://truffleframework.com/docs/advanced/configuration#networks

Ajay
  • 499
  • 3
  • 13