[Ethereum] Truffle Migrations Account Locked Error with –network command

contract-deploymentdapp-developmentgo-ethereumprivate-blockchaintruffle

I have started a private blockchain using the command,

geth --networkid 1337 --datadir ~/home/xyz/testnet --ipcpath /home/xyz/.ethereum/geth.ipc --rpc --rpcapi eth,web3 --rpcport 8545 --rpcaddr localhost --rpccorsdomain "*";

Next, in another terminal console, I start the miner and unlock my test account,

> miner.start(1)
true


> personal.unlockAccount(web3.eth.coinbase)
  Unlock account 0xSomeAddress
  Passphrase: 
  true

My truffle.js file contains the following,

module.exports = {
build: {
  "index.html": "index.html",
   "app.js": [
     "javascripts/app.js"
   ],
  "app.css": [
    "stylesheets/app.css"
   ],
  "images/": "images/"
},
networks: {
"staging": {
  network_id: 1337, 
  from: "0xAddress" // Unlocked Address
 }
},
rpc: {
  host: "localhost",
  port: 8545
 }
};

Finally, in another terminal, I run and compile the truffle application using,

truffle compile
truffle migrate --network staging

I get the below Account locked Error like below,

Running migration: 1_initial_migration.js
  Deploying Migrations...
  Migrations: 0xSomeAddress
Saving successful migration to network...
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: account is locked
   at Object.InvalidResponse (/usr/lib/node_modules/truffle/node_modules/ether-pudding/node_modules/web3/lib/web3/errors.js:35:16)
   at /usr/lib/node_modules/truffle/node_modules/ether-pudding/node_modules/web3/lib/web3/requestmanager.js:86:36
   at request.onreadystatechange (/usr/lib/node_modules/truffle/node_modules/web3/lib/web3/httpprovider.js:114:13)
   at dispatchEvent (/usr/lib/node_modules/truffle/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:591:25)
   at setState (/usr/lib/node_modules/truffle/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:610:14)
   at IncomingMessage.<anonymous> (/usr/lib/node_modules/truffle/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:447:13)
   at emitNone (events.js:91:20)
   at IncomingMessage.emit (events.js:185:7)
   at endReadableNT (_stream_readable.js:974:12)
   at _combinedTickCallback (internal/process/next_tick.js:74:11)
   at process._tickDomainCallback (internal/process/next_tick.js:122:9)

Which part am I missing here? Is the process that I followed correct?
The same code runs sublimely on testrpc but not on this private blockchain, what essential part am I missing?

Please advice.

Best Answer

Possible it's not unlocked long enough?

web3.personal.unlockAccount(web3.personal.listAccounts[0],"password",15000); // 1st account, pw & time in seconds ...
Related Topic